Skip to content

Commit

Permalink
fix: implement regression feedback (#806)
Browse files Browse the repository at this point in the history
* fix: honor age check export setting

* fix: prevent javascript error from blocking delivery options

* fix: translate delivery methods properly

* fix(orderbeheer): export chosen carrier
  • Loading branch information
joerivanveen committed Jan 5, 2024
1 parent e64a687 commit 0b3b1f0
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 21 deletions.
6 changes: 3 additions & 3 deletions Helper/ShipmentOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public function hasAgeCheck(): bool
$ageCheckOfProduct = self::getAgeCheckFromProduct($this->order->getItems());
$ageCheckFromSettings = self::$defaultOptions->hasDefaultOptionsWithoutPrice($this->carrier, self::AGE_CHECK);

return $ageCheckFromOptions ?: $ageCheckOfProduct ?? $ageCheckFromSettings;
return $ageCheckFromOptions ?? $ageCheckOfProduct ?? $ageCheckFromSettings;
}

public function hasHideSender(): bool
Expand All @@ -169,9 +169,9 @@ public static function getAgeCheckFromProduct($products): ?bool
'age_check'
);

if (! isset($productAgeCheck)) {
if (! isset($productAgeCheck) || '' === $productAgeCheck) {
$hasAgeCheck = null;
} elseif ($productAgeCheck) {
} elseif ('1' === $productAgeCheck) {
return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Model/Sales/MagentoOrderCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public function setFulfilment(): self
$defaultOptions = new DefaultOptions($magentoOrder, $this->helper);
$myparcelDeliveryOptions = $magentoOrder['myparcel_delivery_options'] ?? '';
$deliveryOptions = json_decode($myparcelDeliveryOptions, true);
$selectedCarrier = $this->options['carrier'] ?? CarrierPostNL::NAME;
$selectedCarrier = $deliveryOptions['carrier'] ?? $this->options['carrier'] ?? CarrierPostNL::NAME;
$shipmentOptionsHelper = new ShipmentOptions(
$defaultOptions,
$this->helper,
Expand Down
1 change: 1 addition & 0 deletions i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ myparcelnl_magento_dhlforyou_settings/delivery, DHL For You delivery
myparcelnl_magento_dhlforyou_settings/delivery/signature, DHL For You delivery with signature
myparcelnl_magento_dhlforyou_settings/delivery/only_recipient, DHL For You delivery with only recipient
myparcelnl_magento_dhlforyou_settings/delivery/only_recipient/signature, DHL For You delivery with only recipient and signature
myparcelnl_magento_dhlforyou_settings/pickup, DHL For You pickup location
myparcelnl_magento_dhleuroplus_settings/delivery, DHL Europlus delivery
myparcelnl_magento_dhlparcelconnect_settings/delivery, DHL Parcel Connect delivery
myparcelnl_magento_ups_settings/delivery, UPS delivery
Expand Down
28 changes: 28 additions & 0 deletions i18n/fr_FR.csv
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,34 @@ status_38,Inactif - Envoi retiré au point de collecte
status_39,Inactif - Envoi retour livré
status_40,Inactif - Envoi retour au point de collecte
status_99,Inactif - Statut inconnu
myparcelnl_magento_postnl_settings/delivery_title, Livraison PostNL
myparcelnl_magento_postnl_settings/pickup_title, Collecte PostNL
myparcelnl_magento_postnl_settings/delivery/signature_title, Livraison avec signature PostNL
myparcelnl_magento_dpd_settings/delivery_title, Livraison DPD
myparcelnl_magento_dpd_settings/pickup_title, Collecte DPD
myparcelnl_magento_postnl_settings/pickup, Collecte PostNL
myparcelnl_magento_postnl_settings/delivery, Livraison PostNL
myparcelnl_magento_postnl_settings/delivery/signature, Livraison avec signature PostNL
myparcelnl_magento_postnl_settings/delivery/only_recipient, Livraison uniquement au destinataire PostNL
myparcelnl_magento_postnl_settings/delivery/only_recipient/signature, Livraison uniquement au destinataire avec signature PostNL
myparcelnl_magento_postnl_settings/morning, Livraison le matin PostNL
myparcelnl_magento_postnl_settings/morning/only_recipient, Livraison le matin uniquement au destinataire PostNL
myparcelnl_magento_postnl_settings/morning/only_recipient/signature, Livraison le matin uniquement au destinataire avec signature PostNL
myparcelnl_magento_postnl_settings/evening, Livraison le soir PostNL
myparcelnl_magento_postnl_settings/evening/only_recipient, Livraison le soir uniquement au destinataire PostNL
myparcelnl_magento_postnl_settings/evening/only_recipient/signature, Livraison le soir uniquement au destinataire avec signature PostNL
myparcelnl_magento_postnl_settings/mailbox, Boîte aux lettres PostNL
myparcelnl_magento_postnl_settings/digital_stamp, Timbre numérique PostNL
myparcelnl_magento_dhlforyou_settings/delivery, Livraison DHL For You
myparcelnl_magento_dhlforyou_settings/delivery/signature, Livraison avec signature DHL For You
myparcelnl_magento_dhlforyou_settings/delivery/only_recipient, Livraison uniquement au destinataire DHL For You
myparcelnl_magento_dhlforyou_settings/delivery/only_recipient/signature, Livraison uniquement au destinataire avec signature DHL For You
myparcelnl_magento_dhlforyou_settings/pickup, Collecte DHL For You
myparcelnl_magento_dhleuroplus_settings/delivery, Livraison DHL Europlus
myparcelnl_magento_dhlparcelconnect_settings/delivery, Livraison DHL Parcel Connect
myparcelnl_magento_dhleuroplus_settings/delivery, Livraison DHL Europlus
myparcelnl_magento_ups_settings/delivery, Livraison UPS
myparcelnl_magento_dpd_settings/delivery, Livraison DPD
myparcelnl_magento_error_no_shipments_to_process, Non-pas d' envois MyParcel à traiter.
Version and support,Version et support
General settings,Paramètres généraux
Expand Down
33 changes: 18 additions & 15 deletions i18n/nl_NL.csv
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,30 @@ myparcelnl_magento_postnl_settings/pickup_title, postnl ophaallocatie
myparcelnl_magento_postnl_settings/delivery/signature_title, postnl bezorging met handtekening
myparcelnl_magento_dpd_settings/delivery_title, DPD bezorging
myparcelnl_magento_dpd_settings/pickup_title, DPD ophaallocatie
myparcelnl_magento_postnl_settings/pickup, PostNL ophaallocatie
myparcelnl_magento_postnl_settings/delivery, PostNL bezorging
myparcelnl_magento_postnl_settings/delivery/signature, PostNL bezorging met handtekening voor ontvangst
myparcelnl_magento_postnl_settings/delivery/only_recipient, PostNL bezorging met alleen huisadres
myparcelnl_magento_postnl_settings/delivery/only_recipient/signature, PostNL bezorging met alleen huisadres en handtekening
myparcelnl_magento_postnl_settings/morning, PostNL ochtend levering
myparcelnl_magento_postnl_settings/morning/only_recipient, PostNL ochtend levering met alleen huisadres
myparcelnl_magento_postnl_settings/morning/only_recipient/signature, PostNL ochtend levering met alleen huisadres en handtekening
myparcelnl_magento_postnl_settings/evening, PostNL avond levering
myparcelnl_magento_postnl_settings/evening/only_recipient, PostNL avond levering met alleen huisadres
myparcelnl_magento_postnl_settings/evening/only_recipient/signature, PostNL avond levering met alleen huisadres en handtekening
myparcelnl_magento_postnl_settings/mailbox, PostNL brievenbuspakje
myparcelnl_magento_postnl_settings/digital_stamp, PostNL digitale postzegel
myparcelnl_magento_dhlforyou_settings/delivery, DHL For You bezorging
myparcelnl_magento_dhlforyou_settings/delivery/signature, DHL For You bezorging met handtekening
myparcelnl_magento_dhlforyou_settings/delivery/only_recipient, DHL For You bezorging met alleen ontvanger
myparcelnl_magento_dhlforyou_settings/delivery/only_recipient/signature, DHL For You bezorging met alleen ontvanger en handtekening
myparcelnl_magento_dhlforyou_settings/pickup, DHL For You afhaallocatie
myparcelnl_magento_dhleuroplus_settings/delivery, DHL Europlus bezorging
myparcelnl_magento_dhlparcelconnect_settings/delivery, DHL Parcel Connect bezorging
myparcelnl_magento_dhleuroplus_settings/delivery, DHL Europlus bezorging
myparcelnl_magento_dhlparcelconnect_settings/delivery, DHL Parcel Connect bezorging
myparcelnl_magento_ups_settings.delivery, UPS bezorging
myparcenl_magento_dpd_settings/delivery, DPD bezorging
myparcelnl_magento_ups_settings/delivery, UPS bezorging
myparcelnl_magento_dpd_settings/delivery, DPD bezorging
myparcelnl_magento_error_no_shipments_to_process, Geen MyParcel zendingen om te verwerken.
Version and support,Versie en support
General settings,Algemene instellingen
Expand Down Expand Up @@ -234,19 +250,6 @@ Friday,vrijdag
Saturday,zaterdag
Sunday,zondag
Enable create label concept, when invoice is printed., Maak concept labels aan, wanneer je een factuur afdrukt.
myparcelnl_magento_postnl_settings/pickup, PostNL ophaallocatie
myparcelnl_magento_postnl_settings/delivery, PostNL bezorging
myparcelnl_magento_postnl_settings/delivery/signature, PostNL bezorging met handtekening voor ontvangst
myparcelnl_magento_postnl_settings/delivery/only_recipient, PostNL bezorging met alleen huisadres
myparcelnl_magento_postnl_settings/delivery/only_recipient/signature, PostNL bezorging met alleen huisadres en handtekening
myparcelnl_magento_postnl_settings/morning, PostNL ochtend levering
myparcelnl_magento_postnl_settings/morning/only_recipient, PostNL ochtend levering met alleen huisadres
myparcelnl_magento_postnl_settings/morning/only_recipient/signature, PostNL ochtend levering met alleen huisadres en handtekening
myparcelnl_magento_postnl_settings/evening, PostNL avond levering
myparcelnl_magento_postnl_settings/evening/only_recipient, PostNL avond levering met alleen huisadres
myparcelnl_magento_postnl_settings/evening/only_recipient/signature, PostNL avond levering met alleen huisadres en handtekening
myparcelnl_magento_postnl_settings/mailbox, PostNL brievenbuspakje
myparcelnl_magento_postnl_settings/digital_stamp, PostNL digitale postzegel
Mailbox,Brievenbuspakje
Digital stamp,Digitale postzegel
Print return label directly,Print het retour label direct
Expand Down
6 changes: 4 additions & 2 deletions view/frontend/web/js/model/checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,14 @@ function(
Model.rates().forEach(function(rate) {
const hasDeliveryOptions = Model.hasDeliveryOptions();
const myParcelMethods = hasDeliveryOptions ? Model.configuration().methods || [] : [];
const row = document.getElementById('label_method_' + rate.method_code + '_' + rate.carrier_code).parentElement || null;
const cell = document.getElementById('label_method_' + rate.method_code + '_' + rate.carrier_code) || null;

if (!rate.available || !row) {
if (!rate.available || !cell) {
return;
}

const row = cell.parentElement;

/**
* Hide MyParcel-specific methods, and the parent methods delivery options are bound to
*/
Expand Down

0 comments on commit 0b3b1f0

Please sign in to comment.