Bug 24436: Add handling for reserve transfer triggers
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 17 Jan 2020 10:47:49 +0000 (10:47 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 20 Mar 2020 15:59:45 +0000 (15:59 +0000)
To test:
1 - Place a hold for pickup at a different branch than you are signed in at on an item owned by current branch
2 - Check in the item
3 - Confirm the transfer
4 - Check the branchtransfers table and note the reason is 'Reserve'
5 - Set the preference CanMarkHoldsToPullAsLost to allow
6 - Place a hold on an item at branch you are singed in at
7 - Ensure you are not using strict sql modes (bug 22431)
8 - Go to Circulation->Holds to pull
9 - Mark hold as lost
10 - Check branchtransfers and confirm reason is "LostReserve"
11 - Check in item from step 1 at the correct branch
12 - Go to Circulation->Holds awaiting pickup
13 - Cancel the reserve
14 - Check branchtransfers and confirm reason is "CancelReserve"

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

C4/Reserves.pm
circ/pendingreserves.pl
circ/waitingreserves.pl

index c975d7f..2099a91 100644 (file)
@@ -587,7 +587,8 @@ sub GetOtherReserves {
             C4::Items::ModItemTransfer(
                 $itemnumber,
                 $item->holdingbranch,
-                $checkreserves->{'branchcode'}
+                $checkreserves->{'branchcode'},
+                'Reserve'
               ),
               ;
         }
index 9f62b28..dc30a7a 100755 (executable)
@@ -102,7 +102,7 @@ if ( $op eq 'cancel_reserve' and $reserve_id ) {
         }
         $hold->cancel;
         if ( $item->homebranch ne $item->holdingbranch ) {
-            C4::Items::ModItemTransfer( $item->itemnumber, $item->holdingbranch, $item->homebranch );
+            C4::Items::ModItemTransfer( $item->itemnumber, $item->holdingbranch, $item->homebranch, 'LostReserve' );
         }
 
         if ( my $yaml = C4::Context->preference('UpdateItemWhenLostFromHoldList') ) {
index c78884f..abefc09 100755 (executable)
@@ -144,7 +144,7 @@ sub cancel {
 
 #      if the document is not in his homebranch location and there is not reservation after, we transfer it
     if ($transfer && !$nextreservinfo) {
-        ModItemTransfer( $item, $fbr, $tbr );
+        ModItemTransfer( $item, $fbr, $tbr, 'CancelReserve' );
     }
     # if we have a result
     if ($nextreservinfo) {