Module DHL : modif pour rajout de données dans l'envoi du mail

This commit is contained in:
2020-12-07 17:47:25 +01:00
parent ee21283692
commit c388c942b5
2 changed files with 3 additions and 26 deletions

View File

@@ -2,7 +2,6 @@
namespace DHL; namespace DHL;
use DHL\Model\Config\DHLConfigValue;
use DHL\Model\DHLDeliveryPrice; use DHL\Model\DHLDeliveryPrice;
use DHL\Model\DHLDeliveryPriceQuery; use DHL\Model\DHLDeliveryPriceQuery;
use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\Criteria;
@@ -184,12 +183,4 @@ class DHL extends AbstractDeliveryModule
return $postage; return $postage;
} }
// public function update($currentVersion, $newVersion, ConnectionInterface $con = null)
// {
// $uploadDir = __DIR__ . '/Config/prices.json';
// if (is_readable($uploadDir) && DHL::getConfigValue(DHLConfigValue::PRICES, null) == null) {
// DHL::setConfigValue(DHLConfigValue::PRICES, file_get_contents($uploadDir));
// }
// }
} }

View File

@@ -1,18 +1,9 @@
<?php <?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace DHL\Listener; namespace DHL\Listener;
use DHL\DHL; use DHL\DHL;
use DHL\Model\Config\DHLConfigValue;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Core\Event\Order\OrderEvent; use Thelia\Core\Event\Order\OrderEvent;
use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\TheliaEvents;
@@ -21,20 +12,16 @@ use Thelia\Log\Tlog;
use Thelia\Mailer\MailerFactory; use Thelia\Mailer\MailerFactory;
use Thelia\Model\ConfigQuery; use Thelia\Model\ConfigQuery;
use Thelia\Model\MessageQuery; use Thelia\Model\MessageQuery;
use Thelia\Model\OrderStatus;
use Thelia\Module\PaymentModuleInterface;
/** /**
* Class SendMail * Class SendMail
* @package DHL\Listener * @package DHL\Listener
* @author Manuel Raynaud <manu@raynaud.io> * @author Laurent LE CORRE <laurent@thecoredev.fr>
*/ */
class SendMail implements EventSubscriberInterface class SendMail implements EventSubscriberInterface
{ {
protected $parser; protected $parser;
protected $mailer; protected $mailer;
public function __construct(ParserInterface $parser, MailerFactory $mailer) public function __construct(ParserInterface $parser, MailerFactory $mailer)
@@ -69,7 +56,7 @@ class SendMail implements EventSubscriberInterface
$this->parser->assign('order_date', $order->getCreatedAt()); $this->parser->assign('order_date', $order->getCreatedAt());
$this->parser->assign('update_date', $order->getUpdatedAt()); $this->parser->assign('update_date', $order->getUpdatedAt());
$this->parser->assign('package', $order->getDeliveryRef()); $this->parser->assign('package', $order->getDeliveryRef());
$this->parser->assign('tracking_url', DHL::getConfigValue(DHLConfigValue::TRACKING_URL));
$message $message
->setLocale($order->getLang()->getLocale()); ->setLocale($order->getLang()->getLocale());
@@ -80,7 +67,6 @@ class SendMail implements EventSubscriberInterface
; ;
// Build subject and body // Build subject and body
$message->buildMessage($this->parser, $instance); $message->buildMessage($this->parser, $instance);
$this->mailer->send($instance); $this->mailer->send($instance);