Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Apps/GB/IdealPostcodes/app/src/IPCConfig.Page.al
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ page 9400 "IPC Config"
HyperLink(APIKeyUrlTok);
end;
}
field("Remove Organisation Name"; Rec."Remove Organisation Name")
{
ApplicationArea = All;
ToolTip = 'When enabled, the organisation name is removed from the first address line.';
}
}
}
}
Expand Down Expand Up @@ -161,4 +166,4 @@ page 9400 "IPC Config"
end else
TermsAndCondsRead := Rec."Enabled";
end;
}
}
7 changes: 6 additions & 1 deletion Apps/GB/IdealPostcodes/app/src/IPCConfig.Table.al
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ table 9402 "IPC Config"
Caption = 'Enabled';
DataClassification = CustomerContent;
}
field(5; "Remove Organisation Name"; Boolean)
{
Caption = 'Remove the organisation name from address';
DataClassification = CustomerContent;
}
}

keys
Expand Down Expand Up @@ -76,4 +81,4 @@ table 9402 "IPC Config"
begin
exit(EndpointBaseUrlTxt);
end;
}
}
18 changes: 15 additions & 3 deletions Apps/GB/IdealPostcodes/app/src/IPCManagement.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,24 @@ codeunit 9400 "IPC Management"
end;

local procedure AddAddressToBuffer(AddressJson: JsonObject; var TempIPCAddressLookup: Record "IPC Address Lookup" temporary; EntryNo: Integer)
var
Config: Record "IPC Config";
Line1, Line2 : Text;
begin
Line1 := GetJsonValue(AddressJson, 'line_1');
Line2 := GetJsonValue(AddressJson, 'line_2');

if GetConfiguration(Config) and Config."Remove Organisation Name" then
if (Line1 <> '') and (Line1 = GetJsonValue(AddressJson, 'organisation_name')) then begin
Line1 := Line2;
Line2 := '';
end;

TempIPCAddressLookup.Init();
TempIPCAddressLookup."Entry No." := EntryNo;
TempIPCAddressLookup."Address ID" := CopyStr(GetJsonValue(AddressJson, 'id'), 1, MaxStrLen(TempIPCAddressLookup."Address ID"));
TempIPCAddressLookup.Address := CopyStr(GetJsonValue(AddressJson, 'line_1'), 1, MaxStrLen(TempIPCAddressLookup.Address));
TempIPCAddressLookup."Address 2" := CopyStr(GetJsonValue(AddressJson, 'line_2'), 1, MaxStrLen(TempIPCAddressLookup."Address 2"));
TempIPCAddressLookup.Address := CopyStr(Line1, 1, MaxStrLen(TempIPCAddressLookup.Address));
TempIPCAddressLookup."Address 2" := CopyStr(Line2, 1, MaxStrLen(TempIPCAddressLookup."Address 2"));
TempIPCAddressLookup.City := CopyStr(GetJsonValue(AddressJson, 'post_town'), 1, MaxStrLen(TempIPCAddressLookup.City));
TempIPCAddressLookup."Post Code" := CopyStr(GetJsonValue(AddressJson, 'postcode'), 1, MaxStrLen(TempIPCAddressLookup."Post Code"));
TempIPCAddressLookup.County := CopyStr(GetJsonValue(AddressJson, 'county'), 1, MaxStrLen(TempIPCAddressLookup.County));
Expand Down Expand Up @@ -237,4 +249,4 @@ codeunit 9400 "IPC Management"

exit(Config.Enabled and not IsNullGuid(Config."API Key"));
end;
}
}
Loading