Skip to content

Commit

Permalink
Revert "[Shopify] Log Skipped Records on export processes (#27539)"
Browse files Browse the repository at this point in the history
This reverts commit c8b01d7.
  • Loading branch information
aholstrup1 committed Oct 31, 2024
1 parent 549e175 commit 6ec3fd0
Show file tree
Hide file tree
Showing 17 changed files with 104 additions and 1,436 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ codeunit 30273 "Shpfy Installer"
var
LogEntry: Record "Shpfy Log Entry";
DataCapture: Record "Shpfy Data Capture";
SkippedRecord: Record "Shpfy Skipped Record";
RetentionPolicySetup: Codeunit "Retention Policy Setup";
RetenPolAllowedTables: Codeunit "Reten. Pol. Allowed Tables";
UpgradeTag: Codeunit "Upgrade Tag";
Expand All @@ -39,14 +38,12 @@ codeunit 30273 "Shpfy Installer"

RetenPolAllowedTables.AddAllowedTable(Database::"Shpfy Log Entry", LogEntry.FieldNo(SystemCreatedAt));
RetenPolAllowedTables.AddAllowedTable(Database::"Shpfy Data Capture", DataCapture.FieldNo(SystemModifiedAt));
RetenPolAllowedTables.AddAllowedTable(Database::"Shpfy Skipped Record", SkippedRecord.FieldNo(SystemCreatedAt));

if not IsInitialSetup then
exit;

CreateRetentionPolicySetup(Database::"Shpfy Log Entry", RetentionPolicySetup.FindOrCreateRetentionPeriod("Retention Period Enum"::"1 Month"));
CreateRetentionPolicySetup(Database::"Shpfy Data Capture", RetentionPolicySetup.FindOrCreateRetentionPeriod("Retention Period Enum"::"1 Month"));
CreateRetentionPolicySetup(Database::"Shpfy Skipped Record", RetentionPolicySetup.FindOrCreateRetentionPeriod("Retention Period Enum"::"1 Month"));
UpgradeTag.SetUpgradeTag(GetShopifyLogEntryAddedToAllowedListUpgradeTag());
end;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ codeunit 30284 "Shpfy Company Export"
Shop: Record "Shpfy Shop";
CompanyAPI: Codeunit "Shpfy Company API";
CatalogAPI: Codeunit "Shpfy Catalog API";
SkippedRecord: Codeunit "Shpfy Skipped Record";
CreateCustomers: Boolean;
CountyCodeTooLongLbl: Label 'Can not export customer %1 %2. The length of the string is %3, but it must be less than or equal to %4 characters. Value: %5, field: %6', Comment = '%1 - Customer No., %2 - Customer Name, %3 - Length, %4 - Max Length, %5 - Value, %6 - Field Name';

Expand All @@ -45,12 +44,9 @@ codeunit 30284 "Shpfy Company Export"
ShopifyCompany: Record "Shpfy Company";
ShopifyCustomer: Record "Shpfy Customer";
CompanyLocation: Record "Shpfy Company Location";
EmptyEmailAddressLbl: Label 'Customer (Company) has no e-mail address.';
begin
if Customer."E-Mail" = '' then begin
SkippedRecord.LogSkippedRecord(Customer.RecordId, EmptyEmailAddressLbl, Shop);
if Customer."E-Mail" = '' then
exit;
end;

if CreateCompanyMainContact(Customer, ShopifyCustomer) then
if FillInShopifyCompany(Customer, ShopifyCompany, CompanyLocation) then
Expand Down Expand Up @@ -184,13 +180,10 @@ codeunit 30284 "Shpfy Company Export"
var
ShopifyCompany: Record "Shpfy Company";
CompanyLocation: Record "Shpfy Company Location";
CompanyWithPhoneNoOrEmailExistsLbl: Label 'Company already exists with the same e-mail or phone.';
begin
ShopifyCompany.Get(CompanyId);
if ShopifyCompany."Customer SystemId" <> Customer.SystemId then begin
SkippedRecord.LogSkippedRecord(ShopifyCompany.Id, Customer.RecordId, CompanyWithPhoneNoOrEmailExistsLbl, Shop);
if ShopifyCompany."Customer SystemId" <> Customer.SystemId then
exit;
end;

