From e169f6395a2b7482a4a6b803dd8028c84a852be8 Mon Sep 17 00:00:00 2001 From: Joeri van Veen Date: Thu, 21 Nov 2024 14:52:41 +0100 Subject: [PATCH] feat: add receipt code for belgium (#874) * feat: add receipt code for belgium * chore: fix spelling error in comment --- Helper/Data.php | 12 ++++++++++-- view/adminhtml/templates/new_shipment.phtml | 2 -- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Helper/Data.php b/Helper/Data.php index 1fe7d8c8..132f5502 100755 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -258,15 +258,23 @@ public function consignmentHasShipmentOption(AbstractConsignment $consignment, s /** * Business logic determining what shipment options to show, if any. */ + if (AbstractConsignment::SHIPMENT_OPTION_RECEIPT_CODE === $shipmentOption + && AbstractConsignment::DELIVERY_TYPE_STANDARD !== $consignment->getDeliveryType() + ) { + return false; // receipt code is only available for standard delivery + } + if (AbstractConsignment::CC_NL === $consignment->getCountry()) { return $consignment->canHaveShipmentOption($shipmentOption); } - // For PostNL in Belgium - only recipient-only/signature is available + // For PostNL in Belgium - recipient-only, signature and receipt code are available if (AbstractConsignment::CC_BE === $consignment->getCountry() && CarrierPostNL::NAME === $consignment->getCarrierName()) { return in_array($shipmentOption, [ AbstractConsignment::SHIPMENT_OPTION_ONLY_RECIPIENT, - AbstractConsignment::SHIPMENT_OPTION_SIGNATURE], true); + AbstractConsignment::SHIPMENT_OPTION_SIGNATURE, + AbstractConsignment::SHIPMENT_OPTION_RECEIPT_CODE, + ], true); } // No shipment options available in any other case diff --git a/view/adminhtml/templates/new_shipment.phtml b/view/adminhtml/templates/new_shipment.phtml index cc57d83f..a135405b 100755 --- a/view/adminhtml/templates/new_shipment.phtml +++ b/view/adminhtml/templates/new_shipment.phtml @@ -147,8 +147,6 @@ foreach ($form->getCarrierSpecificAbstractConsignments() as $abstractConsignment foreach ($abstractConsignment->getAllowedShipmentOptions() as $shipmentOption) { if (AbstractConsignment::SHIPMENT_OPTION_INSURANCE === $shipmentOption || ! $block->consignmentHasShipmentOption($abstractConsignment, $shipmentOption) - || ($shipmentOption === AbstractConsignment::SHIPMENT_OPTION_RECEIPT_CODE - && AbstractConsignment::DELIVERY_TYPE_STANDARD !== $block->getDeliveryType()) ) { continue; }