From 8ea00614c04131c48b5186189f9055319836df25 Mon Sep 17 00:00:00 2001 From: Jonathan Yeboah <10155597+JonYeb@users.noreply.github.com> Date: Tue, 29 Oct 2024 11:37:14 +0100 Subject: [PATCH] #37310 check for existence before setting values --- .../mo_dhl/Adapter/ParcelShippingRequestBuilder.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/modules/mo/mo_dhl/Adapter/ParcelShippingRequestBuilder.php b/src/modules/mo/mo_dhl/Adapter/ParcelShippingRequestBuilder.php index 1a476d1..4f017f8 100644 --- a/src/modules/mo/mo_dhl/Adapter/ParcelShippingRequestBuilder.php +++ b/src/modules/mo/mo_dhl/Adapter/ParcelShippingRequestBuilder.php @@ -81,7 +81,10 @@ public function buildShipment(string $orderId) $shipment->setProduct($this->getProcess($order)->getServiceIdentifier()); $customerReference = Registry::getLang()->translateString('GENERAL_ORDERNUM') . ' ' . $order->getFieldData('oxordernr'); $shipment->setRefNo($customerReference); - $shipment->setServices($this->buildService($order)); + if ($builtService = $this->buildService($order)) { + $shipment->setServices($builtService); + } + $shipment->setShipDate($this->buildShipmentDate()); return $shipment; } @@ -311,10 +314,9 @@ protected function createIdent(Order $order): VASIdentCheck } $identCheck->setFirstName($order->moDHLGetAddressData('fname')); $identCheck->setLastName($order->moDHLGetAddressData('lname')); - $identCheck->setMinimumAge( - Registry::getConfig()->getShopConfVar('mo_dhl__ident_check_min_age') - ? 'A' . Registry::getConfig()->getShopConfVar('mo_dhl__ident_check_min_age') - : null); + if($minimumAge = Registry::getConfig()->getShopConfVar('mo_dhl__ident_check_min_age')) { + $identCheck->setMinimumAge('A' . $minimumAge); + } if ($order->moDHLUsesService(MoDHLService::MO_DHL__VISUAL_AGE_CHECK18)) { $identCheck->setMinimumAge('A18'); } elseif ($order->moDHLUsesService(MoDHLService::MO_DHL__VISUAL_AGE_CHECK16) && !$identCheck->getMinimumAge()) {