Skip to content

Commit

Permalink
Merge pull request #113 from Invertus/DGS-293/empty-street-bug-fix
Browse files Browse the repository at this point in the history
DGS-2893/ label printing fix
  • Loading branch information
GytisZum authored Nov 29, 2023
2 parents 7953f27 + 5308142 commit 6737a59
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,6 @@
## [3.2.16]
- Improved performance
- Added additional validation

## [3.2.17]
- Label printing after changing shipment product bug fix
2 changes: 1 addition & 1 deletion dpdbaltics.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/Factory/ShipmentDataFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
1 change: 1 addition & 0 deletions src/Service/API/ShipmentApiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion src/Service/PudoService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
}

Expand Down
3 changes: 2 additions & 1 deletion src/Service/ShipmentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions views/templates/hook/admin/partials/pudo-info.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@
<div class="address col-lg-9">
{$selectedPudo->getStreet()}
</div>
<input name="dpd-street" type="hidden" value="{$selectedPudo->getStreet()}">
</div>
<div class="form-row row dpd-form-group">
<label class="control-label col-lg-3 dpd-no-padding">{l s='Post code: ' mod='dpdbaltics'}</label>
<div class="zip-code col-lg-9">
{$selectedPudo->getPCode()}
</div>
<input name="dpd-zip-code" type="hidden" value="{$selectedPudo->getPCode()}">
</div>
<div class="form-row row dpd-form-group">
<label class="control-label col-lg-3 dpd-no-padding">{l s='City: ' mod='dpdbaltics'}</label>
Expand Down

0 comments on commit 6737a59

Please sign in to comment.