Skip to content

[main] bug 661276 - EET Entry Card page editability - #14726

Open
David Holuša (DavidHolusa) wants to merge 4 commits into
mainfrom
bugs/661276-main-ResubmitEETEntryWithErrorStatus
Open

David Holuša (DavidHolusa) wants to merge 4 commits into
mainfrom
bugs/661276-main-ResubmitEETEntryWithErrorStatus

Conversation

@DavidHolusa

@DavidHolusa David Holuša (DavidHolusa) commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

What & why

Allow users to correct selected fields on the EET Entry Card and resend entries that failed because of correctable errors.

Editing is limited to entries in Created or Failure status with Correction Allowed enabled and no POK/FIK. The six editable fields are Description, Applied Document Type, Applied Document No., Taxpayer ID, Authorizing Taxpayer ID, and Multiple Taxpayer Authorization. Amounts, receipt identifiers, and technical fields remain read-only. Creating and deleting entries from the card remains disabled.

Add Boolean field Correction Allowed:

  • New entries are initialized with permission to correct their data.
  • Existing entries default to false.
  • Local validation failures enable corrections.
  • Following a failed registration attempt, IsCorrectableFailure() evaluates the latest attempt. Technical failures and uncertain outcomes disable corrections; recognized correctable rejections enable them.

Move entry validation before the Sent / Sent to Verification transition. Local validation failures set Failure and allow corrections without incrementing Failed Send Attempts.

Also:

  • Introduce an internal EET Service Error enum for named service error codes.
  • Accept unsigned service error responses as specified by the interface documentation, while retaining acknowledgement certificate checks.
  • Refresh the card after verification and cancellation.
  • Preserve input editability on the Simple Registration page.
  • Respect the ShowDialog parameter when sending an entry.

Linked work

Fixes AB#661276

How I validated this

  • I read the full diff and it contains only changes I intended.
  • I built the affected app(s) locally with no new analyzer warnings.
  • I ran the change in Business Central and confirmed it behaves as expected.
  • I added or updated tests for the new behavior, or explained below why none are needed.

What I tested and the outcome

  • Reviewed the current source changes. Earlier iterations were checked using VS Code diagnostics without reported errors; the latest changes still require local build and runtime validation.
  • No automated tests were added or executed. Functional coverage is still required.

Scenarios to validate before requesting review:

  • Correct and save the six selected fields on an eligible Created or Failure entry.
  • Confirm that registered entries and entries being sent remain read-only.
  • Trigger local validation failure: confirm Failure status, Correction Allowed enabled, and no increment of Failed Send Attempts.
  • Simulate communication failure, service errors -1/8, and an unusable or mismatched response: confirm corrections are disabled.
  • Follow a technical failure with a correctable failure: confirm corrections are enabled according to the latest attempt.
  • Confirm that existing entries remain non-editable until an eligible attempt enables corrections.
  • Verify automatic retries, retry limits, unsigned error responses, and acknowledgement certificate checks.
  • Verify Simple Registration input fields and sending with ShowDialog set to false.

Risk & compatibility

  • Adds Boolean field 220, Correction Allowed, to EET Entry CZL. Existing entries default to false; no historical failure classification is backfilled.
  • Correction permission follows the latest evaluated attempt, not the complete registration history. A later correctable or local validation failure can re-enable editing after an earlier uncertain outcome. This is an intentional simplification and does not prove that the earlier attempt was unregistered.
  • Editability is enforced on the EET Entry Card, not as a general restriction on programmatic modifications.
  • Service retry classification and retry limits remain unchanged. Local validation failures are now handled before sending and are not counted as failed send attempts.
  • Job queue selection remains limited to Send Pending; processing Created entries is deferred.
  • Business premises Unit ID continues to be read from the current setup. Preserving its original value for retries is deferred.
  • Transaction boundaries and recovery of entries left in Sent status are unchanged.
  • No new permission sets or public event signatures are introduced.

@github-actions github-actions Bot added the Team: Finance GitHub request for Finance area label Nov 30, 2026
@github-actions github-actions Bot modified the milestone: Version 30.0 Nov 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

$\textbf{🟠\ High\ Severity\ —\ Error\ Handling}$

When the nested SOAP HttpClient TryFunction returns false, this branch calls ProcessFaultResponse(), which immediately reads the response status and may inspect response content even though a platform or transport failure may have left no usable response. Stop or propagate the transport failure before accessing the response, otherwise a secondary response-access error can obscure the original failure.

Knowledge:

Line mapping was unavailable, so this was posted as an issue comment.

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

@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 1

Recommendation: Request Changes

What this PR does

Allows corrections to six fields on unsuccessful EET entries while keeping amounts, receipt identifiers and technical fields read-only. Adds a persistent resend lock for registration attempts with uncertain outcomes.

For new attempts, the response classification and true-only lock preserve uncertainty across retries, later local failures and verification. Successful entries and entries with confirmation codes stay locked. However, historical uncertain failures receive the new flag's default false and become editable after upgrade; the newly editable applied-document pair also lacks the validation used during simple registration.

Problem-solution fit

Fit: Partial

The six requested correction fields are enabled for the intended statuses, and new uncertain attempts are protected. Existing uncertain attempts are not protected on upgrade, and corrections can leave an invalid applied-document association.

Suggestions

S1 (🔴 High): Keep earlier uncertain failures locked after upgrade
Backfill the resend lock conservatively for earlier registration attempts before enabling edits. After an upgrade, an old timeout failure has the new Boolean set to false and becomes editable here. This lets users change taxpayer data on a sale that may already be registered.

