Bug 27017: Code more defensively in process_invoice

This patch adds a check for ordernumber precence in the EDI Invoice
message lines and skips process if one is not found.

We log the failure as a trace log to allow administrators the oportunity
to track down the issue further.

We also add a trace log to entries to show which bib the invoice line
is receipting to.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Colin Campbell 2020-11-13 13:46:13 +00:00 committed by Tomas Cohen Arazi
parent 1cc21ca6bd
commit c009c3fa81
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 11 additions and 1 deletions

View File

@ -312,12 +312,22 @@ sub process_invoice {
foreach my $line ( @{$lines} ) {
my $ordernumber = $line->ordernumber;
if (!$ordernumber ) {
$logger->trace( "Skipping invoice line, no associated ordernumber" );
next;
}
$logger->trace( "Receipting order:$ordernumber Qty: ",
$line->quantity );
my $order = $schema->resultset('Aqorder')->find($ordernumber);
if ($order->biblionumber->biblionumber) {
my $b = $order->biblionumber->biblionumber;
my $id = $line->item_number_id;
$logger->trace("Updating bib:$b id:$id");
}
# ModReceiveOrder does not validate that $ordernumber exists validate here
# ModReceiveOrder does not validate that $ordernumber exists validate here
if ($order) {
# check suggestions