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);
77 alert("an error occurred");
86 $(document).ready(function() {
88 $("#searchmember_filter").val("[% searchmember %]");
90 [% IF searchfieldstype %]
91 $("searchfieldstype_filter").val("[% searchfieldstype %]");
94 $("#searchtype_filter").val("[% searchtype %]");
97 $("#categorycode_filter").val("[% categorycode %]");
100 $("#branchcode_filter").val("[% branchcode %]");
103 [% IF view != "show_results" %]
104 $("#searchresults").hide();
108 // Build the aLengthMenu
110 [%PatronsPerPage %], 10, 20, 50, 100, -1
112 jQuery.unique(aLengthMenu);
113 aLengthMenu.sort(function( a, b ){
114 // Put "All" at the end
117 } else if ( b == -1 ) {
120 return parseInt(a) < parseInt(b) ? -1 : 1;}
122 var aLengthMenuLabel = [];
123 $(aLengthMenu).each(function(){
125 // Label for -1 is "All"
126 aLengthMenuLabel.push("All");
128 aLengthMenuLabel.push(this);
132 // Apply DataTables on the results table
133 dtMemberResults = $("#memberresultst").dataTable($.extend(true, {}, dataTablesDefaults, {
135 'sAjaxSource': "/cgi-bin/koha/svc/members/search",
136 'fnServerData': function(sSource, aoData, fnCallback) {
141 'name': 'searchmember',
142 'value': $("#searchmember_filter").val()
144 'name': 'firstletter',
145 'value': $("#firstletter_filter").val()
147 'name': 'searchfieldstype',
148 'value': $("#searchfieldstype_filter").val()
150 'name': 'searchtype',
151 'value': $("#searchtype_filter").val()
153 'name': 'categorycode',
154 'value': $("#categorycode_filter").val()
156 'name': 'branchcode',
157 'value': $("#branchcode_filter").val()
159 'name': 'name_sorton',
160 'value': 'borrowers.surname borrowers.firstname'
162 'name': 'category_sorton',
163 'value': 'categories.description',
165 'name': 'branch_sorton',
166 'value': 'branches.branchname'
168 'name': 'template_path',
169 'value': 'members/tables/members_results.tt',
176 'success': function(json){
177 // redirect if there is only 1 result.
178 if ( json.aaData.length == 1 ) {
179 var borrowernumber = json.aaData[0].borrowernumber;
180 document.location.href="/cgi-bin/koha/members/moremember.pl?borrowernumber="+borrowernumber;
188 [% IF CAN_user_tools_manage_patron_lists %]
189 { 'mDataProp': 'dt_borrowernumber', 'bSortable': false },
191 { 'mDataProp': 'dt_cardnumber' },
192 { 'mDataProp': 'dt_name' },
193 { 'mDataProp': 'dt_category' },
194 { 'mDataProp': 'dt_branch' },
195 { 'mDataProp': 'dt_dateexpiry' },
196 { 'mDataProp': 'dt_od_checkouts', 'bSortable': false },
197 { 'mDataProp': 'dt_fines', 'bSortable': false },
198 { 'mDataProp': 'dt_borrowernotes' },
199 { 'mDataProp': 'dt_action', 'bSortable': false }
201 'fnRowCallback': function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
202 /* Center text for 6th column */
203 $("td:eq(5)", nRow).css("text-align", "center");
209 [% IF CAN_user_tools_manage_patron_lists %]
210 'aaSorting': [[1, 'asc']],
212 'aaSorting': [[0, 'asc']],
214 "aLengthMenu": [aLengthMenu, aLengthMenuLabel],
215 'sPaginationType': 'full_numbers',
216 "iDisplayLength": [% PatronsPerPage %],
222 // Update the string "Results found ..."
223 function update_searched(){
225 searched += "on " + $("#searchfieldstype_filter").find("option:selected").text().toLowerCase() + " fields";
226 if ( $("#searchmember_filter").val() ) {
227 if ( $("#searchtype_filter").val() == 'start_with' ) {
228 searched += _(" starting with ");
230 searched += _(" containing ");
232 searched += $("#searchmember_filter").val();
234 if ( $("#firstletter_filter").val() ) {
235 searched += _(" begin with ") + $("#firstletter_filter").val();
237 if ( $("#categorycode_filter").val() ) {
238 searched += _(" with category ") + $("#categorycode_filter").find("option:selected").text();
240 if ( $("#branchcode_filter").val() ) {
241 searched += _(" in library ") + $("#branchcode_filter").find("option:selected").text();
243 $("#searchpattern").text("for patron " + searched);
248 $("#firstletter_filter").val('');
251 $("#searchresults").show();
252 dtMemberResults.fnDraw();
256 // User has clicked on the Clear button
257 function clearFilters(redraw) {
258 $("#searchform select").val('');
259 $("#firstletter_filter").val('');
260 $("#searchmember_filter").val('');
263 $("#searchresults").show();
264 dtMemberResults.fnDraw();
268 // User has clicked on a letter
269 function filterByFirstLetterSurname(letter) {
271 $("#firstletter_filter").val(letter);
274 $("#searchresults").show();
275 dtMemberResults.fnDraw();
280 <body id="pat_member" class="pat">
281 [% INCLUDE 'header.inc' %]
282 [% INCLUDE 'patron-search.inc' %]
284 <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>
286 <div id="doc3" class="yui-t2">
291 [% IF CAN_user_tools_manage_patron_lists %]
292 <div id="patron_list_dialog" class="dialog alert">
293 Added <span class="patrons-length"></span> patrons to <a></a>.
297 [% IF Koha.Preference( 'NorwegianPatronDBEnable' ) == 1 %]
298 [% SET nl_search_form_title='Search the Norwegian national patron database' %]
299 [% INCLUDE 'nl-search-form.tt' %]
302 [% INCLUDE 'patron-toolbar.inc' %]
304 <div class="dialog alert">
305 <h3>Cannot add patron</h3>
306 [% IF ( no_branches ) %]
307 <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>
309 [% IF ( no_categories ) %]
310 <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>
316 [% FOREACH letter IN alphabet.split(' ') %]
317 <a style="cursor:pointer" onclick="filterByFirstLetterSurname('[% letter %]');">[% letter %]</a>
321 [% IF ( CAN_user_borrowers && pending_borrower_modifications ) %]
322 <div class="pending-info" id="patron_updates_pending">
323 <a href="/cgi-bin/koha/members/members-update.pl">Patrons requesting modifications</a>:
324 <span class="holdcount"><a href="/cgi-bin/koha/members/members-update.pl">[% pending_borrower_modifications %]</a></span>
328 <div id="searchresults">
329 <div id="searchheader">
330 <h3>Results found <span id="searchpattern">[% IF searchmember %] for '[% searchmember %]'[% END %]</span></h3>
332 [% IF CAN_user_tools_manage_patron_lists %]
333 <div id="searchheader">
335 <a href="javascript:void(0)" onclick="$('.selection').prop('checked', true)">Select all</a>
337 <a href="javascript:void(0)" onclick="$('.selection').prop('checked', false)">Clear all</a>
341 <label for="add_to_patron_list">to:</label>
342 <select id="add_to_patron_list" name="add_to_patron_list">
343 <option value=""></option>
344 [% IF patron_lists %]
345 <optgroup label="Patron lists:">
346 [% FOREACH pl IN patron_lists %]
347 <option value="[% pl.patron_list_id %]">[% pl.name %]</option>
352 <option value="new">[ New list ]</option>
355 <input type="text" id="new_patron_list" name="new_patron_list" id="new_patron_list" />
357 <input id="add_to_patron_list_submit" type="submit" class="submit" value="Save">
363 <table id="memberresultst">
366 [% IF CAN_user_tools_manage_patron_lists %]
374 <th>OD/Checkouts</th>
387 <form onsubmit="return filter();" id="searchform">
388 <input type="hidden" id="firstletter_filter" value="" />
389 <fieldset class="brief">
393 <label for="searchmember_filter">Search:</label>
394 <input type="text" id="searchmember_filter" value="[% searchmember %]"/>
397 <label for="searchfieldstype_filter">Search fields:</label>
398 <select name="searchfieldstype" id="searchfieldstype_filter">
399 [% IF searchfieldstype == "standard" %]
400 <option selected="selected" value='standard'>Standard</option>
402 <option value='standard'>Standard</option>
404 [% IF searchfieldstype == "email" %]
405 <option selected="selected" value='email'>Email</option>
407 <option value='email'>Email</option>
409 [% IF searchfieldstype == "borrowernumber" %]
410 <option selected="selected" value='borrowernumber'>Borrower number</option>
412 <option value='borrowernumber'>Borrower number</option>
414 [% IF searchfieldstype == "phone" %]
415 <option selected="selected" value='phone'>Phone number</option>
417 <option value='phone'>Phone number</option>
419 [% IF searchfieldstype == "address" %]
420 <option selected="selected" value='address'>Street address</option>
422 <option value='address'>Street address</option>
424 [% IF searchfieldstype == "dateofbirth" %]
425 <option selected="selected" value='dateofbirth'>Date of birth</option>
427 <option value='dateofbirth'>Date of birth</option>
429 [% IF searchfieldstype == "sort1" %]
430 <option selected="selected" value='sort1'>Sort field 1</option>
432 <option value='sort1'>Sort field 1</option>
434 [% IF searchfieldstype == "sort2" %]
435 <option selected="selected" value='sort2'>Sort field 2</option>
437 <option value='sort2'>Sort field 2</option>
442 <label for="searchtype_filter">Search type:</label>
443 <select name="searchtype" id="searchtype_filter">
444 <option value='start_with'>Starts with</option>
445 [% IF searchtype == "contain" %]
446 <option value="contain" selected="selected">Contains</option>
448 <option value="contain" selected="selected">Contains</option>
453 <label for="categorycode_filter">Category:</label>
454 <select id="categorycode_filter">
455 <option value="">Any</option>
456 [% FOREACH cat IN categories %]
457 [% IF cat.selected %]
458 <option selected="selected" value="[% cat.categorycode %]">[% cat.description | html_entity %]</option>
460 <option value="[% cat.categorycode %]">[% cat.description | html_entity %]</option>
466 <label for="branchcode_filter">Library:</label>
467 <select id="branchcode_filter">
468 [% IF branchloop.size != 1 %]
469 <option value="">Any</option>
471 [% FOREACH b IN branchloop %]
473 <option selected="selected" value="[% b.branchcode %]">[% b.branchname %]</option>
475 <option value="[% b.branchcode %]">[% b.branchname %]</option>
481 <fieldset class="action">
482 <input type="submit" value="Search" />
483 <input type="button" value="Clear" onclick="clearFilters(true);" />
490 [% INCLUDE 'members-menu.inc' %]
493 [% INCLUDE 'intranet-bottom.inc' %]