S2 (🟠 Moderate): Validate applied document fields during entry corrections
Use the same applied-document validation as simple registration. Changing Invoice to Credit Memo currently keeps the invoice number, and the card accepts a number that does not exist. This leaves an invalid Applied Document Type/No. link on the entry.

S3 (🟠 Moderate): Cover the new entry editability rules
Add regression tests for the six editable fields and for entries blocked by status, acknowledgement, fiscal code, or the resend lock. The existing EET test app can exercise the table predicate and card without calling the live service.

Risk assessment and necessity

Risk: The main risk is overwriting taxpayer authorization data for a historical sale whose acknowledgement was lost. Table-wide read-only metadata also affects simple registration, though its affected direct inputs are explicitly enabled and its amounts use page variables. No existing public procedure or event signature changes, and no new transaction boundary is introduced. Validation here is source inspection only; no build, automated tests or runtime checks were run.

Necessity: The correction workflow is justified: without it, users cannot repair these six fields on a genuinely unregistered failure through the entry card. The scope is reasonable, but historical attempts need a safe transition before the new editing capability is enabled.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=14726 round=1 by=alexei-dobriansky at=2026-11-30T20:36:35Z lastSha=a10d866ec96f31dfe1e59a69a6ca32ee5ebc7c39 reviewKey=c883e18e84f695d97cfd74cea4808bac36a955592fed302034db10e13c99b585 suggestions=S1@0a2461d9,S2@8cbdd32b,S3@d3c79658

@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 2

Recommendation: Request Changes

What this PR does

Allows corrections to six fields on unsuccessful EET entries while keeping amounts, receipt identifiers and technical fields read-only. This round replaces the resend lock with positive correction permission and moves local validation before sending.

Existing entries now default to locked, which fixes the upgrade-default problem. However, a later failed attempt can unlock an earlier uncertain registration, and certificate failures now escape the normal failure-handling path. The correction workflow is therefore only partly safe.

Status of previous suggestions
ID Title Status Author response
S1 Keep earlier uncertain failures locked after upgrade Addressed Correction Allowed defaults to false for existing entries; only newly initialized entries receive true. This fixes initial upgrade eligibility, not the later-attempt problem in S4.
S2 Validate applied document fields during entry corrections Not addressed No matching fix or reply. The card still neither clears the number when its type changes nor checks document existence, unlike simple registration.
S3 Cover the new entry editability rules Not addressed No matching fix or reply. Neither new commit adds tests for the six fields or the status, acknowledgement, fiscal-code and correction-permission gates.
New observations (commits since round 1)

S4 (🔴 High): Keep uncertain registrations locked across later failures
Keep an uncertain registration locked until its outcome is known. After a timeout, a later local or setup error now enables edits even though the earlier request may have registered the sale. Resending changed taxpayer or authorization data can report the same sale under different details.

S5 (🟠 Moderate): Handle certificate failures before leaving the batch
Keep certificate lookup inside a handled validation boundary. A missing or invalid certificate now raises an error before Send's TryFunction instead of recording a failed entry. In the job queue, one such entry stops processing the remaining entries.

Risk assessment and necessity

Risk: Correction permission no longer preserves uncertainty across attempts. A pre-submission failure, including a local validation failure during verification, can allow changes to taxpayer data for a sale that may already be registered. Missing or invalid certificates can also interrupt the retry batch. Upgrade defaults are now conservative; existing public procedure and event signatures remain unchanged. Validation was source inspection only; no build, automated tests or runtime checks were run.

Necessity: The correction workflow remains justified: without it, users cannot repair the six requested fields through the entry card. Preserve the outcome of earlier uncertain registrations while allowing changes to entries known not to have registered.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=14726 round=2 by=alexei-dobriansky at=2026-12-01T14:26:38Z lastSha=1b13979d59dc17be51d377ff76cae5fd23c83f65 reviewKey=f0c268d2d5d56ffef143f1d7160ba88d0eb9cfd2f8f3ba23bc56b1faeb48fe12 suggestions=S1@0a2461d9:addressed,S2@8cbdd32b:notaddressed,S3@d3c79658:notaddressed,S4@c3395bc9:new,S5@af0dcc1c:new parentRound=1

…661276-main-ResubmitEETEntryWithErrorStatus
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

$\textbf{🟠\ High\ Severity\ —\ Web\ Services}$

The SOAP response is parsed as the expected business XML after only the transport Boolean has been checked. A successful HTTP exchange can still return a 4xx or 5xx response, so check GlobalHttpResponseMessage.IsSuccessStatusCode() and route non-success responses through explicit fault handling before reading the response as a success payload.

Suggested fix (apply manually — could not be anchored as a one-click suggestion):

        if not GlobalHttpResponseMessage.IsSuccessStatusCode() then begin
            CommunicationFailed := true;
            SOAPWSRequestManagementCZL.ProcessFaultResponse();
            exit;
        end;
        XmlDocument.ReadFrom(SOAPWSRequestManagementCZL.GetResponseAsText(), ResponseXmlDocument);
        ResponseContentXmlDocument := SOAPWSRequestManagementCZL.GetResponseContent();

Knowledge:

Line mapping was unavailable, so this was posted as an issue comment.

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

This branch was previously deployed

1 inactive (outdated) deployment
triage — a10d866e Deployed Nov 30, 2026 by DavidHolusa via Classify team ownership #12440
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Team: Finance GitHub request for Finance area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants