From cd63a4a3cee68f7472a32f98a2c8d43492a010b9 Mon Sep 17 00:00:00 2001 From: mbe Date: Wed, 21 Aug 2024 11:19:31 +0200 Subject: [PATCH] #36623 bugfix custom label return address --- .../mo_dhl/Adapter/ParcelShippingCustomRequestBuilder.php | 8 ++++---- .../mo/mo_dhl/Adapter/ParcelShippingRequestBuilder.php | 2 +- .../mo/mo_dhl/views/admin/tpl/order_dhl_custom_label.tpl | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/modules/mo/mo_dhl/Adapter/ParcelShippingCustomRequestBuilder.php b/src/modules/mo/mo_dhl/Adapter/ParcelShippingCustomRequestBuilder.php index 77df0e2..b764679 100644 --- a/src/modules/mo/mo_dhl/Adapter/ParcelShippingCustomRequestBuilder.php +++ b/src/modules/mo/mo_dhl/Adapter/ParcelShippingCustomRequestBuilder.php @@ -38,7 +38,7 @@ public function toCustomizableParametersArray($query, Shipment $shipment): array { $shipper = $shipment->getShipper(); $services = $shipment->getServices(); - $returnReceiver = $services->isInitialized('dhlRetoure') ? $services->getDhlRetoure()->getReturnAddress() : null; + $returnReceiver = $services->isInitialized('dhlRetoure') ? $services->getDhlRetoure()->getReturnAddress() : oxNew(ParcelShippingRequestBuilder::class)->buildReturnReceiver(); return [ 'weight' => array_merge([ 'total' => ['weight' => $shipment->getDetails()->getWeight()->getValue(), 'title' => Registry::getLang()->translateString('GENERAL_ATALL')], @@ -57,8 +57,8 @@ public function toCustomizableParametersArray($query, Shipment $shipment): array 'services' => [ 'parcelOutletRouting' => $services->isInitialized('parcelOutletRouting') ? $services->getParcelOutletRouting() : null, 'printOnlyIfCodeable' => $query['mustEncode'], - 'dhlRetoure' => $services->isInitialized('dhlRetoure') ? [ - 'active' => (bool)$services->getDhlRetoure()->getBillingNumber(), + 'dhlRetoure' => [ + 'active' => $services->isInitialized('dhlRetoure') && $services->getDhlRetoure()->getBillingNumber(), 'address' => [ 'name1' => $returnReceiver->getName1(), 'name2' => $returnReceiver->isInitialized('name2') ? $returnReceiver->getName2() : '', @@ -69,7 +69,7 @@ public function toCustomizableParametersArray($query, Shipment $shipment): array 'city' => $returnReceiver->getCity(), 'country' => $returnReceiver->getCountry(), ] - ] : null, + ], 'bulkyGoods' => $services->isInitialized('bulkyGoods') && $services->getBulkyGoods(), 'additionalInsurance' => $services->isInitialized('additionalInsurance') ? $services->getAdditionalInsurance()->getValue() : null, 'identCheck' => $services->isInitialized('identCheck') ? $services->getIdentCheck() : null, diff --git a/src/modules/mo/mo_dhl/Adapter/ParcelShippingRequestBuilder.php b/src/modules/mo/mo_dhl/Adapter/ParcelShippingRequestBuilder.php index ddec672..8924e45 100644 --- a/src/modules/mo/mo_dhl/Adapter/ParcelShippingRequestBuilder.php +++ b/src/modules/mo/mo_dhl/Adapter/ParcelShippingRequestBuilder.php @@ -334,7 +334,7 @@ protected function createIdent(Order $order): VASIdentCheck /** * @return ContactAddress */ - protected function buildReturnReceiver(): ContactAddress + public function buildReturnReceiver(): ContactAddress { $config = Registry::getConfig(); if ($config->getShopConfVar('mo_dhl__retoure_receiver_use_sender')) { diff --git a/src/modules/mo/mo_dhl/views/admin/tpl/order_dhl_custom_label.tpl b/src/modules/mo/mo_dhl/views/admin/tpl/order_dhl_custom_label.tpl index a605644..6f21977 100644 --- a/src/modules/mo/mo_dhl/views/admin/tpl/order_dhl_custom_label.tpl +++ b/src/modules/mo/mo_dhl/views/admin/tpl/order_dhl_custom_label.tpl @@ -294,7 +294,7 @@ + [{if $shipmentOrder.services.dhlRetoure.active}]checked[{/if}]> [{/if}]