From 220b09c4e0d6e96dc6b7e98faffcded99f8aca47 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 26 Jun 2026 11:08:24 -0400 Subject: [PATCH] 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 Signed-off-by: Pedro Amorim --- Koha/EDI.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Koha/EDI.pm b/Koha/EDI.pm index b999ae6d90..958d41c3bb 100644 --- a/Koha/EDI.pm +++ b/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"); }