2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha › Patron search</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
6 [% INCLUDE 'datatables.inc' %]
8 <script type="text/javascript">
12 $(document).ready(function(){
16 [% IF view != "show_results" %]
17 $("#searchresults").hide();
21 $("#searchmember_filter").on('keyup', function(){
24 // Apply DataTables on the results table
25 dtMemberResults = $("#memberresultst").dataTable($.extend(true, {}, dataTablesDefaults, {
27 'sAjaxSource': "/cgi-bin/koha/svc/members/search",
28 'fnServerData': function(sSource, aoData, fnCallback) {
33 'name': 'searchmember',
34 'value': $("#searchmember_filter").val()
36 'name': 'name_sorton',
37 'value': 'borrowers.surname borrowers.firstname'
39 'name': 'category_sorton',
40 'value': 'categories.description',
42 'name': 'branch_sorton',
43 'value': 'branches.branchname'
45 'name': 'template_path',
46 'value': '[% json_template %]',
48 'name': 'selection_type',
49 'value': '[% selection_type %]',
51 [% IF patrons_with_acq_perm_only %]
53 'name': 'has_permission',
54 'value': 'acquisition.order_manage',
63 'success': function(json){
69 [% FOR column IN columns %]
70 [% IF column == 'action' %]
71 { 'mDataProp': 'dt_action', 'bSortable': false }
72 [% ELSIF column == 'address' %]
73 { 'mDataProp': 'dt_address', 'bSortable': false }
75 { 'mDataProp': 'dt_[% column %]' }
77 [% UNLESS loop.last %],[% END %]
81 [% IF patrons_with_acq_perm_only %]
84 'sPaginationType': 'full_numbers',
85 "iDisplayLength": [% Koha.Preference('PatronsPerPage') %],
90 dtMemberResults.fnAddFilters("filter", 750);
93 var delay = (function(){
95 return function(callback, ms){
97 timer = setTimeout(callback, ms);
104 $("#searchresults").show();
106 if ( $("#searchmember_filter").val().length > 0 ) {
108 dtMemberResults.fnDraw();
115 // modify parent window owner element
116 [% IF selection_type == 'add' %]
117 function add_user(borrowernumber, borrowername) {
118 var p = window.opener;
119 // In one place (serials/routing.tt), the page is reload on every add
120 // We have to wait for the page to be there
121 function wait_for_opener () {
122 if ( ! $(opener.document).find('body').size() ) {
123 setTimeout(wait_for_opener, 500);
125 [%# Note that add_user could sent data instead of borrowername too %]
128 if ( p.add_user(borrowernumber, borrowername) < 0 ) {
129 $("#error").html(_("Borrower '%s' is already in the list.").format(borrowername));
132 $("#info").html(_("Borrower '%s' added.").format(borrowername));
139 [% ELSIF selection_type == 'select' %]
140 function select_user(borrowernumber, data) {
141 var p = window.opener;
142 p.select_user(borrowernumber, data);
151 <div id="patron_search" class="yui-t7">
155 <h3>Search for patron</h3>
157 <label for="searchmember_filter">Search:</label>
158 <input type="text" id="searchmember_filter" value="[% searchmember %]"/>
160 [% IF patrons_with_acq_perm_only %]
161 <div class="hint">Only staff with superlibrarian or acquisitions permissions (or order_manage permission if granular permissions are enabled) are returned in the search results</div>
164 <div id="info" class="dialog message"></div>
165 <div id="error" class="dialog alert"></div>
167 <div id="searchresults">
168 <table id="memberresultst">
171 [% FOR column IN columns %]
173 [% CASE 'cardnumber' %]<th>Card</th>
174 [% CASE 'dateofbirth' %]<th>Date of birth</th>
175 [% CASE 'address' %]<th>Address</th>
176 [% CASE 'name' %]<th>Name</th>
177 [% CASE 'branch' %]<th>Library</th>
178 [% CASE 'category' %]<th>Category</th>
179 [% CASE 'action' %]<th> </th>
188 <div id="closewindow"><a href="#" class="close">Close</a></div>
191 [% INCLUDE 'intranet-bottom.inc' %]