Skip to content

Commit

Permalink
Merge pull request #114 from Invertus/3.2.17
Browse files Browse the repository at this point in the history
3.2.17
  • Loading branch information
GytisZum authored Nov 30, 2023
2 parents 7953f27 + 23dfb1c commit b48590a
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 10 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
16 changes: 9 additions & 7 deletions views/templates/hook/admin/partials/pudo-info.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,34 @@
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*}
<div class="col-lg-12 pudo-info-container">
<input class="hidden d-none form-control" name="selected-pudo-id" value="{$selectedPudo->getParcelShopId()}">
<input class="hidden d-none form-control" name="selected_pudo_iso_code" value="{$selectedPudo->getCountry()}">
<input class="hidden d-none form-control" name="selected-pudo-id" value="{$selectedPudo->getParcelShopId()|escape:'htmlall':'UTF-8'}">
<input class="hidden d-none form-control" name="selected_pudo_iso_code" value="{$selectedPudo->getCountry()|escape:'htmlall':'UTF-8'}">
<div class="card-body">
<div class="form-horizontal form-group">
<div class="form-row row dpd-form-group">
<label class="control-label col-lg-3 dpd-no-padding">{l s='Address: ' mod='dpdbaltics'}</label>
<div class="address col-lg-9">
{$selectedPudo->getStreet()}
{$selectedPudo->getStreet()|escape:'htmlall':'UTF-8'}
</div>
<input name="dpd-street" type="hidden" value="{$selectedPudo->getStreet()|escape:'htmlall':'UTF-8'}">
</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()}
{$selectedPudo->getPCode()|escape:'htmlall':'UTF-8'}
</div>
<input name="dpd-zip-code" type="hidden" value="{$selectedPudo->getPCode()|escape:'htmlall':'UTF-8'}">
</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>
<div class="city col-lg-9">
{$selectedPudo->getCity()}
{$selectedPudo->getCity()|escape:'htmlall':'UTF-8'}
</div>
</div>
<div class="form-row row dpd-form-group">
<label class="control-label col-lg-3 dpd-no-padding ">{l s='Country: ' mod='dpdbaltics'}</label>
<div class="country col-lg-9">
{$selectedPudo->getCountry()}
{$selectedPudo->getCountry()|escape:'htmlall':'UTF-8'}
</div>
</div>
<div class="form-row row dpd-form-group">
Expand All @@ -59,7 +61,7 @@
<ul class="work-hours d-none hidden">
{l s='Working hours:' mod='dpdbaltics'}
{foreach $selectedPudo->getOpeningHours() as $workHours}
<li>{$workHours->getWorkHoursFormatted()}</li>
<li>{$workHours->getWorkHoursFormatted()|escape:'htmlall':'UTF-8'}</li>
{/foreach}
</ul>
</div>
Expand Down

0 comments on commit b48590a

Please sign in to comment.