Bug 41996 - Further improvements to EDIFACT error recording
Summary: Further improvements to EDIFACT error recording
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Martin Renvoize (ashimema)
QA Contact: Kyle M Hall (khall)
URL:
Keywords:
Depends on: 38689
Blocks:
  Show dependency treegraph
 
Reported: 2026-03-05 11:14 UTC by Martin Renvoize (ashimema)
Modified: 2026-03-05 13:03 UTC (History)
0 users

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 41996: Improve EDI invoice error messages for branch mismatches (3.30 KB, patch)
2026-03-05 13:02 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 41996: Add invoicenumber column to edifact_errors table (3.03 KB, patch)
2026-03-05 13:02 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 41996: Schema Updates (1.47 KB, patch)
2026-03-05 13:02 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 41996: Thread invoicenumber through EDI invoice error recording (8.40 KB, patch)
2026-03-05 13:02 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 41996: Filter EDI errors on invoice page by invoicenumber (1.70 KB, patch)
2026-03-05 13:02 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize (ashimema) 2026-03-05 11:14:05 UTC
We've been running the updated edifact error handling code in production for a little while now and there's a few improvements we can make to further enhance and clarify the error reporting for debugging EDI flows.
Comment 1 Martin Renvoize (ashimema) 2026-03-05 13:02:45 UTC
Created attachment 194502 [details] [review]
Bug 41996: Improve EDI invoice error messages for branch mismatches

When EDI invoice processing fails to match an item to a branch, the
error message now includes:
- The ordernumber referenced in the invoice (RFF+LI segment)
- The branches that order actually has items at
- A hint that the ordernumber in the invoice may be incorrect

Also adds a warning when an invoice line references an order that is
already marked as complete, which can indicate the supplier sent the
wrong ordernumber.

These improvements help acquisitions staff and vendors quickly diagnose
whether the problem is a supplier error (wrong RFF+LI value) rather
than a Koha data issue.
Comment 2 Martin Renvoize (ashimema) 2026-03-05 13:02:46 UTC
Created attachment 194503 [details] [review]
Bug 41996: Add invoicenumber column to edifact_errors table

Adds an optional invoicenumber column to edifact_errors so that errors
generated during invoice processing can be associated with the specific
invoice they relate to, rather than only the EDI message as a whole.

Message-level errors (e.g. unmatched vendor EAN) leave invoicenumber
NULL, indicating they apply to the whole file.
Comment 3 Martin Renvoize (ashimema) 2026-03-05 13:02:47 UTC
Created attachment 194504 [details] [review]
Bug 41996: Schema Updates

Patch from commit 1e48998
Comment 4 Martin Renvoize (ashimema) 2026-03-05 13:02:48 UTC
Created attachment 194505 [details] [review]
Bug 41996: Thread invoicenumber through EDI invoice error recording

All errors generated during process_invoice and receipt_items now
store the invoicenumber of the specific invoice being processed. This
allows errors to be displayed only on the relevant invoice page rather
than appearing on every invoice generated from the same EDI file.

Also fixes two pre-existing spacing bugs in error message strings
("itemnumberis missing" and "barcode"for invoice line").
Comment 5 Martin Renvoize (ashimema) 2026-03-05 13:02:49 UTC
Created attachment 194506 [details] [review]
Bug 41996: Filter EDI errors on invoice page by invoicenumber

The invoice page previously fetched all edifact_errors for the EDI
message, causing errors from unrelated invoice lines to appear on every
invoice generated from the same EDI file. For example, one unmatched
ordernumber in a file with 20 invoices would flag all 20 as having
errors.

Now only errors where invoicenumber matches the current invoice (or
where invoicenumber is NULL, indicating a message-level error) are
displayed.