From 2e0e23071d93ba78f498fcf0f605a32978c69d61 Mon Sep 17 00:00:00 2001 From: Vincent 't Hart Date: Wed, 11 Aug 2021 14:26:52 +0200 Subject: [PATCH 1/6] POSTCODENL-284: added extra check proposed in SD-24264 --- view/frontend/web/js/view/form/fields.js | 40 +++++++++++------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/view/frontend/web/js/view/form/fields.js b/view/frontend/web/js/view/form/fields.js index 5e77674..5073de7 100644 --- a/view/frontend/web/js/view/form/fields.js +++ b/view/frontend/web/js/view/form/fields.js @@ -97,33 +97,31 @@ define([ if (typeof options.data === "string") { var data = $.parseJSON(options.data); - // Handle Magento inconsistencies - var customAttributes = 'custom_attributes'; + if (data != null) { - if (!_.isUndefined(data.address) && !_.isUndefined(data.address[customAttributes])) { - data.address = this.addToAddress(data.address, customAttributes); - } + // Handle Magento inconsistencies + var customAttributes = 'custom_attributes'; - customAttributes = 'customAttributes'; + if (!_.isUndefined(data.address) && !_.isUndefined(data.address[customAttributes])) { + data.address = this.addToAddress(data.address, customAttributes); + } - if (!_.isUndefined(data.addressInformation) && data.addressInformation && - !_.isUndefined(data.addressInformation.shipping_address) && - !_.isUndefined(data.addressInformation.shipping_address[customAttributes])) { - data.addressInformation.shipping_address = this.addToAddress(data.addressInformation.shipping_address, customAttributes); - } + customAttributes = 'customAttributes'; - if (!_.isUndefined(data.addressInformation) && data.addressInformation && - !_.isUndefined(data.addressInformation.billing_address) && - !_.isUndefined(data.addressInformation.billing_address[customAttributes])) { - data.addressInformation.billing_address = this.addToAddress(data.addressInformation.billing_address, customAttributes); - } + if (!_.isUndefined(data.addressInformation) && data.addressInformation && !_.isUndefined(data.addressInformation.shipping_address) && !_.isUndefined(data.addressInformation.shipping_address[customAttributes])) { + data.addressInformation.shipping_address = this.addToAddress(data.addressInformation.shipping_address, customAttributes); + } - if (!_.isUndefined(data.billingAddress) && data.billingAddress && - !_.isUndefined(data.billingAddress[customAttributes])) { - data.billingAddress = this.addToAddress(data.billingAddress, customAttributes); - } + if (!_.isUndefined(data.addressInformation) && data.addressInformation && !_.isUndefined(data.addressInformation.billing_address) && !_.isUndefined(data.addressInformation.billing_address[customAttributes])) { + data.addressInformation.billing_address = this.addToAddress(data.addressInformation.billing_address, customAttributes); + } + + if (!_.isUndefined(data.billingAddress) && data.billingAddress && !_.isUndefined(data.billingAddress[customAttributes])) { + data.billingAddress = this.addToAddress(data.billingAddress, customAttributes); + } - return JSON.stringify(data); + return JSON.stringify(data); + } } }, From c2f635400bc413d9c9549fdb7e5ebcab8264c690 Mon Sep 17 00:00:00 2001 From: Mickey Beijer Date: Wed, 11 Aug 2021 18:04:04 +0200 Subject: [PATCH 2/6] POSTNLM2-1179 : improved check on custom attributes to avoid errors in onestepcheckout --- view/frontend/web/js/view/billing-address-mixin.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/view/frontend/web/js/view/billing-address-mixin.js b/view/frontend/web/js/view/billing-address-mixin.js index 037e83a..7b92a16 100644 --- a/view/frontend/web/js/view/billing-address-mixin.js +++ b/view/frontend/web/js/view/billing-address-mixin.js @@ -40,12 +40,12 @@ define([ return function (Component) { return Component.extend({ tigHouseNumber: function () { - if (quote.billingAddress().customAttributes.length > 0) { + var customAttributes = quote.billingAddress().customAttributes; + + if (customAttributes && customAttributes.length > 0) { var houseNumber = ""; var houseNumberAddition = ""; - var customAttributes = quote.billingAddress().customAttributes; - // check if custom attribute exists and is not empty customAttributes.forEach(function (attribute) { if (attribute.attribute_code === "tig_housenumber" && attribute.value !== "") { From 8407d82f6035d4ebb04f86bd2848dec957929313 Mon Sep 17 00:00:00 2001 From: Lucas Hoeffnagel Date: Wed, 1 Sep 2021 12:37:15 +0200 Subject: [PATCH 3/6] POSTCODENL-323 - added if statement to avoid errors when street field is empty --- view/frontend/web/template/billing-address/details.html | 2 +- .../web/template/shipping-address/address-renderer/default.html | 2 +- .../template/shipping-information/address-renderer/default.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/view/frontend/web/template/billing-address/details.html b/view/frontend/web/template/billing-address/details.html index 6440e0b..9df1791 100644 --- a/view/frontend/web/template/billing-address/details.html +++ b/view/frontend/web/template/billing-address/details.html @@ -7,7 +7,7 @@

- +
,

diff --git a/view/frontend/web/template/shipping-address/address-renderer/default.html b/view/frontend/web/template/shipping-address/address-renderer/default.html index 5549e2d..ad0e98b 100644 --- a/view/frontend/web/template/shipping-address/address-renderer/default.html +++ b/view/frontend/web/template/shipping-address/address-renderer/default.html @@ -7,7 +7,7 @@

- +
diff --git a/view/frontend/web/template/shipping-information/address-renderer/default.html b/view/frontend/web/template/shipping-information/address-renderer/default.html index d23c95a..08b00e1 100644 --- a/view/frontend/web/template/shipping-information/address-renderer/default.html +++ b/view/frontend/web/template/shipping-information/address-renderer/default.html @@ -7,7 +7,7 @@
- + From 89231ee2d62cefd777b2de94344c5c604cb14ff7 Mon Sep 17 00:00:00 2001 From: Lucas Hoeffnagel Date: Fri, 15 Oct 2021 10:00:09 +0200 Subject: [PATCH 4/6] POSTCODENL-284 - codesniffer fix --- view/frontend/web/js/view/form/fields.js | 1 - 1 file changed, 1 deletion(-) diff --git a/view/frontend/web/js/view/form/fields.js b/view/frontend/web/js/view/form/fields.js index 5073de7..5d68bd4 100644 --- a/view/frontend/web/js/view/form/fields.js +++ b/view/frontend/web/js/view/form/fields.js @@ -98,7 +98,6 @@ define([ var data = $.parseJSON(options.data); if (data != null) { - // Handle Magento inconsistencies var customAttributes = 'custom_attributes'; From 2359529a1a8cdd2a0d1b9845dd35f260c3bc5565 Mon Sep 17 00:00:00 2001 From: Lucas Hoeffnagel Date: Tue, 2 Nov 2021 15:00:42 +0100 Subject: [PATCH 5/6] POSTCODENL-330 - fixed if-statement --- .../web/template/shipping-address/address-renderer/default.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/frontend/web/template/shipping-address/address-renderer/default.html b/view/frontend/web/template/shipping-address/address-renderer/default.html index ad0e98b..63cae04 100644 --- a/view/frontend/web/template/shipping-address/address-renderer/default.html +++ b/view/frontend/web/template/shipping-address/address-renderer/default.html @@ -24,7 +24,7 @@
-