From 40b78b9a634ab6d4138ad24436a2c8baf173cbed Mon Sep 17 00:00:00 2001 From: TheCoreDev Date: Mon, 7 Dec 2020 22:01:54 +0100 Subject: [PATCH] Correction d'un bogue dans l'envoi de mail ColissimoWs + finalisation module DHL --- core/lib/Thelia/Model/Order.php | 3 +-- .../ShippingNotificationSender.php | 5 ++++- .../DHL/EventListener/AreaDeletedListener.php | 16 ++++++++-------- local/modules/DHL/Listener/SendMail.php | 2 +- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/core/lib/Thelia/Model/Order.php b/core/lib/Thelia/Model/Order.php index fcd9ce08..32cdf19c 100644 --- a/core/lib/Thelia/Model/Order.php +++ b/core/lib/Thelia/Model/Order.php @@ -361,8 +361,7 @@ class Order extends BaseOrder { if (is_array($statusCode)) { return in_array($this->getOrderStatus()->getCode(), $statusCode); - } else { - return $this->getOrderStatus()->getCode() == $statusCode; + } else {return $this->getOrderStatus()->getCode() == $statusCode; } } } diff --git a/local/modules/ColissimoWs/EventListeners/ShippingNotificationSender.php b/local/modules/ColissimoWs/EventListeners/ShippingNotificationSender.php index 22596601..e57cd148 100644 --- a/local/modules/ColissimoWs/EventListeners/ShippingNotificationSender.php +++ b/local/modules/ColissimoWs/EventListeners/ShippingNotificationSender.php @@ -53,7 +53,10 @@ class ShippingNotificationSender extends BaseAction implements EventSubscriberIn */ public function sendShippingNotification(OrderEvent $event) { - if ($event->getOrder()->isSent()) { + $order = $event->getOrder(); + $module = new ColissimoWs(); + + if ($event->getOrder()->isSent() && $order->getDeliveryModuleId() == $module->getModuleModel()->getId()) { $contact_email = ConfigQuery::getStoreEmail(); if ($contact_email) { diff --git a/local/modules/DHL/EventListener/AreaDeletedListener.php b/local/modules/DHL/EventListener/AreaDeletedListener.php index b0c0d7aa..c9c7c42a 100644 --- a/local/modules/DHL/EventListener/AreaDeletedListener.php +++ b/local/modules/DHL/EventListener/AreaDeletedListener.php @@ -11,7 +11,7 @@ use Thelia\Core\Event\TheliaEvents; /** * Class AreaDeletedListener * @package AreaDeletedListener\EventListener - * @author Thomas Arnaud + * @author Laurent LE CORRE */ class AreaDeletedListener implements EventSubscriberInterface { @@ -20,13 +20,13 @@ class AreaDeletedListener implements EventSubscriberInterface */ public function updateConfig(AreaDeleteEvent $event) { - if (null !== $data = DHL::getConfigValue(DHLConfigValue::PRICES, null)) { - $areaId = $event->getAreaId(); - $json_data = json_decode($data, true); - unset($json_data[$areaId]); - - DHL::setConfigValue(DHLConfigValue::PRICES, json_encode($json_data, true)); - } +// if (null !== $data = DHL::getConfigValue(DHLConfigValue::PRICES, null)) { +// $areaId = $event->getAreaId(); +// $json_data = json_decode($data, true); +// unset($json_data[$areaId]); +// +// DHL::setConfigValue(DHLConfigValue::PRICES, json_encode($json_data, true)); +// } } /** diff --git a/local/modules/DHL/Listener/SendMail.php b/local/modules/DHL/Listener/SendMail.php index e231beb1..38fe7cd3 100644 --- a/local/modules/DHL/Listener/SendMail.php +++ b/local/modules/DHL/Listener/SendMail.php @@ -45,7 +45,7 @@ class SendMail implements EventSubscriberInterface ->findOne(); if (false === $message) { - throw new \Exception("Failed to load message 'order_confirmation'."); + throw new \Exception("Failed to load message 'mail_dhl'."); } $order = $event->getOrder();