Send Notification Email" checkbox forces email sending even when unchecked

  • Posts: 5
  • Thank you received: 0
  • Hikashop Business
1 hour 24 minutes ago #372391

-- HikaShop version -- : 6.5.0
-- Joomla version -- : 6.1.1
-- PHP version -- : 8.4.19

Hello HikaShop team,

I'm currently using HikaShop Business v6.4.1 (on Joomla 6.1.1) and I have found a bug when using the Order Mass Actions (batch process from the Orders Listing).

When I select one or multiple orders, click the "Actions" button, choose "Change status" and explicitly uncheck the "Send notification email" checkbox, the email is still being sent to the customers.

Upon debugging, we found that the issue is located in the massaction_order plugin (plugins/hikashop/massaction_order/massaction_order.php). In the onProcessOrderMassActionchangeStatus function, the code checks for the existence of the notify variable using isset():

// Around line 535

if(isset($action)){
if(!isset($element->history) || !is_object($element->history))
$element->history = new stdClass();
$element->history->history_notified = 1;
}

Because the DOM/form can submit an empty value or "0" when the checkbox is unchecked, isset() evaluates to true and blindly forces $element->history->history_notified = 1, completely ignoring the unchecked state.

Possible Fix: : Changing the validation from isset to !empty and explicitly forcing 0 when false solves the problem completely:

if(!empty($action)){
if(!isset($element->history) || !is_object($element->history))
$element->history = new stdClass();
$element->history->history_notified = 1;
} else {
if(!isset($element->history) || !is_object($element->history))
$element->history = new stdClass();
$element->history->history_notified = 0;
}

Could you please verify if my observation is correct? I would appreciate it if you could let me know if this proposed solution is the right approach to fix it.

Thank you for your time!

Please Log in or Create an account to join the conversation.

Time to create page: 0.093 seconds
Powered by Kunena Forum