2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha › Patrons [% IF ( searching ) %]› Search results[% END %]</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
6 [% INCLUDE 'datatables.inc' %]
7 <script type="text/javascript">
9 $(document).ready(function() {
10 $('#add_to_patron_list_submit').attr('disabled', 'disabled');
11 $('#new_patron_list').hide();
13 $('#add_to_patron_list').change(function() {
14 var value = $('#add_to_patron_list').val();
15 if ( value == 'new' ) {
16 $('#new_patron_list').val('')
17 $('#new_patron_list').show();
18 $('#new_patron_list').focus();
20 $('#new_patron_list').hide();
21 $('#add_to_patron_list_submit').removeAttr('disabled');
23 $('#new_patron_list').hide();
24 $('#add_to_patron_list_submit').attr('disabled', 'disabled');
28 $('#new_patron_list').on('input', function() {
29 if ( $('#new_patron_list').val() ) {
30 $('#add_to_patron_list_submit').removeAttr('disabled');
32 $('#add_to_patron_list_submit').attr('disabled', 'disabled');
36 $("#patron_list_dialog").hide();
37 $("#add_to_patron_list_submit").on('click', function(e){
38 if ( $('#add_to_patron_list').val() == 'new' ) {
39 if ( $('#new_patron_list').val() ) {
40 $("#add_to_patron_list option").each(function() {
41 if ( $(this).text() == $('#new_patron_list').val() ) {
42 alert( _("You already have a list with that name!") );
47 alert( _("You must give your new patron list a name!") );
52 if ( $("#memberresultst input:checkbox:checked").length == 0 ) {
53 alert( _("You have not selected any patrons to add to a list!") );
57 var borrowernumbers = [];
58 $("#memberresultst").find("input:checkbox:checked").each(function(){
59 borrowernumbers.push($(this).val());
62 add_to_patron_list: encodeURIComponent($("#add_to_patron_list").val()),
63 new_patron_list: encodeURIComponent($("#new_patron_list").val()),
64 borrowernumbers: borrowernumbers
69 url: '/cgi-bin/koha/svc/members/add_to_list',
70 success: function(data) {
71 $("#patron_list_dialog").show();
72 $("#patron_list_dialog > span.patrons-length").html(data.patrons_added_to_list);
73 $("#patron_list_dialog > a").attr("href", "/cgi-bin/koha/patron_lists/list.pl?patron_list_id=" + data.patron_list.patron_list_id);
74 $("#patron_list_dialog > a").html(data.patron_list.name);
75 if ( $('#add_to_patron_list').val() == 'new' ) {
76 var new_patron_list_added = $("<option>", {
77 value: data.patron_list.patron_list_id,
78 text: data.patron_list.name
80 $("#add_to_patron_list optgroup").append(new_patron_list_added);
81 $("#add_to_patron_list").val(data.patron_list.patron_list_id);
82 $("#new_patron_list").val('');
83 $('#add_to_patron_list').change();
87 alert("an error occurred");
96 $(document).ready(function() {
98 $("#searchmember_filter").val("[% searchmember %]");
100 [% IF searchfieldstype %]
101 $("searchfieldstype_filter").val("[% searchfieldstype %]");
104 $("#searchtype_filter").val("[% searchtype %]");
106 [% IF categorycode %]
107 $("#categorycode_filter").val("[% categorycode %]");
110 $("#branchcode_filter").val("[% branchcode %]");
113 [% IF view != "show_results" %]
114 $("#searchresults").hide();
118 // Build the aLengthMenu
120 [%PatronsPerPage %], 10, 20, 50, 100, -1
122 jQuery.unique(aLengthMenu);
123 aLengthMenu.sort(function( a, b ){
124 // Put "All" at the end
127 } else if ( b == -1 ) {
130 return parseInt(a) < parseInt(b) ? -1 : 1;}
132 var aLengthMenuLabel = [];
133 $(aLengthMenu).each(function(){
135 // Label for -1 is "All"
136 aLengthMenuLabel.push("All");
138 aLengthMenuLabel.push(this);
142 // Apply DataTables on the results table
143 dtMemberResults = $("#memberresultst").dataTable($.extend(true, {}, dataTablesDefaults, {
145 'sAjaxSource': "/cgi-bin/koha/svc/members/search",
146 'fnServerData': function(sSource, aoData, fnCallback) {
151 'name': 'searchmember',
152 'value': $("#searchmember_filter").val()
154 'name': 'firstletter',
155 'value': $("#firstletter_filter").val()
157 'name': 'searchfieldstype',
158 'value': $("#searchfieldstype_filter").val()
160 'name': 'searchtype',
161 'value': $("#searchtype_filter").val()
163 'name': 'categorycode',
164 'value': $("#categorycode_filter").val()
166 'name': 'branchcode',
167 'value': $("#branchcode_filter").val()
169 'name': 'name_sorton',
170 'value': 'borrowers.surname borrowers.firstname'
172 'name': 'category_sorton',
173 'value': 'categories.description',
175 'name': 'branch_sorton',
176 'value': 'branches.branchname'
178 'name': 'template_path',
179 'value': 'members/tables/members_results.tt',
186 'success': function(json){
187 // redirect if there is only 1 result.
188 if ( json.aaData.length == 1 ) {
189 var borrowernumber = json.aaData[0].borrowernumber;
190 document.location.href="/cgi-bin/koha/members/moremember.pl?borrowernumber="+borrowernumber;
198 [% IF CAN_user_tools_manage_patron_lists %]
199 { 'mDataProp': 'dt_borrowernumber', 'bSortable': false },
201 { 'mDataProp': 'dt_cardnumber' },
202 { 'mDataProp': 'dt_name' },
203 { 'mDataProp': 'dt_category' },
204 { 'mDataProp': 'dt_branch' },
205 { 'mDataProp': 'dt_dateexpiry' },
206 { 'mDataProp': 'dt_od_checkouts', 'bSortable': false },
207 { 'mDataProp': 'dt_fines', 'bSortable': false },
208 { 'mDataProp': 'dt_borrowernotes' },
209 { 'mDataProp': 'dt_action', 'bSortable': false }
211 'fnRowCallback': function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
212 /* Center text for 6th column */
213 $("td:eq(5)", nRow).css("text-align", "center");
219 [% IF CAN_user_tools_manage_patron_lists %]
220 'aaSorting': [[2, 'asc']],
222 'aaSorting': [[1, 'asc']],
224 "aLengthMenu": [aLengthMenu, aLengthMenuLabel],
225 'sPaginationType': 'full_numbers',
226 "iDisplayLength": [% PatronsPerPage %],
232 // Update the string "Results found ..."
233 function update_searched(){
234 var searched = $("#searchfieldstype_filter").find("option:selected").text();
235 if ( $("#searchmember_filter").val() ) {
236 if ( $("#searchtype_filter").val() == 'start_with' ) {
237 searched += _(" starting with ");
239 searched += _(" containing ");
241 searched += "'" + $("#searchmember_filter").val() + "'";
243 if ( $("#firstletter_filter").val() ) {
244 searched += _(" begins with ") + "'" + $("#firstletter_filter").val() +"'";
246 if ( $("#categorycode_filter").val() ) {
247 searched += _(" with category ") + "'" + $("#categorycode_filter").find("option:selected").text() + "'";
249 if ( $("#branchcode_filter").val() ) {
250 searched += _(" in library ") + $("#branchcode_filter").find("option:selected").text();
252 $("#searchpattern").text(searched);
257 $("#firstletter_filter").val('');
260 $("#searchresults").show();
261 dtMemberResults.fnDraw();
265 // User has clicked on the Clear button
266 function clearFilters(redraw) {
267 $("#searchform select").val('');
268 $("#firstletter_filter").val('');
269 $("#searchmember_filter").val('');
272 $("#searchresults").show();
273 dtMemberResults.fnDraw();
277 // User has clicked on a letter
278 function filterByFirstLetterSurname(letter) {
280 $("#firstletter_filter").val(letter);
283 $("#searchresults").show();
284 dtMemberResults.fnDraw();
289 <body id="pat_member" class="pat">
290 [% INCLUDE 'header.inc' %]
291 [% INCLUDE 'patron-search.inc' %]
293 <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>
295 <div id="doc3" class="yui-t2">
300 [% IF CAN_user_tools_manage_patron_lists %]
301 <div id="patron_list_dialog" class="dialog alert">
302 Added <span class="patrons-length"></span> patrons to <a></a>.
306 [% IF Koha.Preference( 'NorwegianPatronDBEnable' ) == 1 %]
307 [% SET nl_search_form_title='Search the Norwegian national patron database' %]
308 [% INCLUDE 'nl-search-form.tt' %]
311 [% INCLUDE 'patron-toolbar.inc' %]
313 <div class="dialog alert">
314 <h3>Cannot add patron</h3>
315 [% IF ( no_branches ) %]
316 <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>
318 [% IF ( no_categories ) %]
319 <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>
325 [% FOREACH letter IN alphabet.split(' ') %]
326 <a style="cursor:pointer" onclick="filterByFirstLetterSurname('[% letter %]');">[% letter %]</a>
330 [% IF ( CAN_user_borrowers && pending_borrower_modifications ) %]
331 <div class="pending-info" id="patron_updates_pending">
332 <a href="/cgi-bin/koha/members/members-update.pl">Patrons requesting modifications</a>:
333 <span class="holdcount"><a href="/cgi-bin/koha/members/members-update.pl">[% pending_borrower_modifications %]</a></span>
337 <div id="searchresults">
338 <div id="searchheader">
339 <h3>Patrons found for: <span id="searchpattern">[% IF searchmember %] for '[% searchmember %]'[% END %]</span></h3>
341 [% IF CAN_user_tools_manage_patron_lists %]
342 <div id="searchheader">
344 <a href="javascript:void(0)" onclick="$('.selection').prop('checked', true)">Select all</a>
346 <a href="javascript:void(0)" onclick="$('.selection').prop('checked', false)">Clear all</a>
349 <label for="add_to_patron_list">Add selected patrons to:</label>
350 <select id="add_to_patron_list" name="add_to_patron_list">
351 <option value=""></option>
352 [% IF patron_lists %]
353 <optgroup label="Patron lists:">
354 [% FOREACH pl IN patron_lists %]
355 <option value="[% pl.patron_list_id %]">[% pl.name %]</option>
360 <option value="new">[ New list ]</option>
363 <input type="text" id="new_patron_list" name="new_patron_list" id="new_patron_list" />
365 <input id="add_to_patron_list_submit" type="submit" class="submit" value="Save">
371 <table id="memberresultst">
374 [% IF CAN_user_tools_manage_patron_lists %]
382 <th>OD/Checkouts</th>
395 <form onsubmit="return filter();" id="searchform">
396 <input type="hidden" id="firstletter_filter" value="" />
397 <fieldset class="brief">
401 <label for="searchmember_filter">Search:</label>
402 <input type="text" id="searchmember_filter" value="[% searchmember %]"/>
405 <label for="searchfieldstype_filter">Search fields:</label>
406 <select name="searchfieldstype" id="searchfieldstype_filter">
407 [% IF searchfieldstype == "standard" %]
408 <option selected="selected" value='standard'>Standard</option>
410 <option value='standard'>Standard</option>
412 [% IF searchfieldstype == "email" %]
413 <option selected="selected" value='email'>Email</option>
415 <option value='email'>Email</option>
417 [% IF searchfieldstype == "borrowernumber" %]
418 <option selected="selected" value='borrowernumber'>Borrower number</option>
420 <option value='borrowernumber'>Borrower number</option>
422 [% IF searchfieldstype == "userid" %]
423 <option selected="selected" value='userid'>Username</option>
425 <option value='userid'>Username</option>
427 [% IF searchfieldstype == "phone" %]
428 <option selected="selected" value='phone'>Phone number</option>
430 <option value='phone'>Phone number</option>
432 [% IF searchfieldstype == "address" %]
433 <option selected="selected" value='address'>Street address</option>
435 <option value='address'>Street address</option>
437 [% IF searchfieldstype == "dateofbirth" %]
438 <option selected="selected" value='dateofbirth'>Date of birth</option>
440 <option value='dateofbirth'>Date of birth</option>
442 [% IF searchfieldstype == "sort1" %]
443 <option selected="selected" value='sort1'>Sort field 1</option>
445 <option value='sort1'>Sort field 1</option>
447 [% IF searchfieldstype == "sort2" %]
448 <option selected="selected" value='sort2'>Sort field 2</option>
450 <option value='sort2'>Sort field 2</option>
455 <label for="searchtype_filter">Search type:</label>
456 <select name="searchtype" id="searchtype_filter">
457 <option value='start_with'>Starts with</option>
458 [% IF searchtype == "contain" %]
459 <option value="contain" selected="selected">Contains</option>
461 <option value="contain" selected="selected">Contains</option>
466 <label for="categorycode_filter">Category:</label>
467 <select id="categorycode_filter">
468 <option value="">Any</option>
469 [% FOREACH cat IN categories %]
470 [% IF cat.selected %]
471 <option selected="selected" value="[% cat.categorycode %]">[% cat.description | html_entity %]</option>
473 <option value="[% cat.categorycode %]">[% cat.description | html_entity %]</option>
479 <label for="branchcode_filter">Library:</label>
480 <select id="branchcode_filter">
481 [% IF branchloop.size != 1 %]
482 <option value="">Any</option>
484 [% FOREACH b IN branchloop %]
486 <option selected="selected" value="[% b.branchcode %]">[% b.branchname %]</option>
488 <option value="[% b.branchcode %]">[% b.branchname %]</option>
494 <fieldset class="action">
495 <input type="submit" value="Search" />
496 <input type="button" value="Clear" onclick="clearFilters(true);" />
503 [% INCLUDE 'members-menu.inc' %]
506 [% INCLUDE 'intranet-bottom.inc' %]