CompanyLocation.SetRange("Company SystemId", ShopifyCompany.SystemId);
CompanyLocation.FindFirst();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ codeunit 30116 "Shpfy Customer Export"
var
Shop: Record "Shpfy Shop";
CustomerApi: Codeunit "Shpfy Customer API";
SkippedRecord: Codeunit "Shpfy Skipped Record";
CreateCustomers: Boolean;
CountyCodeTooLongLbl: Label 'Can not export customer %1 %2. The length of the string is %3, but it must be less than or equal to %4 characters. Value: %5, field: %6', Comment = '%1 - Customer No., %2 - Customer Name, %3 - Length, %4 - Max Length, %5 - Value, %6 - Field Name';

Expand Down Expand Up @@ -88,12 +87,9 @@ codeunit 30116 "Shpfy Customer Export"
var
ShopifyCustomer: Record "Shpfy Customer";
CustomerAddress: Record "Shpfy Customer Address";
EmptyEmailAddressLbl: Label 'Customer has no e-mail address.';
begin
if Customer."E-Mail" = '' then begin
SkippedRecord.LogSkippedRecord(Customer.RecordId, EmptyEmailAddressLbl, Shop);
if Customer."E-Mail" = '' then
exit;
end;

Clear(ShopifyCustomer);
Clear(CustomerAddress);
Expand Down Expand Up @@ -300,13 +296,10 @@ codeunit 30116 "Shpfy Customer Export"
var
ShopifyCustomer: Record "Shpfy Customer";
CustomerAddress: Record "Shpfy Customer Address";
CustomerWithPhoneNoOrEmailExistsLbl: Label 'Customer already exists with the same e-mail or phone.';
begin
ShopifyCustomer.Get(CustomerID);
if ShopifyCustomer."Customer SystemId" <> Customer.SystemId then begin
SkippedRecord.LogSkippedRecord(ShopifyCustomer.Id, Customer.RecordId, CustomerWithPhoneNoOrEmailExistsLbl, Shop);
if ShopifyCustomer."Customer SystemId" <> Customer.SystemId then
exit; // An other customer with the same e-mail or phone is the source of it.
end;

