Correction d'un bogue sur module OrderStatusNotify
This commit is contained in:
@@ -39,20 +39,30 @@ class OrderStatusListener implements EventSubscriberInterface
|
||||
|
||||
$is_order_status_to_notify = OrderStatusNotificationQuery::create()->findOneByOrderStatusId($new_status_id);
|
||||
if (null !== $is_order_status_to_notify) {
|
||||
$new_statut_label = OrderStatusI18nQuery::create()
|
||||
->filterByLocale($order->getLang()->getLocale())
|
||||
->findOneById($new_status_id)
|
||||
->getTitle();
|
||||
try {
|
||||
$new_statut_label = OrderStatusI18nQuery::create()
|
||||
->filterByLocale($order->getLang()->getLocale())
|
||||
->findOneById($new_status_id)
|
||||
->getTitle();
|
||||
}
|
||||
catch (\Throwable $e) {
|
||||
$new_statut_label = OrderStatusI18nQuery::create()
|
||||
->filterByLocale('fr_FR')
|
||||
->findOneById($new_status_id)
|
||||
->getTitle();
|
||||
}
|
||||
|
||||
$this->mailer->sendEmailToCustomer(
|
||||
OrderStatusNotify::MESSAGE_NAME,
|
||||
$order->getCustomer(),
|
||||
[
|
||||
'order_id' => $order->getId(),
|
||||
'order_ref' => $order->getRef(),
|
||||
'new_status' => $new_statut_label,
|
||||
]
|
||||
);
|
||||
if (null !== $new_statut_label) {
|
||||
$this->mailer->sendEmailToCustomer(
|
||||
OrderStatusNotify::MESSAGE_NAME,
|
||||
$order->getCustomer(),
|
||||
[
|
||||
'order_id' => $order->getId(),
|
||||
'order_ref' => $order->getRef(),
|
||||
'new_status' => $new_statut_label,
|
||||
]
|
||||
);
|
||||
}
|
||||
Tlog::getInstance()->debug("Order status change sent to customer " . $order->getCustomer()->getEmail());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user