Bug 11801: In transit hold items incorrectly labels as "Waiting to be pulled" on...
authorJonathan Druart <jonathan.druart@biblibre.com>
Thu, 20 Feb 2014 15:06:36 +0000 (10:06 -0500)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Wed, 18 Jun 2014 18:40:47 +0000 (15:40 -0300)
If an item needs to be transferred to fill a hold, the hold will be
listed as 'Waiting to be pulled" while it is in transit.

Test Plan:
1) Place a hold for pickup at another library
2) Check in the item, confirm the hold transfer
3) View the holds for that record ( request.pl )
4) Note the priority is "In transit" and the status is 'Waiting to be
   pulled".
5) Apply this patch
6) Reload the holds page
7) Note the status is now "Item being transferred to $branch"

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

reserve/request.pl

index 1b303c7..a86e0e7 100755 (executable)
@@ -476,7 +476,12 @@ foreach my $biblionumber (@biblionumbers) {
             $reserve{'itemnumber'}  = $res->{'itemnumber'};
             $reserve{'wbrname'} = $branches->{$res->{'branchcode'}}->{'branchname'};
             if($reserve{'holdingbranch'} eq $reserve{'wbrcode'}){
-                $reserve{'atdestination'} = 1;
+                # Just because the holdingbranch matches the reserve branch doesn't mean the item
+                # has arrived at the destination, check for an open transfer for the item as well
+                my ( $transfertwhen, $transfertfrom, $transferto ) = C4::Circulation::GetTransfers( $res->{itemnumber} );
+                if ( not $transferto or $transferto ne $res->{branchcode} ) {
+                    $reserve{'atdestination'} = 1;
+                }
             }
             # set found to 1 if reserve is waiting for patron pickup
             $reserve{'found'} = 1 if $res->{'found'} eq 'W';