Bug 9575 - Serious Holds Problem with IndependantBranches
authorKyle M Hall <kyle@bywatersolutions.com>
Tue, 12 Mar 2013 18:30:48 +0000 (14:30 -0400)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Tue, 14 May 2013 12:29:28 +0000 (08:29 -0400)
If IndependantBranches is enabled, all holds for an item display the
currently logged in library no matter what, and modifying the holds will
set all pickup locations for all the holds to that logged in library!

Test plan:
 1) Disable IndependantBranches
 2) Place 3 holds on a record with 3 different pickup locations
 3) Enable IndependantBranches
 4) Refresh the holds page for that record, all the holds show now
    show a pickup location of the logged in branch
 5) Modify the order of the holds
 6) Disable IndependantBranches
 7) Refresh the holds, verify the holds all now have a pickup
    location of the logged in branch
 8) Apply the patch
 9) Repeat steps 1-3
10) Refresh the holds page for that record, all the holds should
    now show the correct pickup branch, but it cannot be changed
    as IndependantBranches is enabled.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
In my tests the above test plan only worked out if my user
had no superlibrarian permission. But then behaviour for
independentbranches off/on was all correct.
All tests and QA script pass.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
reserve/request.pl

index 5bcaca2..7f3f423 100755 (executable)
@@ -47,7 +47,7 @@ use Koha::DateUtils;
 my $dbh = C4::Context->dbh;
 my $sth;
 my $input = new CGI;
-my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
+my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user(
     {
         template_name   => "reserve/request.tmpl",
         query           => $input,
@@ -567,10 +567,16 @@ foreach my $biblionumber (@biblionumbers) {
         $reserve{'barcode'}         = $res->{'barcode'};
         $reserve{'priority'}    = $res->{'priority'};
         $reserve{'lowestPriority'}    = $res->{'lowestPriority'};
-        $reserve{'branchloop'} = GetBranchesLoop($res->{'branchcode'});
         $reserve{'optionloop'} = \@optionloop;
         $reserve{'suspend'} = $res->{'suspend'};
         $reserve{'suspend_until'} = $res->{'suspend_until'};
+
+        if ( C4::Context->preference('IndependantBranches') && $flags->{'superlibrarian'} != 1 ) {
+              $reserve{'branchloop'} = [ GetBranchDetail($res->{'branchcode'}) ];
+        } else {
+              $reserve{'branchloop'} = GetBranchesLoop($res->{'branchcode'});
+        }
+
         push( @reserveloop, \%reserve );
     }