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
7) 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 <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Martin Renvoize 2024-01-04 12:00:13 +00:00
parent 08cecd6c6f
commit 118bd153e2
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -776,7 +776,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(
{