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="[% interface %]/[% theme %]/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 // Apply DataTables on the results table
22 dtMemberResults = $("#memberresultst").dataTable($.extend(true, {}, dataTablesDefaults, {
24 'sAjaxSource': "/cgi-bin/koha/svc/members/search",
25 'fnServerData': function(sSource, aoData, fnCallback) {
30 'name': 'searchmember',
31 'value': $("#searchmember_filter").val()
33 'name': 'firstletter',
34 'value': $("#firstletter_filter").val()
36 'name': 'categorycode',
37 'value': $("#categorycode_filter").val()
40 'value': $("#branchcode_filter").val()
42 'name': 'name_sorton',
43 'value': 'borrowers.surname borrowers.firstname'
45 'name': 'category_sorton',
46 'value': 'categories.description',
48 'name': 'branch_sorton',
49 'value': 'branches.branchname'
51 'name': 'template_path',
52 'value': '[% json_template %]',
54 'name': 'selection_type',
55 'value': '[% selection_type %]',
57 [% IF patrons_with_acq_perm_only %]
59 'name': 'has_permission',
60 'value': 'acquisition.order_manage',
69 'success': function(json){
75 [% FOR column IN columns %]
76 [% IF column == 'action' %]
77 { 'mDataProp': 'dt_action', 'bSortable': false, 'sClass': 'actions' }
78 [% ELSIF column == 'address' %]
79 { 'mDataProp': 'dt_address', 'bSortable': false }
81 { 'mDataProp': 'dt_[% column %]' }
83 [% UNLESS loop.last %],[% END %]
87 [% IF patrons_with_acq_perm_only %]
90 'sPaginationType': 'full_numbers',
91 "iDisplayLength": [% Koha.Preference('PatronsPerPage') %],
93 'aaSorting': [[[% aaSorting || 0 %], 'asc']],
98 $("#searchform").on('submit', filter);
99 $(".filterByLetter").on("click",function(e){
101 filterByFirstLetterSurname($(this).text());
107 $("#firstletter_filter").val('');
108 $("#searchresults").show();
109 dtMemberResults.fnDraw();
113 // User has clicked on a letter
114 function filterByFirstLetterSurname(letter) {
115 $("#firstletter_filter").val(letter);
117 $("#searchresults").show();
118 dtMemberResults.fnDraw();
122 // modify parent window owner element
123 [% IF selection_type == 'add' %]
124 function add_user(borrowernumber, borrowername) {
125 var p = window.opener;
126 // In one place (serials/routing.tt), the page is reload on every add
127 // We have to wait for the page to be there
128 function wait_for_opener () {
129 if ( ! $(opener.document).find('body').size() ) {
130 setTimeout(wait_for_opener, 500);
132 [%# Note that add_user could sent data instead of borrowername too %]
135 if ( p.add_user(borrowernumber, borrowername) < 0 ) {
136 $("#error").html(_("Borrower '%s' is already in the list.").format(borrowername));
139 $("#info").html(_("Borrower '%s' added.").format(borrowername));
146 [% ELSIF selection_type == 'select' %]
147 function select_user(borrowernumber, data) {
148 var p = window.opener;
149 p.select_user(borrowernumber, data);
157 <body id="common_patron_search" class="common">
158 <div id="patron_search" class="yui-t7">
162 <form id="searchform">
163 <fieldset class="brief">
164 <h3>Search for patron</h3>
167 <label for="searchmember_filter">Search:</label>
168 <input type="text" id="searchmember_filter" value="[% searchmember %]"/>
171 <label for="categorycode_filter">Category:</label>
172 <select id="categorycode_filter">
173 <option value="">Any</option>
174 [% FOREACH category IN categories %]
175 <option value="[% category.categorycode %]">[% category.description %]</option>
180 <label for="branchcode_filter">Library:</label>
181 <select id="branchcode_filter">
182 [% IF branches.size != 1 %]
183 <option value="">Any</option>
185 [% FOREACH branch IN branches %]
186 <option value="[% branch.branchcode %]">[% branch.branchname %]</option>
191 <fieldset class="action">
192 <input class="btn btn-default" type="submit" value="Search" />
197 [% IF patrons_with_acq_perm_only %]
198 <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>
203 [% FOREACH letter IN alphabet.split(' ') %]
204 <a href="#" class="filterByLetter">[% letter %]</a>
208 <div id="info" class="dialog message"></div>
209 <div id="error" class="dialog alert"></div>
211 <input type="hidden" id="firstletter_filter" value="" />
212 <div id="searchresults">
213 <table id="memberresultst">
216 [% FOR column IN columns %]
218 [% CASE 'cardnumber' %]<th>Card</th>
219 [% CASE 'dateofbirth' %]<th>Date of birth</th>
220 [% CASE 'address' %]<th>Address</th>
221 [% CASE 'name' %]<th>Name</th>
222 [% CASE 'branch' %]<th>Library</th>
223 [% CASE 'category' %]<th>Category</th>
224 [% CASE 'dateexpiry' %]<th>Expires on</td>
225 [% CASE 'borrowernotes' %]<th>Notes</th>
226 [% CASE 'action' %]<th> </th>
235 <div id="closewindow"><a href="#" class="btn btn-default close">Close</a></div>
238 [% INCLUDE 'intranet-bottom.inc' %]