From baa858501b30c52292821b019641e6a5ac0a6700 Mon Sep 17 00:00:00 2001 From: Joeri van Veen Date: Thu, 14 Nov 2024 14:42:52 +0100 Subject: [PATCH 1/2] feat: add receipt code for belgium --- 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..79e1ee66 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 recieipt 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; } From 3700579d6ea9a9d4de6f716323f07d4b5047da08 Mon Sep 17 00:00:00 2001 From: Joeri van Veen Date: Thu, 14 Nov 2024 17:37:22 +0100 Subject: [PATCH 2/2] chore: fix spelling error in comment --- Helper/Data.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Helper/Data.php b/Helper/Data.php index 79e1ee66..132f5502 100755 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -268,7 +268,7 @@ public function consignmentHasShipmentOption(AbstractConsignment $consignment, s return $consignment->canHaveShipmentOption($shipmentOption); } - // For PostNL in Belgium - recipient-only, signature and recieipt code are 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,