Correction d'un bogue sur module OrderStatusNotify

This commit is contained in:
2020-11-17 11:55:28 +01:00
parent d0944147e5
commit 2e80674fd2

View File

@@ -39,20 +39,30 @@ class OrderStatusListener implements EventSubscriberInterface
$is_order_status_to_notify = OrderStatusNotificationQuery::create()->findOneByOrderStatusId($new_status_id); $is_order_status_to_notify = OrderStatusNotificationQuery::create()->findOneByOrderStatusId($new_status_id);
if (null !== $is_order_status_to_notify) { if (null !== $is_order_status_to_notify) {
$new_statut_label = OrderStatusI18nQuery::create() try {
->filterByLocale($order->getLang()->getLocale()) $new_statut_label = OrderStatusI18nQuery::create()
->findOneById($new_status_id) ->filterByLocale($order->getLang()->getLocale())
->getTitle(); ->findOneById($new_status_id)
->getTitle();
}
catch (\Throwable $e) {
$new_statut_label = OrderStatusI18nQuery::create()
->filterByLocale('fr_FR')
->findOneById($new_status_id)
->getTitle();
}
$this->mailer->sendEmailToCustomer( if (null !== $new_statut_label) {
OrderStatusNotify::MESSAGE_NAME, $this->mailer->sendEmailToCustomer(
$order->getCustomer(), OrderStatusNotify::MESSAGE_NAME,
[ $order->getCustomer(),
'order_id' => $order->getId(), [
'order_ref' => $order->getRef(), 'order_id' => $order->getId(),
'new_status' => $new_statut_label, 'order_ref' => $order->getRef(),
] 'new_status' => $new_statut_label,
); ]
);
}
Tlog::getInstance()->debug("Order status change sent to customer " . $order->getCustomer()->getEmail()); Tlog::getInstance()->debug("Order status change sent to customer " . $order->getCustomer()->getEmail());
} }
} }