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 <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Martin Renvoize 2020-01-16 16:40:10 +00:00
parent 12cae89523
commit 5013a1bf85
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
2 changed files with 6 additions and 5 deletions

View File

@ -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;

View File

@ -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