Bug 5502 - Patron card category search field should be menu
When searching for patrons to add to a patron card creator batch there is a text input field for submitting a patron category. This should be a dropdown menu. This patch corrects it. To test, go to Tools -> Patron card creator and click "New batch." - Click the "Add item(s)" button. - Confirm that in the Patron search pop-up window there is a dropdown menu populated with existing patron categories. - Confirm that searches limited by patron category return correct results. - Confirm that the correct patron category is automatically preselected after performing a search limited by category. - Confirm that reordering the table of search results works correctly. Signed-off-by: Aleisha <aleishaamohia@hotmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
parent
69e3d44dc2
commit
0ddeabd3d4
2 changed files with 34 additions and 9 deletions
|
@ -45,7 +45,7 @@ function add_item(borrowernum,batch_id,type_id){
|
|||
<div id="custom-doc" class="yui-t7">
|
||||
<div id="bd">
|
||||
<div class="yui-g">
|
||||
<h3>Patron Search</h3>
|
||||
<h3>Patron search</h3>
|
||||
|
||||
<div class="browse">
|
||||
Browse by last name:
|
||||
|
@ -58,14 +58,27 @@ function add_item(borrowernum,batch_id,type_id){
|
|||
<input type="hidden" name="batch_id" value="[% batch_id %]" />
|
||||
<input type="hidden" name="type" value="[% type %]" />
|
||||
<label for="member">Name: </label>
|
||||
<input id="member" name="member" />
|
||||
<label for="category">Category code: </label>
|
||||
<input id="category" name="category" />
|
||||
<input id="member" name="member" value="[% member %]" />
|
||||
|
||||
[% UNLESS ( no_categories ) %]
|
||||
<label for="category">Category: </label>
|
||||
<select name="category" id="category">
|
||||
<option value="">Any</option>
|
||||
[% FOREACH categorie IN categories %]
|
||||
[% IF ( categorie.categorycode == category ) %]
|
||||
<option value="[% categorie.categorycode %]" selected="selected">[% categorie.description |html_entity %]</option>
|
||||
[% ELSE %]
|
||||
<option value="[% categorie.categorycode %]">[% categorie.description |html_entity %]</option>
|
||||
[% END %]
|
||||
[% END %]
|
||||
</select>
|
||||
[% END %]
|
||||
|
||||
<input type="submit" value="Search" /></p>
|
||||
</form>
|
||||
|
||||
[% IF ( resultsloop ) %]
|
||||
<div id="searchheader"> <h3>Results [% from %] to [% to %] of [% numresults %] found for [% IF ( member ) %]name: '<span class="ex">[% member %][% ELSIF ( category_type ) %]category code: '<span class="ex">[% category_type %][% END %]</span>'</h3></div>
|
||||
<div id="searchheader"> <h3>Results [% from %] to [% to %] of [% numresults %] found [% IF ( member ) %]for name: '<span class="ex">[% member %]</span>'[% END %] [% IF ( category ) %]with category code: '<span class="ex">[% category %]</span>'[% END %]</h3></div>
|
||||
[% IF ( paginationbar ) %]<div id="pagination_top" class="pages">[% paginationbar %]</div>[% END %]
|
||||
<form name="resultform" action="/cgi-bin/koha/patroncards/members-search.pl" method="get" class="checkboxed"><div style="float: right; margin-top: .5em;"><input type="submit" class="icon addchecked" value="Add checked" onclick="add_item('checked',[% batch_id %]); return false" /> <input type="button" class="close" value="Done" /></div>
|
||||
<div style="line-height: 2em; margin-left: .7em;"><a id="CheckAll" href="/cgi-bin/koha/patroncards/members-search.pl">Select All</a><a id="CheckNone" href="/cgi-bin/koha/patroncards/members-search.pl">Clear All</a></div>
|
||||
|
@ -74,10 +87,10 @@ function add_item(borrowernum,batch_id,type_id){
|
|||
<table style="float: left; margin: .5em 0;">
|
||||
<tr>
|
||||
<th>Select</th>
|
||||
<th><a href="members-search.pl?member=[% member %]&category=[% category_type %]&batch_id=[% batch_id %]&orderby=cardnumber">Card</a></th>
|
||||
<th><a href="members-search.pl?member=[% member %]&category=[% category_type %]&batch_id=[% batch_id %]&orderby=surname">Name</a></th>
|
||||
<th><a href="members-search.pl?member=[% member %]&category=[% category_type %]&batch_id=[% batch_id %]&orderby=borrowers.categorycode">Category</a></th>
|
||||
<th><a href="members-search.pl?member=[% member %]&category=[% category_type %]&batch_id=[% batch_id %]&orderby=branchcode">Library</a></th>
|
||||
<th><a href="members-search.pl?member=[% member %]&category=[% category %]&batch_id=[% batch_id %]&orderby=cardnumber">Card</a></th>
|
||||
<th><a href="members-search.pl?member=[% member %]&category=[% category %]&batch_id=[% batch_id %]&orderby=surname">Name</a></th>
|
||||
<th><a href="members-search.pl?member=[% member %]&category=[% category %]&batch_id=[% batch_id %]&orderby=borrowers.categorycode">Category</a></th>
|
||||
<th><a href="members-search.pl?member=[% member %]&category=[% category %]&batch_id=[% batch_id %]&orderby=branchcode">Library</a></th>
|
||||
<th>Expires on</th>
|
||||
<th>Notes</th>
|
||||
<th></th>
|
||||
|
|
|
@ -38,6 +38,7 @@ my $orderby = $cgi->param('orderby') || undef;
|
|||
|
||||
my @categories=C4::Category->all;
|
||||
my %categories_display;
|
||||
my $no_categories;
|
||||
|
||||
foreach my $category (@categories) {
|
||||
my $hash={
|
||||
|
@ -47,6 +48,7 @@ foreach my $category (@categories) {
|
|||
$categories_display{$$category{categorycode}} = $hash;
|
||||
}
|
||||
|
||||
|
||||
my ($template, $loggedinuser, $cookie) = get_template_and_user({
|
||||
template_name => "patroncards/members-search.tt",
|
||||
query => $cgi,
|
||||
|
@ -55,6 +57,16 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user({
|
|||
flagsrequired => {borrowers => 1},
|
||||
debug => 1,});
|
||||
|
||||
if(scalar(@categories) < 1){ $no_categories = 1; }
|
||||
if($no_categories && C4::Context->preference("AddPatronLists")=~/code/){
|
||||
$template->param(no_categories => 1);
|
||||
} else {
|
||||
$template->param(
|
||||
categories=>\@categories,
|
||||
category => $category
|
||||
);
|
||||
}
|
||||
|
||||
$orderby = "surname,firstname" unless $orderby;
|
||||
$member =~ s/,//g; #remove any commas from search string
|
||||
$member =~ s/\*/%/g;
|
||||
|
|
Loading…
Reference in a new issue