Bug 28229: Only show clubs on request.tt if clubs exist
authorLucas Gass <lucas@bywatersolutions.com>
Wed, 5 May 2021 21:27:25 +0000 (21:27 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 10 May 2021 09:59:14 +0000 (11:59 +0200)
1. Have no existing clubs
2. Apply patch
3. Go to request.tt and you will not see the club tab or any mention of clubs
4. Create at least 1 club
5. Go back to request.tt and now see the tab for clubs
6. Make sure you can place holds as an individual with and without clubs.
7. Make sure you can place holds for clubs.
8. rejoice and sign-off

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
reserve/request.pl

index 1a397b0..4865973 100644 (file)
                     </div>
                 [% END %]
                 <fieldset class="brief">
-                    <label>Search patrons or clubs</label>
+                    <label>Search patrons[% IF clubcount %] or clubs[% END %]</label>
                     <div id="circ_holds_select" class="toptabs">
                         <ul>
                             <li><a href="#holds_patronsearch_pane">Patrons</a></li>
+                            [% IF clubcount %]
                             <li><a href="#holds_clubsearch_pane">Clubs</a></li>
+                            [% END %]
                         </ul>
                         <div id="holds_patronsearch_pane">
                             <form id="holds_patronsearch" action="request.pl?biblionumbers=[% biblionumbers | html %]" method="post">
                                 [% INCLUDE 'circ-patron-search-results.inc' destination = "holds" %]
                             [% END %]
                         </div>
-                        <div id="holds_clubsearch_pane">
-                            <form id="holds_clubsearch" action="request.pl?biblionumber=[% biblionumber | html %]" method="post">
-                                <div class="hint">Enter club ID or partial name:</div>
-                                <input type="text" size="40" id="club" class="focus" name="findclub" autocomplete="off" />
-                                <input type="submit" value="Search" />
-                                [% IF multi_hold %]
-                                    <input type="hidden" name="biblionumbers" value="[% biblionumbers | html %]"/>
-                                [% ELSE %]
-                                    <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
-                                [% END %]
+                        [% IF clubcount %]
+                            <div id="holds_clubsearch_pane">
+                                <form id="holds_clubsearch" action="request.pl?biblionumber=[% biblionumber | html %]" method="post">
+                                    <div class="hint">Enter club ID or partial name:</div>
+                                    <input type="text" size="40" id="club" class="focus" name="findclub" autocomplete="off" />
+                                    <input type="submit" value="Search" />
+                                    [% IF multi_hold %]
+                                        <input type="hidden" name="biblionumbers" value="[% biblionumbers | html %]"/>
+                                    [% ELSE %]
+                                        <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
+                                    [% END %]
 
-                            </form> <!-- /#holds_patronsearch -->
-                            [% IF clubs %]
-                                [% INCLUDE 'clubs-table.inc' destination = "holds" %]
-                            [% END %]
-                        </div>
+                                </form> <!-- /#holds_patronsearch -->
+                                [% IF clubs %]
+                                    [% INCLUDE 'clubs-table.inc' destination = "holds" %]
+                                [% END %]
+                            </div>
+                        [% END %]
                     </div>
                 </fieldset>
             [% ELSIF club %]
index 49d8a2f..98ffd64 100755 (executable)
@@ -168,8 +168,12 @@ if ( $biblionumbers ) {
     push @biblionumbers, $input->multi_param('biblionumber');
 }
 
+my $clubcount = Koha::Clubs->search->count;
 my $multi_hold = @biblionumbers > 1;
-$template->param(multi_hold => $multi_hold);
+$template->param(
+        multi_hold => $multi_hold,
+        clubcount  => $clubcount,
+);
 
 # If we have the borrowernumber because we've performed an action, then we
 # don't want to try to place another reserve.