From 7aed46ca77fd98273ce29ba4bfac06a07ae7cdad Mon Sep 17 00:00:00 2001 From: Gytautas Date: Mon, 27 Nov 2023 16:03:25 +0200 Subject: [PATCH 1/6] fix: label printix fix --- src/Service/PudoService.php | 3 ++- src/Service/ShipmentService.php | 3 ++- views/templates/hook/admin/partials/pudo-info.tpl | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Service/PudoService.php b/src/Service/PudoService.php index a3fb14e3..6e59cd97 100644 --- a/src/Service/PudoService.php +++ b/src/Service/PudoService.php @@ -241,7 +241,7 @@ public function searchPudoServices($city, $carrierId, $cartId) ]; } - public function savePudoOrder($productId, $pudoId, $isoCode, $cartId, $city, $street) + public function savePudoOrder($productId, $pudoId, $isoCode, $cartId, $city, $street, $zipCode) { $pudoOrderId = $this->pudoRepository->getIdByCart($cartId); $product = new DPDProduct($productId); @@ -254,6 +254,7 @@ public function savePudoOrder($productId, $pudoId, $isoCode, $cartId, $city, $st $pudoOrder->id_cart = $cartId; $pudoOrder->city = $city; $pudoOrder->street = $street; + $pudoOrder->post_code = $zipCode; $pudoOrder->save(); } diff --git a/src/Service/ShipmentService.php b/src/Service/ShipmentService.php index b75d09b8..ffe9dcc6 100644 --- a/src/Service/ShipmentService.php +++ b/src/Service/ShipmentService.php @@ -415,9 +415,10 @@ public function saveShipment(Order $order, ShipmentData $shipmentData, $print = $isoCode = $shipmentData->getSelectedPudoIsoCode(); $city = $shipmentData->getCity(); $street = $shipmentData->getDpdStreet(); + $zipCode = $shipmentData->getDpdZipCode(); try { - $this->pudoService->savePudoOrder($productId, $pudoId, $isoCode, $cartId, $city, $street); + $this->pudoService->savePudoOrder($productId, $pudoId, $isoCode, $cartId, $city, $street, $zipCode); } catch (Exception $e) { $response['message'] = $this->module->l( sprintf('Failed to save pudo order to database Error: %s', $e->getMessage(). 'ID cart: '. $order->id_cart) diff --git a/views/templates/hook/admin/partials/pudo-info.tpl b/views/templates/hook/admin/partials/pudo-info.tpl index 3bce6f6f..4f09ab78 100644 --- a/views/templates/hook/admin/partials/pudo-info.tpl +++ b/views/templates/hook/admin/partials/pudo-info.tpl @@ -26,12 +26,15 @@
{$selectedPudo->getStreet()}
+ +
{$selectedPudo->getPCode()}
+
From d39cca340bc753e41392b51cca564d6351076dc7 Mon Sep 17 00:00:00 2001 From: Gytautas Date: Mon, 27 Nov 2023 16:26:04 +0200 Subject: [PATCH 2/6] fix: added some more validations to make sure street exist --- src/Factory/ShipmentDataFactory.php | 1 + src/Service/API/ShipmentApiService.php | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Factory/ShipmentDataFactory.php b/src/Factory/ShipmentDataFactory.php index 68552708..28b59341 100644 --- a/src/Factory/ShipmentDataFactory.php +++ b/src/Factory/ShipmentDataFactory.php @@ -120,6 +120,7 @@ public function getShipmentDataByIdOrder($orderId) $shipmentData->setDpdCountry($dpdPudo->country_code); $shipmentData->setSelectedPudoIsoCode($dpdPudo->country_code); $shipmentData->setDpdZipCode($address->postcode); + $shipmentData->setDpdStreet($dpdPudo->street); $shipmentData->setSelectedPudoId($dpdPudo->pudo_id); } diff --git a/src/Service/API/ShipmentApiService.php b/src/Service/API/ShipmentApiService.php index ef125a9c..3b2e5e7f 100644 --- a/src/Service/API/ShipmentApiService.php +++ b/src/Service/API/ShipmentApiService.php @@ -237,6 +237,7 @@ private function setNotRequiredData(ShipmentCreationRequest $shipmentCreationReq private function setPudoData(ShipmentCreationRequest $shipmentCreationRequest, ShipmentData $shipmentData) { $shipmentCreationRequest->setParcelShopId($shipmentData->getSelectedPudoId()); + $shipmentCreationRequest->setStreet($shipmentData->getDpdStreet()); return $shipmentCreationRequest; } From f634b5167e673ed77b9c186da1bf5d80df830700 Mon Sep 17 00:00:00 2001 From: Gytautas Date: Mon, 27 Nov 2023 16:28:09 +0200 Subject: [PATCH 3/6] removed div --- views/templates/hook/admin/partials/pudo-info.tpl | 1 - 1 file changed, 1 deletion(-) diff --git a/views/templates/hook/admin/partials/pudo-info.tpl b/views/templates/hook/admin/partials/pudo-info.tpl index 4f09ab78..e8aa7626 100644 --- a/views/templates/hook/admin/partials/pudo-info.tpl +++ b/views/templates/hook/admin/partials/pudo-info.tpl @@ -27,7 +27,6 @@ {$selectedPudo->getStreet()}
-
From 7e32d7d0f6ad6246783545c7f9878e2077401cc7 Mon Sep 17 00:00:00 2001 From: Gytautas Date: Mon, 27 Nov 2023 16:47:02 +0200 Subject: [PATCH 4/6] version increase --- CHANGELOG.md | 3 +++ dpdbaltics.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49341cd7..a2a029cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -151,3 +151,6 @@ ## [3.2.16] - Improved performance - Added additional validation + +## [3.2.17] +- Label printing bug fix diff --git a/dpdbaltics.php b/dpdbaltics.php index 0fe045a9..cb11ea4f 100644 --- a/dpdbaltics.php +++ b/dpdbaltics.php @@ -92,7 +92,7 @@ public function __construct() $this->author = 'Invertus'; $this->tab = 'shipping_logistics'; $this->description = 'DPD Baltics shipping integration'; - $this->version = '3.2.16'; + $this->version = '3.2.17'; $this->ps_versions_compliancy = ['min' => '1.7.1.0', 'max' => _PS_VERSION_]; $this->need_instance = 0; parent::__construct(); From d7522d0ea7c87744c0b77923021d4eed8ed514d4 Mon Sep 17 00:00:00 2001 From: Gytautas Date: Mon, 27 Nov 2023 16:48:34 +0200 Subject: [PATCH 5/6] changelog typo fix --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2a029cf..b3168040 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -153,4 +153,4 @@ - Added additional validation ## [3.2.17] -- Label printing bug fix +- Label printing after changing shipment product bug fix From 5308142ad53497aa6256a573057281550e6cf83a Mon Sep 17 00:00:00 2001 From: Gytautas Date: Tue, 28 Nov 2023 14:26:56 +0200 Subject: [PATCH 6/6] fix: street setter bug fix --- src/Service/API/ShipmentApiService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Service/API/ShipmentApiService.php b/src/Service/API/ShipmentApiService.php index 3b2e5e7f..9c40edbe 100644 --- a/src/Service/API/ShipmentApiService.php +++ b/src/Service/API/ShipmentApiService.php @@ -108,6 +108,7 @@ public function createShipment($addressId, ShipmentData $shipmentData, $orderId) $parcel = $this->parcelShopService->getParcelShopByShopId($shipmentData->getSelectedPudoId()); $selectedParcel = is_array($parcel) ? reset($parcel) : $parcel; $postCode = $selectedParcel->getPCode(); + $address->address1 = $selectedParcel->getStreet(); } // IF prestashop allows, we take selected parcel terminal address in case information is missing in checkout address in specific cases. @@ -237,7 +238,6 @@ private function setNotRequiredData(ShipmentCreationRequest $shipmentCreationReq private function setPudoData(ShipmentCreationRequest $shipmentCreationRequest, ShipmentData $shipmentData) { $shipmentCreationRequest->setParcelShopId($shipmentData->getSelectedPudoId()); - $shipmentCreationRequest->setStreet($shipmentData->getDpdStreet()); return $shipmentCreationRequest; }