diff --git a/Config/config.xml b/Config/config.xml index 599ad57..90fb440 100755 --- a/Config/config.xml +++ b/Config/config.xml @@ -8,15 +8,6 @@ - - - - - - - - - diff --git a/Config/module.xml b/Config/module.xml index f82a293..0d020f3 100755 --- a/Config/module.xml +++ b/Config/module.xml @@ -14,7 +14,7 @@ fr_FR en_US - 1.4.5 + 2.0.0 Thelia @@ -28,6 +28,6 @@ payment - 2.2.0 + 2.5.0 prod diff --git a/EventListeners/SendConfirmationEmail.php b/EventListeners/SendConfirmationEmail.php index b7dbbd3..8749812 100644 --- a/EventListeners/SendConfirmationEmail.php +++ b/EventListeners/SendConfirmationEmail.php @@ -13,7 +13,7 @@ namespace CmCIC\EventListeners; use CmCIC\CmCIC; -use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Thelia\Core\Event\Order\OrderEvent; use Thelia\Core\Event\TheliaEvents; @@ -21,6 +21,13 @@ class SendConfirmationEmail implements EventSubscriberInterface { + protected EventDispatcherInterface $dispatcher; + + public function __construct(EventDispatcherInterface $dispatcher) + { + $this->dispatcher = $dispatcher; + } + /** * @param OrderEvent $event * @@ -39,16 +46,15 @@ public function sendConfirmationEmail(OrderEvent $event) /** * @param OrderEvent $event - * @param EventDispatcher $dispatcher * @throws \Propel\Runtime\Exception\PropelException */ - public function updateStatus(OrderEvent $event, EventDispatcher $dispatcher) + public function updateStatus(OrderEvent $event) { $order = $event->getOrder(); if ($order->isPaid() && $order->getPaymentModuleId() == CmCIC::getModuleId()) { // Send confirmation email if required. if (CmCIC::getConfigValue('send_confirmation_message_only_if_paid')) { - $dispatcher->dispatch($event, TheliaEvents::ORDER_SEND_CONFIRMATION_EMAIL); + $this->dispatcher->dispatch($event, TheliaEvents::ORDER_SEND_CONFIRMATION_EMAIL); } Tlog::getInstance()->debug("Confirmation email sent to customer " . $order->getCustomer()->getEmail());