Lines 8-13
Link Here
|
8 |
[% USE To %] |
8 |
[% USE To %] |
9 |
[% USE AuthorisedValues %] |
9 |
[% USE AuthorisedValues %] |
10 |
[% SET search_results_block_id = 'searchresults' %] |
10 |
[% SET search_results_block_id = 'searchresults' %] |
|
|
11 |
[% SET av_bsort1 = AuthorisedValues.Get('Bsort1') %] |
12 |
[% SET av_bsort2 = AuthorisedValues.Get('Bsort2') %] |
11 |
|
13 |
|
12 |
[%# Display a simple form %] |
14 |
[%# Display a simple form %] |
13 |
[% BLOCK patron_search_filters_simple %] |
15 |
[% BLOCK patron_search_filters_simple %] |
Lines 188-195
Link Here
|
188 |
[% CASE 'phone' %]<th>Phone</th> |
190 |
[% CASE 'phone' %]<th>Phone</th> |
189 |
[% CASE 'checkouts' %]<th>Checkouts</th> |
191 |
[% CASE 'checkouts' %]<th>Checkouts</th> |
190 |
[% CASE 'account_balance' %]<th>Fines</th> |
192 |
[% CASE 'account_balance' %]<th>Fines</th> |
191 |
[% CASE 'sort1' %]<th>Sort 1</th> |
193 |
[% CASE 'sort1' %] |
192 |
[% CASE 'sort2' %]<th>Sort 2</th> |
194 |
[% IF av_bsort1.size %] |
|
|
195 |
<th data-filter="av_bsort1">Sort 1</th> |
196 |
[% ELSE %] |
197 |
<th>Sort 1</th> |
198 |
[% END %] |
199 |
[% CASE 'sort2' %] |
200 |
[% IF av_bsort2.size %] |
201 |
<th data-filter="av_bsort2">Sort 2</th> |
202 |
[% ELSE %] |
203 |
<th>Sort 2</th> |
204 |
[% END %] |
193 |
[% CASE 'action' %]<th class="noExport"> </th> |
205 |
[% CASE 'action' %]<th class="noExport"> </th> |
194 |
[% END %] |
206 |
[% END %] |
195 |
[% END %] |
207 |
[% END %] |
Lines 257-262
Link Here
|
257 |
return map; |
269 |
return map; |
258 |
}, {}); |
270 |
}, {}); |
259 |
|
271 |
|
|
|
272 |
|
273 |
const av_bsort1= [% To.json(av_bsort1) | $raw %].map( e => { |
274 |
e['_id'] = e.authorised_value; |
275 |
e['_str'] = e.lib; |
276 |
return e; |
277 |
}); |
278 |
var av_bsort1_map = av_bsort1.reduce((map, e) => { |
279 |
map[e._id] = e; |
280 |
return map; |
281 |
}, {}); |
282 |
const av_bsort2= [% To.json(av_bsort2) | $raw %].map( e => { |
283 |
e['_id'] = e.authorised_value; |
284 |
e['_str'] = e.lib; |
285 |
return e; |
286 |
}); |
287 |
var av_bsort2_map = av_bsort2.reduce((map, e) => { |
288 |
map[e._id] = e; |
289 |
return map; |
290 |
}, {}); |
291 |
|
260 |
[% IF Koha.Preference('ExtendedPatronAttributes') %] |
292 |
[% IF Koha.Preference('ExtendedPatronAttributes') %] |
261 |
[% SET extended_attribute_types = [ ExtendedAttributeTypes.codes( staff_searchable => 1, searched_by_default => 1 ) ] %] |
293 |
[% SET extended_attribute_types = [ ExtendedAttributeTypes.codes( staff_searchable => 1, searched_by_default => 1 ) ] %] |
262 |
var extended_attribute_types = [% To.json(extended_attribute_types || []) | $raw %]; |
294 |
var extended_attribute_types = [% To.json(extended_attribute_types || []) | $raw %]; |
Lines 319-327
Link Here
|
319 |
let patron_search_url = '/api/v1/patrons'; |
351 |
let patron_search_url = '/api/v1/patrons'; |
320 |
[% END %] |
352 |
[% END %] |
321 |
|
353 |
|
322 |
const av_bsort1= new Map([% To.json(AuthorisedValues.Get('Bsort1')) | $raw %].map( av => [av.authorised_value, av.lib])); |
|
|
323 |
const av_bsort2= new Map([% To.json(AuthorisedValues.Get('Bsort2')) | $raw %].map( av => [av.authorised_value, av.lib])); |
324 |
|
325 |
$(document).ready(function(){ |
354 |
$(document).ready(function(){ |
326 |
|
355 |
|
327 |
let parent_block = $("#[% search_results_block_id | html %]"); |
356 |
let parent_block = $("#[% search_results_block_id | html %]"); |
Lines 637-644
Link Here
|
637 |
"searchable": true, |
666 |
"searchable": true, |
638 |
"orderable": true, |
667 |
"orderable": true, |
639 |
"render": function( data, type, row, meta ) { |
668 |
"render": function( data, type, row, meta ) { |
640 |
let bsort1_lib = av_bsort1.get( data.toString() ) || data; |
669 |
let bsort1 = av_bsort1_map[data.toString()]; |
641 |
return escape_str( bsort1_lib ); |
670 |
return escape_str(bsort1 ? bsort1.lib : data); |
642 |
} |
671 |
} |
643 |
} |
672 |
} |
644 |
|
673 |
|
Lines 648-655
Link Here
|
648 |
"searchable": true, |
677 |
"searchable": true, |
649 |
"orderable": true, |
678 |
"orderable": true, |
650 |
"render": function( data, type, row, meta ) { |
679 |
"render": function( data, type, row, meta ) { |
651 |
let bsort2_lib = av_bsort2.get( data.toString() ) || data; |
680 |
let bsort2 = av_bsort2_map[data.toString()]; |
652 |
return escape_str( bsort2_lib ); |
681 |
return escape_str(bsort2 ? bsort2.lib : data); |
653 |
} |
682 |
} |
654 |
} |
683 |
} |
655 |
|
684 |
|
656 |
- |
|
|