ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

Table ‘Item Journal Line’ functions CheckTrackingIsEmpty, CheckNewTrackingIsEmpty test ItemJnlLine but Events check Rec

Open hhoutaptean opened this issue 5 years ago • 2 comments

We found out that in the scenario of posting an item journal line for a lot tracked item the check on lot no isn't correct. Table ‘Item Journal Line’ functions CheckTrackingIsEmpty, CheckNewTrackingIsEmpty check ItemJnlLine and the Event record is Rec.

We added the code in relation to this bug below, during posting the lot no. check isn't validating correct if there's a value present.

table 83 "Item Journal Line"

procedure CheckTrackingIsEmpty()
begin
    ItemJnlLine.TestField("Serial No.", '');
    ItemJnlLine.TestField("Lot No.", '');

    OnAfterCheckTrackingisEmpty(Rec);
end;

procedure CheckNewTrackingIsEmpty()
begin
    ItemJnlLine.TestField("New Serial No.", '');
    ItemJnlLine.TestField("New Lot No.", '');

    OnAfterCheckNewTrackingisEmpty(Rec);
end;

Both functions above are wrong, because they have an event which is using another record than the record which is checked in the function.

           OnAfterCheckTrackingisEmpty(Rec); should be: OnAfterCheckTrackingisEmpty(ItemJnlLine);
           OnAfterCheckNewTrackingisEmpty(Rec); should be: OnAfterCheckNewTrackingisEmpty(ItemJnlLine);

Or alternative could be: TestField("Serial No.", ''); TestField("Lot No.", '');

Note, we think it should be the second option because the functions are only called from outside this code unit where the global ItemJnlLine is not instantiated.

The recently added Package Tracking that uses Package No. and New Package No. does use the correct code, this can be checked for reference.

hhoutaptean avatar Oct 12 '21 12:10 hhoutaptean

// CR 413197 has been created firstly. CR closed with advice use github issue.

finn777 avatar Oct 12 '21 13:10 finn777

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. 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 Oct 20 '21 07:10 JesperSchulz