Skip to content

Commit 8a219ad

Browse files
authored
feat: add receipt code for belgium (#875)
1 parent b223ac7 commit 8a219ad

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

Helper/Data.php

+10-2
Original file line numberDiff line numberDiff line change
@@ -259,15 +259,23 @@ public function consignmentHasShipmentOption(AbstractConsignment $consignment, s
259259
/**
260260
* Business logic determining what shipment options to show, if any.
261261
*/
262+
if (AbstractConsignment::SHIPMENT_OPTION_RECEIPT_CODE === $shipmentOption
263+
&& AbstractConsignment::DELIVERY_TYPE_STANDARD !== $consignment->getDeliveryType()
264+
) {
265+
return false; // receipt code is only available for standard delivery
266+
}
267+
262268
if (AbstractConsignment::CC_NL === $consignment->getCountry()) {
263269
return $consignment->canHaveShipmentOption($shipmentOption);
264270
}
265271

266-
// For PostNL in Belgium - only recipient-only/signature is available
272+
// For PostNL in Belgium - recipient-only, signature and receipt code are available
267273
if (AbstractConsignment::CC_BE === $consignment->getCountry() && CarrierPostNL::NAME === $consignment->getCarrierName()) {
268274
return in_array($shipmentOption, [
269275
AbstractConsignment::SHIPMENT_OPTION_ONLY_RECIPIENT,
270-
AbstractConsignment::SHIPMENT_OPTION_SIGNATURE], true);
276+
AbstractConsignment::SHIPMENT_OPTION_SIGNATURE,
277+
AbstractConsignment::SHIPMENT_OPTION_RECEIPT_CODE,
278+
], true);
271279
}
272280

273281
// UPS shipment options are available for all countries in the EU

view/adminhtml/templates/new_shipment.phtml

-2
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ foreach ($form->getCarrierSpecificAbstractConsignments() as $abstractConsignment
147147
foreach ($abstractConsignment->getAllowedShipmentOptions() as $shipmentOption) {
148148
if (AbstractConsignment::SHIPMENT_OPTION_INSURANCE === $shipmentOption
149149
|| ! $block->consignmentHasShipmentOption($abstractConsignment, $shipmentOption)
150-
|| ($shipmentOption === AbstractConsignment::SHIPMENT_OPTION_RECEIPT_CODE
151-
&& AbstractConsignment::DELIVERY_TYPE_STANDARD !== $block->getDeliveryType())
152150
) {
153151
continue;
154152
}

0 commit comments

Comments
 (0)