ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] Codeunit 1607 - OnBeforeIsValidCheckDigit

Open StephenNorfolk-DC opened this issue 5 years ago • 1 comments

New event for Codeunit 1607 GLN Calculator, at the beginning of the function IsValidCheckDigit:

local procedure IsValidCheckDigit(GLNValue: Code[20]; ExpectedSize: Integer): Boolean
var
        IsHandled:Boolean;  // New Variable
begin
        // New Event
        OnBeforeIsValidCheckDigit(GLNValue,ExpectedSize,Var IsValid:boolean, Var Ishandled: boolean);
        if IsHandled then 
                exit(IsValid);
        // New Event

	if GLNValue = '' then
		exit(false);

	if StrLen(GLNValue) <> ExpectedSize then
		Error(GLNLengthErr, ExpectedSize, StrLen(GLNValue));

	exit(Format(StrCheckSum(CopyStr(GLNValue, 1, ExpectedSize - 1), '131313131313')) = Format(GLNValue[ExpectedSize]));
end;

Alternatively, expose this function and add a Checksum parameter, in case we need to call this with a different ExpectedSize or in case '131313131313' is not a suitable checksum value. Or add an "AssertValidCheckDigit" function that has these parameters.

StephenNorfolk-DC avatar Dec 02 '20 10:12 StephenNorfolk-DC

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. We will update this issue with information about availability. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.

JesperSchulz avatar Dec 08 '20 11:12 JesperSchulz