Bug 28229: Count only if needed
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 10 May 2021 10:08:21 +0000 (12:08 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 10 May 2021 13:46:54 +0000 (15:46 +0200)
We don't need to count the number of clubs if we selected a patron or
club already

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
reserve/request.pl

index 98ffd64..9c83b61 100755 (executable)
@@ -168,11 +168,9 @@ 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,
-        clubcount  => $clubcount,
+    multi_hold => $multi_hold,
 );
 
 # If we have the borrowernumber because we've performed an action, then we
@@ -276,6 +274,10 @@ if ($club_hold && !$borrowernumber_hold && !$action) {
     );
 }
 
+unless ( $club_hold or $borrowernumber_hold ) {
+    $template->param( clubcount => Koha::Clubs->search->count );
+}
+
 $template->param(
     messageborrower => $messageborrower,
     messageclub     => $messageclub