CustomerAddress.SetRange("Customer Id", CustomerId);
CustomerAddress.SetRange(Default, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ codeunit 30362 "Shpfy Posted Invoice Export"
DraftOrdersAPI: Codeunit "Shpfy Draft Orders API";
FulfillmentAPI: Codeunit "Shpfy Fulfillment API";
JsonHelper: Codeunit "Shpfy Json Helper";
SkippedRecord: Codeunit "Shpfy Skipped Record";

trigger OnRun()
begin
Expand Down Expand Up @@ -93,34 +92,22 @@ codeunit 30362 "Shpfy Posted Invoice Export"
var
ShopifyCompany: Record "Shpfy Company";
ShopifyCustomer: Record "Shpfy Customer";
CustomerNotExistInShopifyLbl: Label 'Customer does not exists as Shopify company or customer.';
PaymentTermsNotExistLbl: Label 'Payment terms %1 do not exist in Shopify.', Comment = '%1 = Payment Terms Code.';
CustomerNoIsDefaultCustomerNoLbl: Label 'Bill-to customer no. is the default customer no. for Shopify shop.';
CustomerTemplateExistsLbl: Label 'Shopify customer template exists for customer no. %1 shop %2.', Comment = '%1 = Customer No., %2 = Shop Code';
begin
ShopifyCompany.SetRange("Customer No.", SalesInvoiceHeader."Bill-to Customer No.");
if ShopifyCompany.IsEmpty() then begin
ShopifyCustomer.SetRange("Customer No.", SalesInvoiceHeader."Bill-to Customer No.");
if ShopifyCustomer.IsEmpty() then begin
SkippedRecord.LogSkippedRecord(SalesInvoiceHeader.RecordId, CustomerNotExistInShopifyLbl, Shop);
if ShopifyCustomer.IsEmpty() then
exit(false);
end;
end;

if not ShopifyPaymentTermsExists(SalesInvoiceHeader."Payment Terms Code") then begin
SkippedRecord.LogSkippedRecord(SalesInvoiceHeader.RecordId, StrSubstNo(PaymentTermsNotExistLbl, SalesInvoiceHeader."Payment Terms Code"), Shop);
if not ShopifyPaymentTermsExists(SalesInvoiceHeader."Payment Terms Code") then
exit(false);
end;

if Shop."Default Customer No." = SalesInvoiceHeader."Bill-to Customer No." then begin
SkippedRecord.LogSkippedRecord(SalesInvoiceHeader.RecordId, CustomerNoIsDefaultCustomerNoLbl, Shop);
if Shop."Default Customer No." = SalesInvoiceHeader."Bill-to Customer No." then
exit(false);
end;

if CheckCustomerTemplates(SalesInvoiceHeader."Bill-to Customer No.") then begin
SkippedRecord.LogSkippedRecord(SalesInvoiceHeader.RecordId, StrSubstNo(CustomerTemplateExistsLbl, SalesInvoiceHeader."Bill-to Customer No.", Shop.Code), Shop);
if CheckCustomerTemplates(SalesInvoiceHeader."Bill-to Customer No.") then
exit(false);
end;

if not CheckSalesInvoiceHeaderLines(SalesInvoiceHeader) then
exit(false);
Expand Down Expand Up @@ -158,31 +145,21 @@ codeunit 30362 "Shpfy Posted Invoice Export"
local procedure CheckSalesInvoiceHeaderLines(SalesInvoiceHeader: Record "Sales Invoice Header"): Boolean
var
SalesInvoiceLine: Record "Sales Invoice Line";
NoLinesInSalesInvoiceLbl: Label 'No relevant sales invoice lines exist.';
InvalidQuantityLbl: Label 'Invalid quantity in sales invoice line.';
EmptyNoInLineLbl: Label 'No. field is empty in Sales Invoice Line.';
begin
SalesInvoiceLine.SetRange("Document No.", SalesInvoiceHeader."No.");
SalesInvoiceLine.SetFilter(Type, '<>%1', SalesInvoiceLine.Type::" ");
if SalesInvoiceLine.IsEmpty() then begin
SkippedRecord.LogSkippedRecord(SalesInvoiceHeader.RecordId, NoLinesInSalesInvoiceLbl, Shop);
if SalesInvoiceLine.IsEmpty() then
exit(false);
end;

SalesInvoiceLine.Reset();

SalesInvoiceLine.SetRange("Document No.", SalesInvoiceHeader."No.");
if SalesInvoiceLine.FindSet() then
repeat
if (SalesInvoiceLine.Quantity <> 0) and (SalesInvoiceLine.Quantity <> Round(SalesInvoiceLine.Quantity, 1)) then begin
SkippedRecord.LogSkippedRecord(SalesInvoiceLine.RecordId, InvalidQuantityLbl, Shop);
if (SalesInvoiceLine.Quantity <> 0) and (SalesInvoiceLine.Quantity <> Round(SalesInvoiceLine.Quantity, 1)) then
exit(false);
end;

if (SalesInvoiceLine.Type <> SalesInvoiceLine.Type::" ") and (SalesInvoiceLine."No." = '') then begin
SkippedRecord.LogSkippedRecord(SalesInvoiceLine.RecordId, EmptyNoInLineLbl, Shop);
if (SalesInvoiceLine.Type <> SalesInvoiceLine.Type::" ") and (SalesInvoiceLine."No." = '') then
exit(false);
end;
until SalesInvoiceLine.Next() = 0;

exit(true);
Expand Down

This file was deleted.

This file was deleted.

95 changes: 0 additions & 95 deletions Apps/W1/Shopify/app/src/Logs/Pages/ShpfySkippedRecords.Page.al

This file was deleted.

Loading

0 comments on commit 6ec3fd0

Please sign in to comment.