Bugzilla – Attachment 169385 Details for
Bug 37427
Searching for an empty string for clubs in an item's hold tab is not allowed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37427: Fix club search to display all clubs when search field is empty, consistent with patron search behavior
Bug-37427-Fix-club-search-to-display-all-clubs-whe.patch (text/plain), 3.69 KB, created by
Roman Dolny
on 2024-07-22 20:34:04 UTC
(
hide
)
Description:
Bug 37427: Fix club search to display all clubs when search field is empty, consistent with patron search behavior
Filename:
MIME Type:
Creator:
Roman Dolny
Created:
2024-07-22 20:34:04 UTC
Size:
3.69 KB
patch
obsolete
>From b993377868c0362a47a7839079cda34903477aaa Mon Sep 17 00:00:00 2001 >From: Sam Lau <samalau@gmail.com> >Date: Mon, 22 Jul 2024 20:04:18 +0000 >Subject: [PATCH] Bug 37427: Fix club search to display all clubs when search > field is empty, consistent with patron search behavior > >To test: >1) Create multiple patron clubs >2) Find a bib >3) Click Holds, then Clubs >4) Without entering any text, press the search button >5) Note that the list of clubs is not shown. >6) Apply patch and restart_all >7) Press the search button again, the entire list of clubs should be shown. >8) Ensure original search functionality still works > >Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl> >--- > .../prog/en/modules/reserve/request.tt | 1 + > reserve/request.pl | 36 +++++++++++-------- > 2 files changed, 23 insertions(+), 14 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >index 335aa6355f..97a8725f71 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -283,6 +283,7 @@ > <form id="holds_clubsearch" action="request.pl" method="get"> > <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="hidden" name="form_submitted" value="1" /> > <input type="submit" class="btn btn-primary" value="Search" /> > [% FOREACH biblionumber IN biblionumbers %] > <input type="hidden" name="biblionumber" value="[% biblionumber | html %]"/> >diff --git a/reserve/request.pl b/reserve/request.pl >index 5d0887764d..51dc8d47c2 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -89,6 +89,7 @@ my $messages; > my $exceeded_maxreserves; > my $exceeded_holds_per_record; > my @failed_holds = $input->multi_param('failed_holds'); >+my $form_submitted = $input->param('form_submitted'); > > my $op = $input->param('op') || q{}; > >@@ -145,22 +146,29 @@ if ($findborrower) { > $borrowernumber_hold = $patron->borrowernumber if $patron; > } > >-if($findclub) { >- my $club = Koha::Clubs->find( { name => $findclub } ); >- if( $club ) { >- $club_hold = $club->id; >- } else { >- my @clubs = Koha::Clubs->search( [ >- { name => { like => '%'.$findclub.'%' } }, >- { description => { like => '%'.$findclub.'%' } } >- ] )->as_list; >- if( scalar @clubs == 1 ) { >- $club_hold = $clubs[0]->id; >- } elsif ( @clubs ) { >- $template->param( clubs => \@clubs ); >+if ($form_submitted) { >+ if ($findclub) { >+ my $club = Koha::Clubs->find( { name => $findclub } ); >+ if ($club) { >+ $club_hold = $club->id; > } else { >- $messageclub = "'$findclub'"; >+ my @clubs = Koha::Clubs->search( >+ [ >+ { name => { like => '%' . $findclub . '%' } }, >+ { description => { like => '%' . $findclub . '%' } } >+ ] >+ )->as_list; >+ if ( scalar @clubs == 1 ) { >+ $club_hold = $clubs[0]->id; >+ } elsif (@clubs) { >+ $template->param( clubs => \@clubs ); >+ } else { >+ $messageclub = "'$findclub'"; >+ } > } >+ } else { >+ my @clubs = Koha::Clubs->search()->as_list; >+ $template->param( clubs => \@clubs ); > } > } > >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37427
:
169382
|
169385
|
174945