1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha › Patrons [% IF ( searching ) %]› Search results[% END %]</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
5 [% INCLUDE 'datatables.inc' %]
6 <script type="text/javascript">
8 $(document).ready(function() {
9 $('#add_to_patron_list_submit').attr('disabled', 'disabled');
10 $('#new_patron_list').hide();
12 $('#add_to_patron_list').change(function() {
13 var value = $('#add_to_patron_list').val();
14 if ( value == 'new' ) {
15 $('#new_patron_list').val('')
16 $('#new_patron_list').show();
17 $('#new_patron_list').focus();
19 $('#new_patron_list').hide();
20 $('#add_to_patron_list_submit').removeAttr('disabled');
22 $('#new_patron_list').hide();
23 $('#add_to_patron_list_submit').attr('disabled', 'disabled');
27 $('#new_patron_list').on('input', function() {
28 if ( $('#new_patron_list').val() ) {
29 $('#add_to_patron_list_submit').removeAttr('disabled');
31 $('#add_to_patron_list_submit').attr('disabled', 'disabled');
35 $("#patron_list_dialog").hide();
36 $("#add_to_patron_list_submit").on('click', function(e){
37 if ( $('#add_to_patron_list').val() == 'new' ) {
38 if ( $('#new_patron_list').val() ) {
39 $("#add_to_patron_list option").each(function() {
40 if ( $(this).text() == $('#new_patron_list').val() ) {
41 alert( _("You already have a list with that name!") );
46 alert( _("You must give your new patron list a name!") );
51 if ( $("#memberresultst input:checkbox:checked").length == 0 ) {
52 alert( _("You have not selected any patrons to add to a list!") );
56 var borrowernumbers = [];
57 $("#memberresultst").find("input:checkbox:checked").each(function(){
58 borrowernumbers.push($(this).val());
61 add_to_patron_list: encodeURIComponent($("#add_to_patron_list").val()),
62 new_patron_list: encodeURIComponent($("#new_patron_list").val()),
63 borrowernumbers: borrowernumbers
68 url: '/cgi-bin/koha/svc/members/add_to_list',
69 success: function(data) {
70 $("#patron_list_dialog").show();
71 $("#patron_list_dialog > span.patrons-length").html(data.patrons_added_to_list);
72 $("#patron_list_dialog > a").attr("href", "/cgi-bin/koha/patron_lists/list.pl?patron_list_id=" + data.patron_list.patron_list_id);
73 $("#patron_list_dialog > a").html(data.patron_list.name);
76 alert("an error occurred");
85 $(document).ready(function() {
87 $("#searchmember_filter").val("[% searchmember %]");
89 [% IF searchfieldstype %]
90 $("searchfieldstype_filter").val("[% searchfieldstype %]");
93 $("#searchtype_filter").val("[% searchtype %]");
96 $("#categorycode_filter").val("[% categorycode %]");
99 $("#branchcode_filter").val("[% branchcode %]");
102 [% IF view != "show_results" %]
103 $("#searchresults").hide();
107 // Build the aLengthMenu
109 [%PatronsPerPage %], 10, 20, 50, 100, -1
111 jQuery.unique(aLengthMenu);
112 aLengthMenu.sort(function( a, b ){
113 // Put "All" at the end
116 } else if ( b == -1 ) {
119 return parseInt(a) < parseInt(b) ? -1 : 1;}
121 var aLengthMenuLabel = [];
122 $(aLengthMenu).each(function(){
124 // Label for -1 is "All"
125 aLengthMenuLabel.push("All");
127 aLengthMenuLabel.push(this);
131 // Apply DataTables on the results table
132 dtMemberResults = $("#memberresultst").dataTable($.extend(true, {}, dataTablesDefaults, {
134 'sAjaxSource': "/cgi-bin/koha/svc/members/search",
135 'fnServerData': function(sSource, aoData, fnCallback) {
140 'name': 'searchmember',
141 'value': $("#searchmember_filter").val()
143 'name': 'firstletter',
144 'value': $("#firstletter_filter").val()
146 'name': 'searchfieldstype',
147 'value': $("#searchfieldstype_filter").val()
149 'name': 'searchtype',
150 'value': $("#searchtype_filter").val()
152 'name': 'categorycode',
153 'value': $("#categorycode_filter").val()
155 'name': 'branchcode',
156 'value': $("#branchcode_filter").val()
158 'name': 'name_sorton',
159 'value': 'borrowers.surname borrowers.firstname'
161 'name': 'category_sorton',
162 'value': 'categories.description',
164 'name': 'branch_sorton',
165 'value': 'branches.branchname'
167 'name': 'template_path',
168 'value': 'members/tables/members_results.tt',
175 'success': function(json){
176 // redirect if there is only 1 result.
177 if ( json.aaData.length == 1 ) {
178 var borrowernumber = json.aaData[0].borrowernumber;
179 document.location.href="/cgi-bin/koha/members/moremember.pl?borrowernumber="+borrowernumber;
187 [% IF CAN_user_tools_manage_patron_lists %]
188 { 'mDataProp': 'dt_borrowernumber' },
190 { 'mDataProp': 'dt_cardnumber' },
191 { 'mDataProp': 'dt_name' },
192 { 'mDataProp': 'dt_category' },
193 { 'mDataProp': 'dt_branch' },
194 { 'mDataProp': 'dt_dateexpiry' },
195 { 'mDataProp': 'dt_od_checkouts', 'bSortable': false },
196 { 'mDataProp': 'dt_fines', 'bSortable': false },
197 { 'mDataProp': 'dt_borrowernotes' },
198 { 'mDataProp': 'dt_action', 'bSortable': false }
200 'fnRowCallback': function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
201 /* Center text for 6th column */
202 $("td:eq(5)", nRow).css("text-align", "center");
208 [% IF orderby_cardnumber_0 %]
209 'aaSorting': [[0, 'asc']],
211 'aaSorting': [[1, 'asc']],
213 "aLengthMenu": [aLengthMenu, aLengthMenuLabel],
214 'sPaginationType': 'full_numbers',
215 "iDisplayLength": [% PatronsPerPage %],
220 // Update the string "Results found ..."
221 function update_searched(){
223 searched += "on " + $("#searchfieldstype_filter").find("option:selected").text().toLowerCase() + " fields";
224 if ( $("#searchmember_filter").val() ) {
225 if ( $("#searchtype_filter").val() == 'start_with' ) {
226 searched += _(" starting with ");
228 searched += _(" containing ");
230 searched += $("#searchmember_filter").val();
232 if ( $("#firstletter_filter").val() ) {
233 searched += _(" begin with ") + $("#firstletter_filter").val();
235 if ( $("#categorycode_filter").val() ) {
236 searched += _(" with category ") + $("#categorycode_filter").find("option:selected").text();
238 if ( $("#branchcode_filter").val() ) {
239 searched += _(" in library ") + $("#branchcode_filter").find("option:selected").text();
241 $("#searchpattern").text("for patron " + searched);
246 $("#firstletter_filter").val('');
249 $("#searchresults").show();
250 dtMemberResults.fnDraw();
254 // User has clicked on the Clear button
255 function clearFilters(redraw) {
256 $("#searchform select").val('');
257 $("#firstletter_filter").val('');
258 $("#searchmember_filter").val('');
261 $("#searchresults").show();
262 dtMemberResults.fnDraw();
266 // User has clicked on a letter
267 function filterByFirstLetterSurname(letter) {
269 $("#firstletter_filter").val(letter);
272 $("#searchresults").show();
273 dtMemberResults.fnDraw();
278 <body id="pat_member" class="pat">
279 [% INCLUDE 'header.inc' %]
280 [% INCLUDE 'patron-search.inc' %]
282 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › [% IF ( searching ) %]<a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> › Search results[% ELSE %]Patrons[% END %]</div>
284 <div id="doc3" class="yui-t2">
289 [% IF CAN_user_tools_manage_patron_lists %]
290 <div id="patron_list_dialog" class="dialog alert">
291 Added <span class="patrons-length"></span> patrons to <a></a>.
295 [% INCLUDE 'patron-toolbar.inc' %]
297 <div class="dialog alert">
298 <h3>Cannot add patron</h3>
299 [% IF ( no_branches ) %]
300 <p>There are <strong>no libraries defined</strong>. [% IF ( CAN_user_parameters ) %]Please <a href="/cgi-bin/koha/admin/branches.pl">add a library</a>.[% ELSE %]An administrator must define at least one library.[% END %]</p>
302 [% IF ( no_categories ) %]
303 <p>There are <strong>no patron categories defined</strong>. [% IF ( CAN_user_parameters ) %]Please <a href="/cgi-bin/koha/admin/categorie.pl">add a patron category</a>.[% ELSE %]An administrator must define at least one patron category.[% END %]</p>
309 [% FOREACH letter IN alphabet.split(' ') %]
310 <a style="cursor:pointer" onclick="filterByFirstLetterSurname('[% letter %]');">[% letter %]</a>
314 [% IF ( CAN_user_borrowers && pending_borrower_modifications ) %]
315 <div class="pending-info" id="patron_updates_pending">
316 <a href="/cgi-bin/koha/members/members-update.pl">Patrons requesting modifications</a>:
317 <span class="holdcount"><a href="/cgi-bin/koha/members/members-update.pl">[% pending_borrower_modifications %]</a></span>
321 <div id="searchresults">
322 <div id="searchheader">
323 <h3>Results found <span id="searchpattern">[% IF searchmember %] for '[% searchmember %]'[% END %]</span></h3>
325 [% IF CAN_user_tools_manage_patron_lists %]
326 <div id="searchheader">
328 <a href="javascript:void(0)" onclick="$('.selection').prop('checked', true)">Select all</a>
330 <a href="javascript:void(0)" onclick="$('.selection').prop('checked', false)">Clear all</a>
334 <label for="add_to_patron_list">to:</label>
335 <select id="add_to_patron_list" name="add_to_patron_list">
336 <option value=""></option>
337 [% IF patron_lists %]
338 <optgroup label="Patron lists:">
339 [% FOREACH pl IN patron_lists %]
340 <option value="[% pl.patron_list_id %]">[% pl.name %]</option>
345 <option value="new">[ New list ]</option>
348 <input type="text" id="new_patron_list" name="new_patron_list" id="new_patron_list" />
350 <input id="add_to_patron_list_submit" type="submit" class="submit" value="Save">
356 <table id="memberresultst">
365 <th>OD/Checkouts</th>
378 <form onsubmit="return filter();" id="searchform">
379 <input type="hidden" id="firstletter_filter" value="" />
380 <fieldset class="brief">
384 <label for="searchmember_filter">Search:</label>
385 <input type="text" id="searchmember_filter" value="[% searchmember %]"/>
388 <label for="searchfieldstype_filter">Search fields:</label>
389 <select name="searchfieldstype" id="searchfieldstype_filter">
390 [% IF searchfieldstype == "standard" %]
391 <option selected="selected" value='standard'>Standard</option>
393 <option value='standard'>Standard</option>
395 [% IF searchfieldstype == "email" %]
396 <option selected="selected" value='email'>Email</option>
398 <option value='email'>Email</option>
400 [% IF searchfieldstype == "borrowernumber" %]
401 <option selected="selected" value='borrowernumber'>Borrower number</option>
403 <option value='borrowernumber'>Borrower number</option>
405 [% IF searchfieldstype == "phone" %]
406 <option selected="selected" value='phone'>Phone number</option>
408 <option value='phone'>Phone number</option>
410 [% IF searchfieldstype == "address" %]
411 <option selected="selected" value='address'>Street address</option>
413 <option value='address'>Street address</option>
415 [% IF searchfieldstype == "dateofbirth" %]
416 <option selected="selected" value='dateofbirth'>Date of birth</option>
418 <option value='dateofbirth'>Date of birth</option>
420 [% IF searchfieldstype == "sort1" %]
421 <option selected="selected" value='sort1'>Sort field 1</option>
423 <option value='sort1'>Sort field 1</option>
425 [% IF searchfieldstype == "sort2" %]
426 <option selected="selected" value='sort2'>Sort field 2</option>
428 <option value='sort2'>Sort field 2</option>
433 <label for="searchtype_filter">Search type:</label>
434 <select name="searchtype" id="searchtype_filter">
435 <option value='start_with'>Starts with</option>
436 [% IF searchtype == "contain" %]
437 <option value="contain" selected="selected">Contains</option>
439 <option value="contain" selected="selected">Contains</option>
444 <label for="categorycode_filter">Category:</label>
445 <select id="categorycode_filter">
446 <option value="">Any</option>
447 [% FOREACH cat IN categories %]
448 [% IF cat.selected %]
449 <option selected="selected" value="[% cat.categorycode %]">[% cat.description %]</option>
451 <option value="[% cat.categorycode %]">[% cat.description %]</option>
457 <label for="branchcode_filter">Branch:</label>
458 <select id="branchcode_filter">
459 [% IF branchloop.size != 1 %]
460 <option value="">Any</option>
462 [% FOREACH b IN branchloop %]
464 <option selected="selected" value="[% b.branchcode %]">[% b.branchname %]</option>
466 <option value="[% b.branchcode %]">[% b.branchname %]</option>
472 <fieldset class="action">
473 <input type="submit" value="Search" />
474 <input type="button" value="Clear" onclick="clearFilters(true);" />
481 [% INCLUDE 'members-menu.inc' %]
484 [% INCLUDE 'intranet-bottom.inc' %]