Koha/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/members-search.tt
Kyle M Hall b2ccd0f3a2 Bug 13189 - Patron card creator patron search browse by last name broken by extended attributes
The browse by last name letters on the patron search for the patron card
creator doesn't work quite right. If extended patron attributes are
disabled, it works fine, but if they are enabled, they are searched even
when using the browse last name. Thus, if a searchable attribute has a
"D" in it, and one clicks the "D" link for the last name browser, that
patron will show even if he or she has no "D" in his or her hame!

Test Plan:
1) Enable extended patron attributes
2) Add a new searchable patron attribute
3) Create a new patron with the last name "Ace"
4) Add the value "D" to the attribute for this patron
5) Browse to the patron card maker, start a new patron batch
6) Click "Add item(s)" to bring up the patron search
7) Click the letter "D" in the patron search box
8) Note that "Ace" shows in the results list
9) Apply this patch
10) Repeat step 7
11) Note that "Ace" no longer shows in the results list
12) Perform a regular search by putting the letter "D" in the "Name:"
    field, and hit the "Search" button
13) Note this time the results *do* have Ace in them

Signed-off-by: Frederic Demians <f.demians@tamil.fr>
  Well described for a tricky bug. Reproducible. Fixed with this patch.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
This works as described, no problems or regressions found.
2015-02-12 15:35:07 -03:00

126 lines
5.7 KiB
Text

[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Patrons [% IF ( searching ) %]&rsaquo; Search results[% END %]</title>
[% INCLUDE 'doc-head-close.inc' %]
<style type="text/css">
#custom-doc { width:47.23em;*width:46.04em;min-width:600px; margin:auto; text-align:left; }
</style>
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
$("#CheckAll").click(function(){
$(".checkboxed").checkCheckboxes();
return false;
});
$("#CheckNone").click(function(){
$(".checkboxed").unCheckCheckboxes();
return false;
});
});
function add_item(borrowernum,batch_id,type_id){
var getstr='';
if (borrowernum == 'checked') {
itms= new Array;
if(document.resultform.borrowernumber.length > 0) {
for (var i=0; i < document.resultform.borrowernumber.length; i++) {
if (document.resultform.borrowernumber[i].checked) {
itms.push("borrower_number=" + document.resultform.borrowernumber[i].value);
}
}
getstr = itms.join("&");
} else {
getstr = "borrower_number="+document.resultform.borrowernumber.value;
}
} else {
getstr = "borrower_number="+borrowernum;
}
var myurl = "edit-batch.pl?op=add&batch_id="+batch_id+"&"+getstr;
window.opener.location.href = myurl;
}
//]]>
</script>
</head>
<body id="pcard_members-search" class="tools pcard">
<div id="custom-doc" class="yui-t7">
<div id="bd">
<div class="yui-g">
<h3>Patron search</h3>
<div class="browse">
Browse by last name:
[% FOREACH letter IN alphabet.split(' ') %]
<a href="/cgi-bin/koha/patroncards/members-search.pl?not_attributes=1&amp;member=[% letter %]&amp;batch_id=[% batch_id %]">[% letter %]</a>
[% END %]
</div>
<form method="get" action="/cgi-bin/koha/patroncards/members-search.pl"><p>
<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" 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 [% 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>
<div class="searchresults">
<table style="float: left; margin: .5em 0;">
<tr>
<th>Select</th>
<th><a href="members-search.pl?member=[% member %]&amp;category=[% category %]&amp;batch_id=[% batch_id %]&amp;orderby=cardnumber">Card</a></th>
<th><a href="members-search.pl?member=[% member %]&amp;category=[% category %]&amp;batch_id=[% batch_id %]&amp;orderby=surname">Name</a></th>
<th><a href="members-search.pl?member=[% member %]&amp;category=[% category %]&amp;batch_id=[% batch_id %]&amp;orderby=borrowers.categorycode">Category</a></th>
<th><a href="members-search.pl?member=[% member %]&amp;category=[% category %]&amp;batch_id=[% batch_id %]&amp;orderby=branchcode">Library</a></th>
<th>Expires on</th>
<th>Notes</th>
<th></th>
</tr>
[% FOREACH resultsloo IN resultsloop %]
[% UNLESS ( loop.odd ) %]
<tr class="highlight">
[% ELSE %]
<tr>
[% END %]
<td> <input type="checkbox" name="borrowernumber" id="patron[% resultsloo.borrowernumber %]" value="[% resultsloo.borrowernumber %]" /> </td>
<td>[% resultsloo.cardnumber %]</td>
<td style="white-space: nowrap;"><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% resultsloo.borrowernumber %]">[% resultsloo.surname %], [% resultsloo.firstname %]</a> <br /> [% resultsloo.address %][% IF ( resultsloo.address2 ) %]<br />[% resultsloo.address2 %][% END %][% IF ( resultsloo.city ) %]<br />[% resultsloo.city %][% END %]</td>
<td>[% resultsloo.category_description %] ([% resultsloo.categorycode %])</td>
<td>[% resultsloo.branchcode %]</td>
<td>[% resultsloo.dateexpiry %]</td>
<td>[% resultsloo.borrowernotes %]</td>
<td><a onclick="add_item('[% resultsloo.borrowernumber %]',[% batch_id %]); return false" href="/cgi-bin/koha/patroncards/edit-batch.pl?borrower_number=[% resultsloo.borrowernumber %]&amp;batch_id=[% batch_id %]&amp;op=add">Add</a></td>
</tr>
[% END %]
</table>
</div>
</form>
[% ELSE %]
[% IF ( searching ) %]
No results found
[% END %]
[% END %]
</div>
</div>
[% INCLUDE 'popup-bottom.inc' %]