Skip to content

Commit 6efdab6

Browse files
authored
[Shopify] Do not create Shopify Customer for the company if it exists (#5769)
<!-- Thank you for submitting a Pull Request. If you're new to contributing to BCApps please read our pull request guideline below * https://github.com/microsoft/BCApps/Contributing.md --> #### Summary <!-- Provide a general summary of your changes --> Do not create Shopify Customer for the company if it exists Also removed an internal ishandled event :) #### Work Item(s) <!-- Add the issue number here after the #. The issue needs to be open and approved. Submitting PRs with no linked issues or unapproved issues is highly discouraged. --> Fixes [AB#615837](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/615837) Fixes [AB#615851](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/615851)
1 parent 4662fe9 commit 6efdab6

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

src/Apps/W1/Shopify/App/src/Customers/Codeunits/ShpfyCreateCustomer.Codeunit.al

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,11 @@ codeunit 30110 "Shpfy Create Customer"
172172

173173
Customer.Modify();
174174

175-
ShopifyCustomer.Copy(TempShopifyCustomer);
176-
ShopifyCustomer."Customer SystemId" := Customer.SystemId;
177-
ShopifyCustomer.Insert();
175+
if not ShopifyCustomer.Get(TempShopifyCustomer.Id) then begin
176+
ShopifyCustomer.Copy(TempShopifyCustomer);
177+
ShopifyCustomer."Customer SystemId" := Customer.SystemId;
178+
ShopifyCustomer.Insert();
179+
end;
178180

179181
ShopifyCompany."Customer SystemId" := Customer.SystemId;
180182
ShopifyCompany."Main Contact Customer Id" := ShopifyCustomer.Id;

src/Apps/W1/Shopify/App/src/Order handling/Codeunits/ShpfyImportOrder.Codeunit.al

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -639,11 +639,8 @@ codeunit 30161 "Shpfy Import Order"
639639
Currency: Record Currency;
640640
GeneralLedgerSetup: Record "General Ledger Setup";
641641
CurrencyCode: Code[10];
642-
IsHandled: Boolean;
643642
begin
644-
OrderEvents.OnBeforeTranslateCurrencyCode(ShopifyCurrencyCode, CurrencyCode, IsHandled);
645-
if not IsHandled then
646-
Currency.SetLoadFields(Code);
643+
Currency.SetLoadFields(Code);
647644
Currency.SetRange("ISO Code", CopyStr(ShopifyCurrencyCode, 1, 3));
648645
if Currency.FindFirst() then
649646
CurrencyCode := Currency.Code;

src/Apps/W1/Shopify/App/src/Order handling/Codeunits/ShpfyOrderEvents.Codeunit.al

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,6 @@ codeunit 30162 "Shpfy Order Events"
204204
begin
205205
end;
206206

207-
[InternalEvent(false)]
208-
internal procedure OnBeforeTranslateCurrencyCode(ShopifyCurrencyCode: Text; var CurrencyCode: Code[10]; var IsHandled: Boolean)
209-
begin
210-
end;
211-
212207
[InternalEvent(false)]
213208
internal procedure OnBeforeConvertToFinancialStatus(Value: Text; var ShpfyFinancialStatus: Enum "Shpfy Financial Status"; var IsHandled: Boolean)
214209
begin

0 commit comments

Comments
 (0)