From c828404b62b489a4ec2fa62c5be159593e4f4e3b Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 4 Jan 2024 12:00:13 +0000 Subject: [PATCH] Bug 35100: Prevent StockrotationAdvance transfers from being cancelled ModItemTransfer is still very heavy handed and outright overrules existing transfers in the queue. For StockrotationAdvance transfers it's important that they remain in the queue to get actioned later, even if a higher precident transfer is actions in the interim. This patch adds a clause to the cancellation call within request_transfer such that StockrationAdvance transfers are left in tact for the next time the item is checked in. Test plan 1) Item is added to stock rotation 2) The cronjob creates a 'StockRotationAdvance' transfer 3) The item is checked in, which initiates the transfer, however, a hold is triggered 4) The hold is confirmed, which replaces the StockRotationAdvance 5) The item is checked out 6) The item is checked in, which initiates the transfer again 6) The item is checked in at it's destination and the StockrotationAdvance transfer has the proper date arrived date set. Signed-off-by: Nick Clemens --- Koha/Item.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/Item.pm b/Koha/Item.pm index 22eaceac948..a86b9287645 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -742,7 +742,7 @@ sub request_transfer { if ( $request && !$params->{enqueue} && !$params->{replace} ); $request->cancel( { reason => $params->{reason}, force => 1 } ) - if ( defined($request) && $params->{replace} ); + if ( defined($request) && $params->{replace} && ( $request->reason ne 'StockrotationAdvance' ) ); my $transfer = Koha::Item::Transfer->new( { -- 2.30.2