Bug 18474: Restore multiple holds when patron is searched for
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 21 Dec 2017 18:59:24 +0000 (15:59 -0300)
committerFridolin Somers <fridolin.somers@biblibre.com>
Tue, 22 May 2018 09:46:54 +0000 (11:46 +0200)
We lost the ability to place multiple holds when we are searching for
patrons. The multi_holds parameter is lost and not handled correctly in
the template.

Test plan:
- Make sure you can place multiple holds for a patron you will search for
- Same for simple hold

TODO the multiple holds view should not be displayed if only 1 record
has been selected from the search result.

Signed-off-by: claude brayer <claude.brayer@cea.fr>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit dc008b90cd50b80c78520de6379c61e534efce75)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

koha-tmpl/intranet-tmpl/prog/en/includes/circ-patron-search-results.inc
koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
reserve/request.pl

index 29e72a2..b72bb58 100644 (file)
     </thead>
     <tbody>
         [% FOREACH borrower IN borrowers %]
-            [% IF ( destination == "circ" ) %]
+            [% IF destination == "circ" %]
                 <tr class="clickable" data-url="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% borrower.borrowernumber %]">
                     <td><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% borrower.borrowernumber %]">[% borrower.surname %], [% borrower.firstname %]</a></td>
+            [% ELSIF destination == "holds" %]
+                [% IF multi_hold %]
+                    [% SET data_url = "/cgi-bin/koha/reserve/request.pl?borrowernumber=" _ borrower.borrowernumber _ "&amp;multi_hold=1&amp;biblionumbers=" _ biblionumbers %]
+                [% ELSE %]
+                    [% SET data_url = "/cgi-bin/koha/reserve/request.pl?borrowernumber=" _ borrower.borrowernumber _ "&amp;biblionumber=" _ biblionumber %]
+                [% END %]
+                <tr class="clickable" data-url="[% data_url %]">
+                    <td><a href="[% data_url %]">[% borrower.surname %], [% borrower.firstname %]</a></td>
             [% ELSE %]
-                <tr class="clickable" data-url="/cgi-bin/koha/reserve/request.pl?borrowernumber=[% borrower.borrowernumber %]&amp;biblionumber=[% biblionumber %]">
-                    <td><a href="/cgi-bin/koha/reserve/request.pl?borrowernumber=[% borrower.borrowernumber %]&amp;biblionumber=[% biblionumber %]">[% borrower.surname %], [% borrower.firstname %]</a></td>
+                [%# This does not exist %]
             [% END %]
                 <td>[% borrower.cardnumber %]</td>
                 <td>[% borrower.dateofbirth | $KohaDates %]</td>
index 02c50b9..f12e1de 100644 (file)
@@ -256,7 +256,12 @@ function checkMultiHold() {
                 <div class="hint">Enter patron card number or partial name:</div>
                 <input type="text" size="40" id="patron" class="focus" name="findborrower" />
                 <input type="submit" value="Search" />
+            [% IF multi_hold %]
+                <input type="hidden" name="multi_hold" value="[% multi_hold %]"/>
+                <input type="hidden" name="biblionumbers" value="[% biblionumbers %]"/>
+            [% ELSE %]
                 <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
+            [% END %]
             </fieldset>
         [% ELSE %]
             [% INCLUDE 'circ-patron-search-results.inc' destination = "holds" %]
index e6cf6bf..bf2a8a6 100755 (executable)
@@ -61,8 +61,6 @@ my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user(
     }
 );
 
-my $multihold = $input->param('multi_hold');
-$template->param(multi_hold => $multihold);
 my $showallitems = $input->param('showallitems');
 
 my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
@@ -122,13 +120,16 @@ if ($findborrower) {
 }
 
 my @biblionumbers = ();
+my $biblionumber = $input->param('biblionumber');
 my $biblionumbers = $input->param('biblionumbers');
-if ($multihold) {
+if ( $biblionumbers ) {
     @biblionumbers = split '/', $biblionumbers;
 } else {
     push @biblionumbers, $input->multi_param('biblionumber');
 }
 
+# FIXME multi_hold should not be a variable but depends on the number of elements in @biblionumbers
+$template->param(multi_hold => scalar $input->param('multi_hold'));
 
 # If we have the borrowernumber because we've performed an action, then we
 # don't want to try to place another reserve.
@@ -632,10 +633,6 @@ $template->param( biblionumbers => $biblionumbers );
 $template->param( exceeded_maxreserves => $exceeded_maxreserves );
 $template->param( exceeded_holds_per_record => $exceeded_holds_per_record );
 
-if ($multihold) {
-    $template->param( multi_hold => 1 );
-}
-
 if ( C4::Context->preference( 'AllowHoldDateInFuture' ) ) {
     $template->param( reserve_in_future => 1 );
 }