Bug 12892 : Alternate fix to restore the deleted code
authorChris Cormack <chris@bigballofwax.co.nz>
Wed, 5 Nov 2014 07:00:39 +0000 (20:00 +1300)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Thu, 6 Nov 2014 13:00:19 +0000 (10:00 -0300)
This doesn't depend on anything other patch.

1. Create a reservation for a Borrower with pickup branch
2. Check-in the corresponding Item in the pickup branch and confirm the hold
   for the Borrower
3. Go to circ/circulation.pl for the Borrower and verify that the reservation
   is "Waiting for pickup"
4. In the Borrower -> Check Out -tab (circ/circulation.pl) on the right of the
   big "Checking out to borrowername" should be a notification about holds ready
   for pickup.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Rafal Kopaczka <rkk0@poczta.onet.pl>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script, restores the old code and behaviour.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

circ/circulation.pl

index 2a1f211..2cf88b8 100755 (executable)
@@ -390,8 +390,33 @@ if ($borrowernumber) {
     $template->param(
         holds_count => Koha::Database->new()->schema()->resultset('Reserve')
           ->count( { borrowernumber => $borrowernumber } ) );
-
-    $template->param( adultborrower => 1 ) if ( $borrower->{'category_type'} eq 'A' );
+    my @borrowerreserv = GetReservesFromBorrowernumber($borrowernumber);
+
+    my @WaitingReserveLoop;
+    foreach my $num_res (@borrowerreserv) {
+        if ( $num_res->{'found'} && $num_res->{'found'} eq 'W' ) {
+            my $getiteminfo  = GetBiblioFromItemNumber( $num_res->{'itemnumber'} );
+            my $itemtypeinfo = getitemtypeinfo( (C4::Context->preference('item-level_itypes')) ? $getiteminfo->{'itype'} : $getiteminfo->{'itemtype'} );
+            my %getWaitingReserveInfo;
+            $getWaitingReserveInfo{title} = $getiteminfo->{'title'};
+            $getWaitingReserveInfo{biblionumber} =
+              $getiteminfo->{'biblionumber'};
+            $getWaitingReserveInfo{itemtype} = $itemtypeinfo->{'description'};
+            $getWaitingReserveInfo{author}   = $getiteminfo->{'author'};
+            $getWaitingReserveInfo{itemcallnumber} =
+              $getiteminfo->{'itemcallnumber'};
+            $getWaitingReserveInfo{reservedate} =
+              format_date( $num_res->{'reservedate'} );
+            $getWaitingReserveInfo{waitingat} =
+              GetBranchName( $num_res->{'branchcode'} );
+            $getWaitingReserveInfo{waitinghere} = 1
+              if $num_res->{'branchcode'} eq $branch;
+            push( @WaitingReserveLoop, \%getWaitingReserveInfo );
+        }
+    }
+    $template->param( WaitingReserveLoop => \@WaitingReserveLoop );
+    $template->param( adultborrower => 1 )
+      if ( $borrower->{'category_type'} eq 'A' );
 }
 
 my @values;