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', 'bSortable': false },
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 CAN_user_tools_manage_patron_lists %]
209 'aaSorting': [[1, 'asc']],
211 'aaSorting': [[0, 'asc']],
213 "aLengthMenu": [aLengthMenu, aLengthMenuLabel],
214 'sPaginationType': 'full_numbers',
215 "iDisplayLength": [% PatronsPerPage %],
221 // Update the string "Results found ..."
222 function update_searched(){
224 searched += "on " + $("#searchfieldstype_filter").find("option:selected").text().toLowerCase() + " fields";
225 if ( $("#searchmember_filter").val() ) {
226 if ( $("#searchtype_filter").val() == 'start_with' ) {
227 searched += _(" starting with ");
229 searched += _(" containing ");
231 searched += $("#searchmember_filter").val();
233 if ( $("#firstletter_filter").val() ) {
234 searched += _(" begin with ") + $("#firstletter_filter").val();
236 if ( $("#categorycode_filter").val() ) {
237 searched += _(" with category ") + $("#categorycode_filter").find("option:selected").text();
239 if ( $("#branchcode_filter").val() ) {
240 searched += _(" in library ") + $("#branchcode_filter").find("option:selected").text();
242 $("#searchpattern").text("for patron " + searched);
247 $("#firstletter_filter").val('');
250 $("#searchresults").show();
251 dtMemberResults.fnDraw();
255 // User has clicked on the Clear button
256 function clearFilters(redraw) {
257 $("#searchform select").val('');
258 $("#firstletter_filter").val('');
259 $("#searchmember_filter").val('');
262 $("#searchresults").show();
263 dtMemberResults.fnDraw();
267 // User has clicked on a letter
268 function filterByFirstLetterSurname(letter) {
270 $("#firstletter_filter").val(letter);
273 $("#searchresults").show();
274 dtMemberResults.fnDraw();
279 <body id="pat_member" class="pat">
280 [% INCLUDE 'header.inc' %]
281 [% INCLUDE 'patron-search.inc' %]
283 <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>
285 <div id="doc3" class="yui-t2">
290 [% IF CAN_user_tools_manage_patron_lists %]
291 <div id="patron_list_dialog" class="dialog alert">
292 Added <span class="patrons-length"></span> patrons to <a></a>.
296 [% INCLUDE 'patron-toolbar.inc' %]
298 <div class="dialog alert">
299 <h3>Cannot add patron</h3>
300 [% IF ( no_branches ) %]
301 <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>
303 [% IF ( no_categories ) %]
304 <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>
310 [% FOREACH letter IN alphabet.split(' ') %]
311 <a style="cursor:pointer" onclick="filterByFirstLetterSurname('[% letter %]');">[% letter %]</a>
315 [% IF ( CAN_user_borrowers && pending_borrower_modifications ) %]
316 <div class="pending-info" id="patron_updates_pending">
317 <a href="/cgi-bin/koha/members/members-update.pl">Patrons requesting modifications</a>:
318 <span class="holdcount"><a href="/cgi-bin/koha/members/members-update.pl">[% pending_borrower_modifications %]</a></span>
322 <div id="searchresults">
323 <div id="searchheader">
324 <h3>Results found <span id="searchpattern">[% IF searchmember %] for '[% searchmember %]'[% END %]</span></h3>
326 [% IF CAN_user_tools_manage_patron_lists %]
327 <div id="searchheader">
329 <a href="javascript:void(0)" onclick="$('.selection').prop('checked', true)">Select all</a>
331 <a href="javascript:void(0)" onclick="$('.selection').prop('checked', false)">Clear all</a>
335 <label for="add_to_patron_list">to:</label>
336 <select id="add_to_patron_list" name="add_to_patron_list">
337 <option value=""></option>
338 [% IF patron_lists %]
339 <optgroup label="Patron lists:">
340 [% FOREACH pl IN patron_lists %]
341 <option value="[% pl.patron_list_id %]">[% pl.name %]</option>
346 <option value="new">[ New list ]</option>
349 <input type="text" id="new_patron_list" name="new_patron_list" id="new_patron_list" />
351 <input id="add_to_patron_list_submit" type="submit" class="submit" value="Save">
357 <table id="memberresultst">
366 <th>OD/Checkouts</th>
379 <form onsubmit="return filter();" id="searchform">
380 <input type="hidden" id="firstletter_filter" value="" />
381 <fieldset class="brief">
385 <label for="searchmember_filter">Search:</label>
386 <input type="text" id="searchmember_filter" value="[% searchmember %]"/>
389 <label for="searchfieldstype_filter">Search fields:</label>
390 <select name="searchfieldstype" id="searchfieldstype_filter">
391 [% IF searchfieldstype == "standard" %]
392 <option selected="selected" value='standard'>Standard</option>
394 <option value='standard'>Standard</option>
396 [% IF searchfieldstype == "email" %]
397 <option selected="selected" value='email'>Email</option>
399 <option value='email'>Email</option>
401 [% IF searchfieldstype == "borrowernumber" %]
402 <option selected="selected" value='borrowernumber'>Borrower number</option>
404 <option value='borrowernumber'>Borrower number</option>
406 [% IF searchfieldstype == "phone" %]
407 <option selected="selected" value='phone'>Phone number</option>
409 <option value='phone'>Phone number</option>
411 [% IF searchfieldstype == "address" %]
412 <option selected="selected" value='address'>Street address</option>
414 <option value='address'>Street address</option>
416 [% IF searchfieldstype == "dateofbirth" %]
417 <option selected="selected" value='dateofbirth'>Date of birth</option>
419 <option value='dateofbirth'>Date of birth</option>
421 [% IF searchfieldstype == "sort1" %]
422 <option selected="selected" value='sort1'>Sort field 1</option>
424 <option value='sort1'>Sort field 1</option>
426 [% IF searchfieldstype == "sort2" %]
427 <option selected="selected" value='sort2'>Sort field 2</option>
429 <option value='sort2'>Sort field 2</option>
434 <label for="searchtype_filter">Search type:</label>
435 <select name="searchtype" id="searchtype_filter">
436 <option value='start_with'>Starts with</option>
437 [% IF searchtype == "contain" %]
438 <option value="contain" selected="selected">Contains</option>
440 <option value="contain" selected="selected">Contains</option>
445 <label for="categorycode_filter">Category:</label>
446 <select id="categorycode_filter">
447 <option value="">Any</option>
448 [% FOREACH cat IN categories %]
449 [% IF cat.selected %]
450 <option selected="selected" value="[% cat.categorycode %]">[% cat.description | html_entity %]</option>
452 <option value="[% cat.categorycode %]">[% cat.description | html_entity %]</option>
458 <label for="branchcode_filter">Library:</label>
459 <select id="branchcode_filter">
460 [% IF branchloop.size != 1 %]
461 <option value="">Any</option>
463 [% FOREACH b IN branchloop %]
465 <option selected="selected" value="[% b.branchcode %]">[% b.branchname %]</option>
467 <option value="[% b.branchcode %]">[% b.branchname %]</option>
473 <fieldset class="action">
474 <input type="submit" value="Search" />
475 <input type="button" value="Clear" onclick="clearFilters(true);" />
482 [% INCLUDE 'members-menu.inc' %]
485 [% INCLUDE 'intranet-bottom.inc' %]