-
Notifications
You must be signed in to change notification settings - Fork 694
Open
Labels
missing-infoThe issue misses information that prevents it from completion.The issue misses information that prevents it from completion.
Description
Why do you need this change?
We need extend condition by Customer.Count, similar condition is in standard bellow this part of code.
if Customer.FindFirst() then
if Customer.Count() = 1 then
exit(Customer."No.");
Describe the request
procedure GetCustNoOpenCard(CustomerText: Text; ShowCustomerCard: Boolean; ShowCreateCustomerOption: Boolean): Code[20]
var
Customer: Record Customer;
IsHandled: Boolean;
NoFiltersApplied: Boolean;
CustomerNo: Code[20];
CustomerFilterContains: Text;
CustomerFilterFromStart: Text;
CustomerWithoutQuote: Text;
begin
IsHandled := false;
OnBeforeGetCustNoOpenCard(CustomerText, ShowCustomerCard, ShowCreateCustomerOption, CustomerNo, IsHandled);
if IsHandled then
exit(CustomerNo);
if CustomerText = '' then
exit('');
if StrLen(CustomerText) <= MaxStrLen(Customer."No.") then
if Customer.Get(CopyStr(CustomerText, 1, MaxStrLen(Customer."No."))) then
exit(Customer."No.");
OnGetCustNoOpenCardOnBeforeFilterCustomer(Customer);
Customer.SetRange(Blocked, Customer.Blocked::" ");
Customer.SetRange(Name, CustomerText);
//-------------------------------------------------OnGetCustNoOpenCardOnBeforeCustomerFindFirst:BEGIN
IsHandled := false;
OnGetCustNoOpenCardOnBeforeCustomerFindFirst(Customer, IsHandled);
if not IsHandled then
if Customer.FindFirst() then
exit(Customer."No.");
//-------------------------------------------------OnGetCustNoOpenCardOnBeforeCustomerFindFirst:END
Customer.SetCurrentKey(Name);
CustomerWithoutQuote := ConvertStr(CustomerText, '''', '?');
Customer.SetFilter(Name, '''@' + CustomerWithoutQuote + '''');
OnGetCustNoOpenCardOnBeforeCustomerFindSet(Customer);
if Customer.FindFirst() then
exit(Customer."No.");
Customer.SetRange(Name);
CustomerFilterFromStart := '''@' + CustomerWithoutQuote + '*''';
Customer.FilterGroup := -1;
Customer.SetFilter("No.", CustomerFilterFromStart);
Customer.SetFilter(Name, CustomerFilterFromStart);
OnGetCustNoOpenCardOnAfterOnAfterCustomerFilterFromStart(Customer);
if Customer.FindFirst() then
if Customer.Count() = 1 then
exit(Customer."No.");
CustomerFilterContains := '''@*' + CustomerWithoutQuote + '*''';
Customer.SetFilter("No.", CustomerFilterContains);
Customer.SetFilter(Name, CustomerFilterContains);
Customer.SetFilter(City, CustomerFilterContains);
Customer.SetFilter(Contact, CustomerFilterContains);
Customer.SetFilter("Phone No.", CustomerFilterContains);
Customer.SetFilter("Post Code", CustomerFilterContains);
OnGetCustNoOpenCardOnAfterSetCustomerFilters(Customer, CustomerFilterContains);
if Customer.Count() = 0 then
MarkCustomersWithSimilarName(Customer, CustomerText);
if Customer.Count() = 1 then begin
Customer.FindFirst();
exit(Customer."No.");
end;
if not GuiAllowed() then
Error(SelectCustErr);
OnGetCustNoOpenCardOnAfterMarkCustomersWithSimilarName(Customer);
if Customer.Count = 0 then begin
if Customer.WritePermission then
if ShowCreateCustomerOption then
case StrMenu(
StrSubstNo(
'%1,%2', StrSubstNo(CreateNewCustTxt, ConvertStr(CustomerText, ',', '.')), SelectCustTxt), 1, CustNotRegisteredTxt) of
0:
Error(SelectCustErr);
1:
exit(CreateNewCustomer(CopyStr(CustomerText, 1, MaxStrLen(Customer.Name)), ShowCustomerCard));
end
else
exit('');
Customer.Reset();
NoFiltersApplied := true;
end;
if ShowCustomerCard then
CustomerNo := PickCustomer(Customer, NoFiltersApplied)
else begin
LookupRequested := true;
exit('');
end;
if CustomerNo <> '' then
exit(CustomerNo);
Error(SelectCustErr);
end;
//-------------------------------------------------OnGetCustNoOpenCardOnBeforeCustomerFindFirst:BEGIN
[IntegrationEvent(false, false)]
local procedure OnGetCustNoOpenCardOnBeforeCustomerFindFirst(var Customer: Record Customer; var IsHandled: Boolean)
begin
end;
//-------------------------------------------------OnGetCustNoOpenCardOnBeforeCustomerFindFirst:END
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
missing-infoThe issue misses information that prevents it from completion.The issue misses information that prevents it from completion.