Skip to content

[Extensibility Request] issue 30352: add SkipNewExpirationDateCheck to OnCheckExpirationDateOnAfterCalcSumLot#9651

Open
AleksandricMarko wants to merge 1 commit into
mainfrom
ai-ext-fix/ext_issue-30352
Open

[Extensibility Request] issue 30352: add SkipNewExpirationDateCheck to OnCheckExpirationDateOnAfterCalcSumLot#9651
AleksandricMarko wants to merge 1 commit into
mainfrom
ai-ext-fix/ext_issue-30352

Conversation

@AleksandricMarko

@AleksandricMarko AleksandricMarko commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

The reporter needs a way to bypass the mandatory New Expiration Date validation performed during item journal posting in codeunit 22 "Item Jnl.-Post Line". The existing OnBeforeCheckExpirationDate (IsHandled) event would force them to replicate the whole procedure and skip several downstream events, risking conflicts with other extensions. This PR extends the existing OnCheckExpirationDateOnAfterCalcSumLot integration event with a new var SkipNewExpirationDateCheck: Boolean parameter so a subscriber can skip only that single TestField check without affecting any other logic.

Source issue repository: microsoft/ALAppExtensions; issue number: 30352

Changes Made

  • OnCheckExpirationDateOnAfterCalcSumLot - appended a new var SkipNewExpirationDateCheck: Boolean parameter to the integration event; CheckExpirationDate now initializes it to false, passes it to the event, and only performs TempTrackingSpecification.TestField("New Expiration Date", ...) when the subscriber has not set it to true. Adding a parameter to an existing integration event is non-breaking for current subscribers. The same change was mirrored across the W1 base layer and its country-layer counterparts (ES, APAC, CH, RU, IT).

Fixes AB#642607

…ionDateOnAfterCalcSumLot

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@AleksandricMarko AleksandricMarko added event-request SCM GitHub request for SCM area labels Jul 22, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Jul 22, 2026
@AleksandricMarko
AleksandricMarko marked this pull request as ready for review July 23, 2026 07:25
@AleksandricMarko
AleksandricMarko requested a review from a team July 23, 2026 07:25
else
SumLot := SignFactor * TempTrackingSpecification."Quantity (Base)";
OnCheckExpirationDateOnAfterCalcSumLot(SumLot, SignFactor, TempTrackingSpecification);
if (SumOfEntries > 0) and

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$\textbf{🟠\ High\ Severity\ —\ Events}$

The pre-existing local IntegrationEvent "OnCheckExpirationDateOnAfterCalcSumLot" is retrofitted with a new "var SkipNewExpirationDateCheck: Boolean" parameter that, when a subscriber sets it true, causes the following TestField("New Expiration Date", ExistingExpirationDate) validation to be skipped entirely. This is the IsHandled bypass pattern applied to an existing shipped event rather than a new dedicated one: existing subscribers never agreed to make this check skippable, and the guarded TestField enforces expiration-date/lot-quantity consistency (a data-integrity validation), not a pure calculation. Per BCQuality guidance, critical validations like this should keep running unconditionally while only the SumLot calculation is exposed as overridable, or a new dedicated OnBefore event should be introduced instead of widening this event's contract.

Knowledge:

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.13.4

if (SumOfEntries > 0) and
SkipNewExpirationDateCheck := false;
OnCheckExpirationDateOnAfterCalcSumLot(SumLot, SignFactor, TempTrackingSpecification, SkipNewExpirationDateCheck);
if (not SkipNewExpirationDateCheck) and (SumOfEntries > 0) and

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S1: Please add regression coverage proving that the default path still raises the existing expiration-date validation and that setting SkipNewExpirationDateCheck := true skips only this TestField without bypassing the rest of CheckExpirationDate.

@qasimikram qasimikram left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation is consistent across the W1 and localized code copies and scopes the bypass to the requested expiration-date validation.

S1: Please add regression coverage for the new subscriber-controlled path. The test should prove that the default path still raises the existing validation error and that setting SkipNewExpirationDateCheck := true skips only this TestField without bypassing the remainder of CheckExpirationDate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

event-request SCM GitHub request for SCM area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants