2 [% USE ColumnsSettings %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha › Patrons [% IF ( searching ) %]› Search results[% END %]</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
9 [% INCLUDE 'datatables.inc' %]
10 [% INCLUDE 'columns_settings.inc' %]
11 <script type="text/javascript">
13 $(document).ready(function() {
14 $('#add_to_patron_list_submit').attr('disabled', 'disabled');
15 $('#new_patron_list').hide();
17 $('#add_to_patron_list').change(function() {
18 var value = $('#add_to_patron_list').val();
19 if ( value == 'new' ) {
20 $('#new_patron_list').val('')
21 $('#new_patron_list').show();
22 $('#new_patron_list').focus();
24 $('#new_patron_list').hide();
25 $('#add_to_patron_list_submit').removeAttr('disabled');
27 $('#new_patron_list').hide();
28 $('#add_to_patron_list_submit').attr('disabled', 'disabled');
32 $('#new_patron_list').on('input', function() {
33 if ( $('#new_patron_list').val() ) {
34 $('#add_to_patron_list_submit').removeAttr('disabled');
36 $('#add_to_patron_list_submit').attr('disabled', 'disabled');
40 $("#patron_list_dialog").hide();
41 $("#add_to_patron_list_submit").on('click', function(e){
42 if ( $('#add_to_patron_list').val() == 'new' ) {
43 if ( $('#new_patron_list').val() ) {
44 $("#add_to_patron_list option").each(function() {
45 if ( $(this).text() == $('#new_patron_list').val() ) {
46 alert( _("You already have a list with that name!") );
51 alert( _("You must give your new patron list a name!") );
56 if ( $("#memberresultst input:checkbox:checked").length == 0 ) {
57 alert( _("You have not selected any patrons to add to a list!") );
61 var borrowernumbers = [];
62 $("#memberresultst").find("input:checkbox:checked").each(function(){
63 borrowernumbers.push($(this).val());
66 add_to_patron_list: $("#add_to_patron_list").val(),
67 new_patron_list: $("#new_patron_list").val(),
68 borrowernumbers: borrowernumbers
73 url: '/cgi-bin/koha/svc/members/add_to_list',
74 success: function(data) {
75 $("#patron_list_dialog").show();
76 $("#patron_list_dialog > span.patrons-length").html(data.patrons_added_to_list);
77 $("#patron_list_dialog > a").attr("href", "/cgi-bin/koha/patron_lists/list.pl?patron_list_id=" + data.patron_list.patron_list_id);
78 $("#patron_list_dialog > a").html(data.patron_list.name);
79 if ( $('#add_to_patron_list').val() == 'new' ) {
80 var new_patron_list_added = $("<option>", {
81 value: data.patron_list.patron_list_id,
82 text: data.patron_list.name
84 $("#add_to_patron_list optgroup").append(new_patron_list_added);
85 $("#add_to_patron_list").val(data.patron_list.patron_list_id);
86 $("#new_patron_list").val('');
87 $('#add_to_patron_list').change();
91 alert("an error occurred");
100 $(document).ready(function() {
101 [% IF searchmember %]
102 $("#searchmember_filter").val("[% searchmember %]");
104 [% IF searchfieldstype %]
105 $("searchfieldstype_filter").val("[% searchfieldstype %]");
108 $("#searchtype_filter").val("[% searchtype %]");
110 [% IF categorycode %]
111 $("#categorycode_filter").val("[% categorycode_filter %]");
114 $("#branchcode_filter").val("[% branchcode_filter %]");
117 [% IF view != "show_results" %]
118 $("#searchresults").hide();
122 // Build the aLengthMenu
124 [%PatronsPerPage %], 10, 20, 50, 100, -1
126 jQuery.unique(aLengthMenu);
127 aLengthMenu.sort(function( a, b ){
128 // Put "All" at the end
131 } else if ( b == -1 ) {
134 return parseInt(a) < parseInt(b) ? -1 : 1;}
136 var aLengthMenuLabel = [];
137 $(aLengthMenu).each(function(){
139 // Label for -1 is "All"
140 aLengthMenuLabel.push("All");
142 aLengthMenuLabel.push(this);
146 // Apply DataTables on the results table
147 var columns_settings = [% ColumnsSettings.GetColumns( 'members', 'member', 'memberresultst', 'json' ) %];
148 dtMemberResults = KohaTable("#memberresultst", {
150 'sAjaxSource': "/cgi-bin/koha/svc/members/search",
151 'fnServerData': function(sSource, aoData, fnCallback) {
156 'name': 'searchmember',
157 'value': $("#searchmember_filter").val()
159 'name': 'firstletter',
160 'value': $("#firstletter_filter").val()
162 'name': 'searchfieldstype',
163 'value': $("#searchfieldstype_filter").val()
165 'name': 'searchtype',
166 'value': $("#searchtype_filter").val()
168 'name': 'categorycode',
169 'value': $("#categorycode_filter").val()
171 'name': 'branchcode',
172 'value': $("#branchcode_filter").val()
174 'name': 'name_sorton',
175 'value': 'borrowers.surname borrowers.firstname'
177 'name': 'category_sorton',
178 'value': 'categories.description',
180 'name': 'branch_sorton',
181 'value': 'branches.branchname'
183 'name': 'template_path',
184 'value': 'members/tables/members_results.tt',
191 'success': function(json){
192 // redirect if there is only 1 result.
193 if ( json.aaData.length == 1 ) {
194 var borrowernumber = json.aaData[0].borrowernumber;
195 document.location.href="/cgi-bin/koha/members/moremember.pl?borrowernumber="+borrowernumber;
203 [% IF CAN_user_tools_manage_patron_lists %]
204 { 'mDataProp': 'dt_borrowernumber', 'bSortable': false },
206 { 'mDataProp': 'dt_cardnumber' },
207 { 'mDataProp': 'dt_name' },
208 { 'mDataProp': 'dt_category' },
209 { 'mDataProp': 'dt_branch' },
210 { 'mDataProp': 'dt_dateexpiry' },
211 { 'mDataProp': 'dt_od_checkouts', 'bSortable': false },
212 { 'mDataProp': 'dt_fines', 'bSortable': false },
213 { 'mDataProp': 'dt_borrowernotes' },
214 { 'mDataProp': 'dt_action', 'bSortable': false }
216 'fnRowCallback': function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
217 /* Center text for 6th column */
218 $("td:eq(5)", nRow).css("text-align", "center");
224 [% IF CAN_user_tools_manage_patron_lists %]
225 'aaSorting': [[1, 'asc']],
227 'aaSorting': [[0, 'asc']],
229 "aLengthMenu": [aLengthMenu, aLengthMenuLabel],
230 'sPaginationType': 'full_numbers',
231 "iDisplayLength": [% PatronsPerPage %],
233 }, columns_settings);
237 // Update the string "Results found ..."
238 function update_searched(){
239 var searched = $("#searchfieldstype_filter").find("option:selected").text();
240 if ( $("#searchmember_filter").val() ) {
241 if ( $("#searchtype_filter").val() == 'start_with' ) {
242 searched += _(" starting with ");
244 searched += _(" containing ");
246 searched += "'" + $("#searchmember_filter").val() + "'";
248 if ( $("#firstletter_filter").val() ) {
249 searched += _(" begins with ") + "'" + $("#firstletter_filter").val() +"'";
251 if ( $("#categorycode_filter").val() ) {
252 searched += _(" with category ") + "'" + $("#categorycode_filter").find("option:selected").text() + "'";
254 if ( $("#branchcode_filter").val() ) {
255 searched += _(" in library ") + $("#branchcode_filter").find("option:selected").text();
257 $("#searchpattern").text(searched);
262 $("#firstletter_filter").val('');
265 $("#searchresults").show();
266 dtMemberResults.fnDraw();
270 // User has clicked on the Clear button
271 function clearFilters(redraw) {
272 $("#searchform select").val('');
273 $("#firstletter_filter").val('');
274 $("#searchmember_filter").val('');
277 $("#searchresults").show();
278 dtMemberResults.fnDraw();
282 // User has clicked on a letter
283 function filterByFirstLetterSurname(letter) {
285 $("#firstletter_filter").val(letter);
288 $("#searchresults").show();
289 dtMemberResults.fnDraw();
294 <body id="pat_member" class="pat">
295 [% INCLUDE 'header.inc' %]
296 [% INCLUDE 'patron-search.inc' %]
298 <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>
300 <div id="doc3" class="yui-t2">
305 [% IF CAN_user_tools_manage_patron_lists %]
306 <div id="patron_list_dialog" class="dialog alert">
307 Added <span class="patrons-length"></span> patrons to <a></a>.
311 [% IF Koha.Preference( 'NorwegianPatronDBEnable' ) == 1 %]
312 [% SET nl_search_form_title='Search the Norwegian national patron database' %]
313 [% INCLUDE 'nl-search-form.tt' %]
316 [% INCLUDE 'patron-toolbar.inc' %]
318 <div class="dialog alert">
319 <h3>Cannot add patron</h3>
320 [% IF ( no_branches ) %]
321 <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>
323 [% IF ( no_categories ) %]
324 <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>
330 [% FOREACH letter IN alphabet.split(' ') %]
331 <a style="cursor:pointer" onclick="filterByFirstLetterSurname('[% letter %]');">[% letter %]</a>
335 [% IF ( CAN_user_borrowers && pending_borrower_modifications ) %]
336 <div class="pending-info" id="patron_updates_pending">
337 <a href="/cgi-bin/koha/members/members-update.pl">Patrons requesting modifications</a>:
338 <span class="holdcount"><a href="/cgi-bin/koha/members/members-update.pl">[% pending_borrower_modifications %]</a></span>
342 <div id="searchresults">
343 <div id="searchheader">
344 <h3>Patrons found for: <span id="searchpattern">[% IF searchmember %] for '[% searchmember %]'[% END %]</span></h3>
346 [% IF CAN_user_tools_manage_patron_lists %]
347 <div id="searchheader">
349 <a href="javascript:void(0)" onclick="$('.selection').prop('checked', true)">Select all</a>
351 <a href="javascript:void(0)" onclick="$('.selection').prop('checked', false)">Clear all</a>
354 <label for="add_to_patron_list">Add selected patrons to:</label>
355 <select id="add_to_patron_list" name="add_to_patron_list">
356 <option value=""></option>
357 [% IF patron_lists %]
358 <optgroup label="Patron lists:">
359 [% FOREACH pl IN patron_lists %]
360 <option value="[% pl.patron_list_id %]">[% pl.name %]</option>
365 <option value="new">[ New list ]</option>
368 <input type="text" id="new_patron_list" name="new_patron_list" id="new_patron_list" />
370 <input id="add_to_patron_list_submit" type="submit" class="submit" value="Save">
376 <table id="memberresultst">
379 [% IF CAN_user_tools_manage_patron_lists %]
387 <th>OD/Checkouts</th>
400 <form onsubmit="return filter();" id="searchform">
401 <input type="hidden" id="firstletter_filter" value="" />
402 <fieldset class="brief">
406 <label for="searchmember_filter">Search:</label>
407 <input type="text" id="searchmember_filter" value="[% searchmember %]"/>
410 <label for="searchfieldstype_filter">Search fields:</label>
411 <select name="searchfieldstype" id="searchfieldstype_filter">
412 [% IF searchfieldstype == "standard" %]
413 <option selected="selected" value='standard'>Standard</option>
415 <option value='standard'>Standard</option>
417 [% IF searchfieldstype == "email" %]
418 <option selected="selected" value='email'>Email</option>
420 <option value='email'>Email</option>
422 [% IF searchfieldstype == "borrowernumber" %]
423 <option selected="selected" value='borrowernumber'>Borrower number</option>
425 <option value='borrowernumber'>Borrower number</option>
427 [% IF searchfieldstype == "userid" %]
428 <option selected="selected" value='userid'>Username</option>
430 <option value='userid'>Username</option>
432 [% IF searchfieldstype == "phone" %]
433 <option selected="selected" value='phone'>Phone number</option>
435 <option value='phone'>Phone number</option>
437 [% IF searchfieldstype == "address" %]
438 <option selected="selected" value='address'>Street address</option>
440 <option value='address'>Street address</option>
442 [% IF searchfieldstype == "dateofbirth" %]
443 <option selected="selected" value='dateofbirth'>Date of birth</option>
445 <option value='dateofbirth'>Date of birth</option>
447 [% IF searchfieldstype == "sort1" %]
448 <option selected="selected" value='sort1'>Sort field 1</option>
450 <option value='sort1'>Sort field 1</option>
452 [% IF searchfieldstype == "sort2" %]
453 <option selected="selected" value='sort2'>Sort field 2</option>
455 <option value='sort2'>Sort field 2</option>
460 <label for="searchtype_filter">Search type:</label>
461 <select name="searchtype" id="searchtype_filter">
462 <option value='start_with'>Starts with</option>
463 [% IF searchtype == "contain" %]
464 <option value="contain" selected="selected">Contains</option>
466 <option value="contain" selected="selected">Contains</option>
471 <label for="categorycode_filter">Category:</label>
472 [% SET categories = Categories.all( selected => categorycode_filter ) %]
473 <select id="categorycode_filter">
474 <option value="">Any</option>
475 [% FOREACH cat IN categories %]
476 [% IF cat.selected %]
477 <option selected="selected" value="[% cat.categorycode %]">[% cat.description %]</option>
479 <option value="[% cat.categorycode %]">[% cat.description %]</option>
485 <label for="branchcode_filter">Library:</label>
486 [% SET branches = Branches.all( selected => branchcode_filter ) %]
487 <select id="branchcode_filter">
488 [% IF branches.size != 1 %]
489 <option value="">Any</option>
491 [% FOREACH b IN branches %]
493 <option selected="selected" value="[% b.branchcode %]">[% b.branchname %]</option>
495 <option value="[% b.branchcode %]">[% b.branchname %]</option>
501 <fieldset class="action">
502 <input type="submit" value="Search" />
503 <input type="button" value="Clear" onclick="clearFilters(true);" />
510 [% INCLUDE 'members-menu.inc' %]
513 [% INCLUDE 'intranet-bottom.inc' %]