diff --git a/ColissimoLabel.php b/ColissimoLabel.php index 0fea1f7..5b2f358 100644 --- a/ColissimoLabel.php +++ b/ColissimoLabel.php @@ -101,7 +101,7 @@ class ColissimoLabel extends BaseModule /** * @param ConnectionInterface|null $con */ - public function postActivation(ConnectionInterface $con = null): void + public function postActivation(?ConnectionInterface $con = null): void { static::checkLabelFolder(); @@ -114,7 +114,7 @@ public function postActivation(ConnectionInterface $con = null): void $this->checkConfigurationsValues(); } - public function update($currentVersion, $newVersion, ConnectionInterface $con = null): void + public function update($currentVersion, $newVersion, ?ConnectionInterface $con = null): void { $finder = Finder::create() ->name('*.sql') @@ -419,7 +419,7 @@ public static function removeAccents($str): bool|string public static function configureServices(ServicesConfigurator $servicesConfigurator): void { $servicesConfigurator->load(self::getModuleCode().'\\', __DIR__) - ->exclude([THELIA_MODULE_DIR.ucfirst(self::getModuleCode()).'/I18n/*']) + ->exclude([__DIR__.'/I18n/*']) ->autowire() ->autoconfigure(); } diff --git a/Config/module.xml b/Config/module.xml index 2108bd8..c7c1901 100644 --- a/Config/module.xml +++ b/Config/module.xml @@ -13,7 +13,7 @@ en_US fr_FR - 3.0.2 + 3.0.3 Gilles Bourgeat diff --git a/EventListeners/GenerateLabelListener.php b/EventListeners/GenerateLabelListener.php index 829f1d2..d128bbd 100644 --- a/EventListeners/GenerateLabelListener.php +++ b/EventListeners/GenerateLabelListener.php @@ -28,7 +28,7 @@ public function __construct( ) { } - public function generateLabel(GenerateLabelEvent $event): void + public function generateLabel(object $event): void { $deliveryModuleCode = $event->getOrder()->getModuleRelatedByDeliveryModuleId()?->getCode(); if ($deliveryModuleCode === "ColissimoHomeDelivery" || $deliveryModuleCode === "ColissimoPickupPoint"|| $deliveryModuleCode === "SoColissimo") { diff --git a/EventListeners/UpdateDeliveryAddressListener.php b/EventListeners/UpdateDeliveryAddressListener.php index 02d7304..fea87a1 100644 --- a/EventListeners/UpdateDeliveryAddressListener.php +++ b/EventListeners/UpdateDeliveryAddressListener.php @@ -105,6 +105,7 @@ protected function generateLabel(Order $order, $weight, $signedDelivery): void /* Check if delivery is a relay point through ColissimoPickupPoint. Use relay point address if it is */ if (AuthorizedModuleEnum::ColissimoPickupPoint->value === $order->getModuleRelatedByDeliveryModuleId()->getCode() && + class_exists(OrderAddressColissimoPickupPointQuery::class) && null !== ($AddressColissimoPickupPoint = OrderAddressColissimoPickupPointQuery::create() ->findOneById($order->getDeliveryOrderAddressId())) && $AddressColissimoPickupPoint) { diff --git a/Service/LabelService.php b/Service/LabelService.php index 69f87e5..10bf8d7 100644 --- a/Service/LabelService.php +++ b/Service/LabelService.php @@ -85,7 +85,8 @@ public function generateLabel($data, EventDispatcherInterface $dispatcher): arra $colissimoRequest = null; /* Same thing with ColissimoPickupPoint */ - if (AuthorizedModuleEnum::ColissimoPickupPoint->value === $order->getModuleRelatedByDeliveryModuleId()->getCode()) { + if (AuthorizedModuleEnum::ColissimoPickupPoint->value === $order->getModuleRelatedByDeliveryModuleId()->getCode() + && class_exists(OrderAddressColissimoPickupPointQuery::class)) { if (null !== $AddressColissimoPickupPoint = OrderAddressColissimoPickupPointQuery::create() ->findOneById($order->getDeliveryOrderAddressId())) { /* If the delivery is through a relay point, we create a new LabelRequest with the relay point and order infos */