Bugzilla – Attachment 176181 Details for
Bug 38689
EDIFACT errors should log to a staff accessible location
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38689: Improve logging of section
Bug-38689-Improve-logging-of-section.patch (text/plain), 8.63 KB, created by
Martin Renvoize (ashimema)
on 2025-01-07 11:23:24 UTC
(
hide
)
Description:
Bug 38689: Improve logging of section
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-01-07 11:23:24 UTC
Size:
8.63 KB
patch
obsolete
>From 21e430be1ada9f39bace1acd50b330251ea657de Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 7 Jan 2025 10:41:07 +0000 >Subject: [PATCH] Bug 38689: Improve logging of section > >We attempt to add the relevant part of the EDI message to the 'section' >field of the edifact_errors record. >--- > Koha/EDI.pm | 59 +++++++++++++++++++++++++++++++---------------------- > 1 file changed, 35 insertions(+), 24 deletions(-) > >diff --git a/Koha/EDI.pm b/Koha/EDI.pm >index 82708596018..c4a89555193 100644 >--- a/Koha/EDI.pm >+++ b/Koha/EDI.pm >@@ -290,7 +290,7 @@ sub process_invoice { > )->single; > } > if ( !$vendor_acct ) { >- $invoice_message->add_to_edifact_errors({ details => "Cannot find vendor with ean $vendor_ean" }); >+ $invoice_message->add_to_edifact_errors({ details => "Cannot find vendor with SAN: $vendor_ean" }); > $logger->error("Cannot find vendor with ean $vendor_ean for invoice $invoicenumber in ".$invoice_message->filename); > next; > } >@@ -316,8 +316,8 @@ sub process_invoice { > if ( !$ordernumber ) { > $invoice_message->add_to_edifact_errors( > { >- section => $line->line_item_number, >- details => "Message missing ordernumber" >+ section => join("\n", map { $_->as_string } @{$line->{segs}}), >+ details => "Invoice line " . $line->line_item_number . " is missing an ordernumber" > } > ); > $logger->error("Skipping invoice line, no associated ordernumber"); >@@ -329,8 +329,10 @@ sub process_invoice { > if ( !$order ) { > $invoice_message->add_to_edifact_errors( > { >- section => $line->line_item_number, >- details => "Koha order $ordernumber missing" >+ section => join( "\n", map { $_->as_string } @{ $line->{segs} } ), >+ details => "Unable to find matching Koha order for invoice " >+ . $line->line_item_number >+ . " with ordernumber $ordernumber" > } > ); > $logger->error("Skipping invoice line, no order found for $ordernumber, invoice:$invoicenumber"); >@@ -341,8 +343,10 @@ sub process_invoice { > if ( !$bib ) { > $invoice_message->add_to_edifact_errors( > { >- section => $line->line_item_number, >- details => "Koha biblio missing" >+ section => join("\n", map { $_->as_string } @{$line->{segs}}), >+ details => "Unable to find Koha biblio for invoice " >+ . $line->line_item_number >+ . " with ordernumber $ordernumber" > } > ); > $logger->error( >@@ -472,8 +476,10 @@ sub receipt_items { > my $i = $ilink->itemnumber; > $invoice_message->add_to_edifact_errors( > { >- section => $inv_line->line_item_number, >- details => "Cannot fine aqorder item" >+ section => join("\n", map { $_->as_string } @{$inv_line->{segs}}), >+ details => "Unable to find Koha item for invoice " >+ . $inv_line->line_item_number >+ . " with ordernumber $ordernumber" > } > ); > $logger->warn( >@@ -517,8 +523,10 @@ sub receipt_items { > if ( $rs->count > 0 ) { > $invoice_message->add_to_edifact_errors( > { >- section => $inv_line->line_item_number . " : " . $gir_occurrence, >- details => "Duplicate barcode found $barcode" >+ section => join("\n", map { $_->as_string } @{$inv_line->{segs}}), >+ details => "Duplicate barcode $barcode found for invoice line " >+ . $inv_line->line_item_number . ":" >+ . $gir_occurrence > } > ); > $logger->warn("Barcode $barcode is a duplicate"); >@@ -547,8 +555,11 @@ sub receipt_items { > else { > $invoice_message->add_to_edifact_errors( > { >- section => $inv_line->line_item_number, >- details => "Unmatched item at branch $branch" >+ section => join("\n", map { $_->as_string } @{$inv_line->{segs}}), >+ details => "No matching item found for invoice line " >+ . $inv_line->line_item_number . ":" >+ . $gir_occurrence >+ . " at branch $branch" > } > ); > $logger->warn("Unmatched item at branch:$branch"); >@@ -747,7 +758,7 @@ sub quote_item { > if ( $gir_count != $order_quantity ) { > $quote_message->add_to_edifact_errors( > { >- section => "GIR", >+ section => join('\n', @{$item->{GIR}}), > details => "Order for $order_quantity items, $gir_count segments present" > } > ); >@@ -833,7 +844,7 @@ sub quote_item { > if ( $item->quantity > 1 ) { > $quote_message->add_to_edifact_errors( > { >- section => "GIR", >+ section => join('\n', @{$item->{GIR}}), > details => "Skipped GIR line with invalid budget: " . $item->girfield('fund_allocation') > } > ); >@@ -842,7 +853,7 @@ sub quote_item { > } else { > $quote_message->add_to_edifact_errors( > { >- section => "GIR", >+ section => join("\n", map { $_->as_string } @{$item->{segs}}), > details => "Skipped orderline line with invalid budget: " . $item->girfield('fund_allocation') > } > ); >@@ -901,8 +912,8 @@ sub quote_item { > } else { > $quote_message->add_to_edifact_errors( > { >- section => "LRP", >- details => "No rota found for passed $lrp in orderline" >+ section => $item->{GIR}->[0], >+ details => "No rota found for passed LRP:$lrp in orderline" > } > ); > $logger->error("No rota found matching $lrp in orderline"); >@@ -925,8 +936,8 @@ sub quote_item { > $item->girfield( 'fund_allocation', $occurrence ); > $quote_message->add_to_edifact_errors( > { >- section => "GIR", >- details => "Skipped GIR line with invalid budget: $bad_budget" >+ section => $item->{GIR}->[$occurrence], >+ details => "Invalid budget $bad_budget found" > } > ); > $logger->trace( >@@ -1020,8 +1031,8 @@ sub quote_item { > else { > $quote_message->add_to_edifact_errors( > { >- section => "LRP", >- details => "No rota found for passed $lrp in orderline" >+ section => $item->{GIR}->[$occurrence], >+ details => "No rota found for passed LRP:$lrp in orderline" > } > ); > $logger->error( >@@ -1096,8 +1107,8 @@ sub quote_item { > else { > $quote_message->add_to_edifact_errors( > { >- section => "LRP", >- details => "No rota found for passed $lrp in orderline" >+ section => $item->{GIR}->[$occurrence], >+ details => "No rota found for passed LRP:$lrp in orderline" > } > ); > $logger->error( >-- >2.47.1
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 38689
:
175788
|
175789
|
175790
|
175793
|
175794
|
175795
|
175796
|
175797
|
175809
|
175810
|
175811
|
175812
|
175813
|
175814
|
175815
|
175816
|
175817
|
176127
|
176128
|
176129
|
176130
|
176131
|
176132
|
176133
|
176134
|
176173
|
176174
|
176175
|
176176
|
176177
|
176178
|
176179
|
176180
|
176181
|
176182
|
176183
|
176373
|
176374
|
176375
|
176376
|
176377
|
176378
|
176379
|
176380
|
176381
|
176382
|
176524
|
176525
|
176526
|
176527
|
176528
|
176529
|
176530
|
176531
|
176532
|
176533
|
176605
|
176606
|
176607
|
176608
|
176609
|
176610
|
176611
|
176612
|
176613
|
176614