From 5013a1bf850d548f2f6492b8ee703308b772d308 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 16 Jan 2020 16:40:10 +0000 Subject: [PATCH] Bug 24299: Record 'RotatingCollection' as a transfer trigger This patch adds support for passing a trigger to C4::Circulation::transferbook and passes 'RotatingCollection' to it when called inside the rotating collections routine. Test plan: 1/ Perform a rotating collection transfer operations 2/ Check the database for instances of 'RotatingCollection' in the branchtransfers.reason field. 3/ Signoff Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize --- C4/Circulation.pm | 8 +++++--- C4/RotatingCollections.pm | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 2c75ec68c4..b152b5071b 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -252,7 +252,7 @@ sub decode { =head2 transferbook ($dotransfer, $messages, $iteminformation) = &transferbook($newbranch, - $barcode, $ignore_reserves); + $barcode, $ignore_reserves, $trigger); Transfers an item to a new branch. If the item is currently on loan, it is automatically returned before the actual transfer. @@ -263,6 +263,8 @@ C<$barcode> is the barcode of the item to be transferred. If C<$ignore_reserves> is true, C<&transferbook> ignores reserves. Otherwise, if an item is reserved, the transfer fails. +C<$trigger> is the enum value for what triggered the transfer. + Returns three values: =over @@ -304,7 +306,7 @@ The item was eligible to be transferred. Barring problems communicating with the =cut sub transferbook { - my ( $tbr, $barcode, $ignoreRs ) = @_; + my ( $tbr, $barcode, $ignoreRs, $trigger ) = @_; my $messages; my $dotransfer = 1; my $item = Koha::Items->find( { barcode => $barcode } ); @@ -360,7 +362,7 @@ sub transferbook { #actually do the transfer.... if ($dotransfer) { - ModItemTransfer( $itemnumber, $fbr, $tbr ); + ModItemTransfer( $itemnumber, $fbr, $tbr, $trigger ); # don't need to update MARC anymore, we do it in batch now $messages->{'WasTransfered'} = 1; diff --git a/C4/RotatingCollections.pm b/C4/RotatingCollections.pm index 709eaf2164..a4477fa9e5 100644 --- a/C4/RotatingCollections.pm +++ b/C4/RotatingCollections.pm @@ -446,11 +446,10 @@ sub TransferCollection { while ( my $item = $sth->fetchrow_hashref ) { my ($status) = CheckReserves( $item->{itemnumber} ); my @transfers = C4::Circulation::GetTransfers( $item->{itemnumber} ); - C4::Circulation::transferbook( $colBranchcode, $item->{barcode}, my $ignore_reserves = 1 ) unless ( $status eq 'Waiting' || @transfers ); + C4::Circulation::transferbook( $colBranchcode, $item->{barcode}, 1, 'RotatingCollection' ) unless ( $status eq 'Waiting' || @transfers ); } return 1; - } =head2 GetCollectionItemBranches -- 2.39.5