Bugzilla – Attachment 194502 Details for
Bug 41996
Further improvements to EDIFACT error recording
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41996: Improve EDI invoice error messages for branch mismatches
7fe8145.patch (text/plain), 3.30 KB, created by
Martin Renvoize (ashimema)
on 2026-03-05 13:02:45 UTC
(
hide
)
Description:
Bug 41996: Improve EDI invoice error messages for branch mismatches
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2026-03-05 13:02:45 UTC
Size:
3.30 KB
patch
obsolete
>From 7fe8145bf9611fb79a73d7fc4708eff2a0d9d693 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Thu, 5 Mar 2026 11:15:36 +0000 >Subject: [PATCH] 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. >--- > Koha/EDI.pm | 22 +++++++++++++++++++++- > 1 file changed, 21 insertions(+), 1 deletion(-) > >diff --git a/Koha/EDI.pm b/Koha/EDI.pm >index 5fa71cac675..053d5d71cea 100644 >--- a/Koha/EDI.pm >+++ b/Koha/EDI.pm >@@ -393,6 +393,23 @@ sub process_invoice { > $logger->trace( "Receipting order:$ordernumber Qty: " . $line->quantity ); > $logger->trace( "Updating bib:" . $bib->biblionumber . " id:" . $line->item_number_id ); > >+ if ( $order->orderstatus eq 'complete' ) { >+ $invoice_message->add_to_edifact_errors( >+ { >+ section => join( "\n", map { $_->as_string } @{ $line->{segs} } ), >+ details => "Warning: invoice line " >+ . $line->line_item_number >+ . " references ordernumber " >+ . $ordernumber >+ . " which is already marked as complete (previously received on " >+ . ( $order->datereceived // 'unknown date' ) >+ . "). The ordernumber in this invoice may be incorrect." >+ } >+ ); >+ $logger->warn( >+ "Invoice line references already-complete order $ordernumber (invoice $invoicenumber)"); >+ } >+ > # check suggestions > my $s = $schema->resultset('Suggestion')->search( > { >@@ -592,6 +609,7 @@ sub receipt_items { > > $item->update; > } else { >+ my $available_branches = join( ', ', sort keys %branch_map ) || 'none'; > $invoice_message->add_to_edifact_errors( > { > section => join( "\n", map { $_->as_string } @{ $inv_line->{segs} } ), >@@ -599,9 +617,11 @@ sub receipt_items { > . $inv_line->line_item_number . ":" > . $gir_occurrence > . " at branch $branch" >+ . " (order $ordernumber has items at: $available_branches)." >+ . " Check whether the ordernumber in the invoice (RFF+LI) is correct." > } > ); >- $logger->warn("Unmatched item at branch:$branch"); >+ $logger->warn("Unmatched item at branch:$branch for order:$ordernumber (available: $available_branches)"); > } > ++$gir_occurrence; > } >-- >2.53.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 41996
: 194502 |
194503
|
194504
|
194505
|
194506