Skip to content

Commit

Permalink
#37310 check for existence before setting values
Browse files Browse the repository at this point in the history
  • Loading branch information
JonYeb committed Oct 29, 2024
1 parent 13a3d46 commit 8ea0061
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/modules/mo/mo_dhl/Adapter/ParcelShippingRequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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()) {
Expand Down

0 comments on commit 8ea0061

Please sign in to comment.