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: $("#add_to_patron_list").val(),
63 new_patron_list: $("#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(){
224 var searched = $("#searchfieldstype_filter").find("option:selected").text();
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 += _(" begins 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(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 [% IF Koha.Preference( 'NorwegianPatronDBEnable' ) == 1 %]
297 [% SET nl_search_form_title='Search the Norwegian national patron database' %]
298 [% INCLUDE 'nl-search-form.tt' %]
301 [% INCLUDE 'patron-toolbar.inc' %]
303 <div class="dialog alert">
304 <h3>Cannot add patron</h3>
305 [% IF ( no_branches ) %]
306 <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>
308 [% IF ( no_categories ) %]
309 <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>
315 [% FOREACH letter IN alphabet.split(' ') %]
316 <a style="cursor:pointer" onclick="filterByFirstLetterSurname('[% letter %]');">[% letter %]</a>
320 [% IF ( CAN_user_borrowers && pending_borrower_modifications ) %]
321 <div class="pending-info" id="patron_updates_pending">
322 <a href="/cgi-bin/koha/members/members-update.pl">Patrons requesting modifications</a>:
323 <span class="holdcount"><a href="/cgi-bin/koha/members/members-update.pl">[% pending_borrower_modifications %]</a></span>
327 <div id="searchresults">
328 <div id="searchheader">
329 <h3>Patrons found for: <span id="searchpattern">[% IF searchmember %] for '[% searchmember %]'[% END %]</span></h3>
331 [% IF CAN_user_tools_manage_patron_lists %]
332 <div id="searchheader">
334 <a href="javascript:void(0)" onclick="$('.selection').prop('checked', true)">Select all</a>
336 <a href="javascript:void(0)" onclick="$('.selection').prop('checked', false)">Clear all</a>
340 <label for="add_to_patron_list">to:</label>
341 <select id="add_to_patron_list" name="add_to_patron_list">
342 <option value=""></option>
343 [% IF patron_lists %]
344 <optgroup label="Patron lists:">
345 [% FOREACH pl IN patron_lists %]
346 <option value="[% pl.patron_list_id %]">[% pl.name %]</option>
351 <option value="new">[ New list ]</option>
354 <input type="text" id="new_patron_list" name="new_patron_list" id="new_patron_list" />
356 <input id="add_to_patron_list_submit" type="submit" class="submit" value="Save">
362 <table id="memberresultst">
365 [% IF CAN_user_tools_manage_patron_lists %]
373 <th>OD/Checkouts</th>
386 <form onsubmit="return filter();" id="searchform">
387 <input type="hidden" id="firstletter_filter" value="" />
388 <fieldset class="brief">
392 <label for="searchmember_filter">Search:</label>
393 <input type="text" id="searchmember_filter" value="[% searchmember %]"/>
396 <label for="searchfieldstype_filter">Search fields:</label>
397 <select name="searchfieldstype" id="searchfieldstype_filter">
398 [% IF searchfieldstype == "standard" %]
399 <option selected="selected" value='standard'>Standard</option>
401 <option value='standard'>Standard</option>
403 [% IF searchfieldstype == "email" %]
404 <option selected="selected" value='email'>Email</option>
406 <option value='email'>Email</option>
408 [% IF searchfieldstype == "borrowernumber" %]
409 <option selected="selected" value='borrowernumber'>Borrower number</option>
411 <option value='borrowernumber'>Borrower number</option>
413 [% IF searchfieldstype == "phone" %]
414 <option selected="selected" value='phone'>Phone number</option>
416 <option value='phone'>Phone number</option>
418 [% IF searchfieldstype == "address" %]
419 <option selected="selected" value='address'>Street address</option>
421 <option value='address'>Street address</option>
423 [% IF searchfieldstype == "dateofbirth" %]
424 <option selected="selected" value='dateofbirth'>Date of birth</option>
426 <option value='dateofbirth'>Date of birth</option>
428 [% IF searchfieldstype == "sort1" %]
429 <option selected="selected" value='sort1'>Sort field 1</option>
431 <option value='sort1'>Sort field 1</option>
433 [% IF searchfieldstype == "sort2" %]
434 <option selected="selected" value='sort2'>Sort field 2</option>
436 <option value='sort2'>Sort field 2</option>
441 <label for="searchtype_filter">Search type:</label>
442 <select name="searchtype" id="searchtype_filter">
443 <option value='start_with'>Starts with</option>
444 [% IF searchtype == "contain" %]
445 <option value="contain" selected="selected">Contains</option>
447 <option value="contain" selected="selected">Contains</option>
452 <label for="categorycode_filter">Category:</label>
453 <select id="categorycode_filter">
454 <option value="">Any</option>
455 [% FOREACH cat IN categories %]
456 [% IF cat.selected %]
457 <option selected="selected" value="[% cat.categorycode %]">[% cat.description | html_entity %]</option>
459 <option value="[% cat.categorycode %]">[% cat.description | html_entity %]</option>
465 <label for="branchcode_filter">Library:</label>
466 <select id="branchcode_filter">
467 [% IF branchloop.size != 1 %]
468 <option value="">Any</option>
470 [% FOREACH b IN branchloop %]
472 <option selected="selected" value="[% b.branchcode %]">[% b.branchname %]</option>
474 <option value="[% b.branchcode %]">[% b.branchname %]</option>
480 <fieldset class="action">
481 <input type="submit" value="Search" />
482 <input type="button" value="Clear" onclick="clearFilters(true);" />
489 [% INCLUDE 'members-menu.inc' %]
492 [% INCLUDE 'intranet-bottom.inc' %]