Bug 42789: (QA follow-up) Log item deletion failures during EDI cancellation
This patch logs any object messages returned by cancel() to the EDI log, including the itemnumber if available. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
parent
45a60d487c
commit
220b09c4e0
14
Koha/EDI.pm
14
Koha/EDI.pm
|
|
@ -220,6 +220,20 @@ sub process_ordrsp {
|
|||
my $order = Koha::Acquisition::Orders->find($ordernumber);
|
||||
if ($order) {
|
||||
$order->cancel( { reason => $reason } );
|
||||
|
||||
# cancel() records item deletion failures ( e.g. an item still has holds )
|
||||
# as object messages instead of dying; log any such messages so they are
|
||||
# not lost in the automated flow
|
||||
for my $message ( @{ $order->object_messages } ) {
|
||||
my $item = $message->payload->{item};
|
||||
$logger->warn(
|
||||
sprintf(
|
||||
'EDI ORDRSP: order %s cancellation issue: %s%s',
|
||||
$ordernumber, $message->message,
|
||||
$item ? ' for itemnumber ' . $item->itemnumber : q{}
|
||||
)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$logger->error("EDI ORDRSP: ordernumber $ordernumber not found, cannot process cancellation");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue