Lines 55-66
Link Here
|
55 |
[% END %] |
55 |
[% END %] |
56 |
</select> |
56 |
</select> |
57 |
</li> |
57 |
</li> |
|
|
58 |
[% CASE 'sort1' %] |
59 |
<li> |
60 |
<label for="sort1_filter">Sort1:</label> |
61 |
<select id="sort1_filter"> |
62 |
<option value="">Any</option> |
63 |
[% FOREACH s1 IN sort1 %] |
64 |
<option value="[% s1 | html %]">[% s1 | html %]</option> |
65 |
[% END %] |
66 |
</select> |
67 |
</li> |
68 |
[% CASE 'sort2' %] |
69 |
<li> |
70 |
<label for="sort2_filter">Sort2:</label> |
71 |
<select id="sort2_filter"> |
72 |
<option value="">Any</option> |
73 |
[% FOREACH s2 IN sort2 %] |
74 |
<option value="[% s2 | html %]">[% s2 | html %]</option> |
75 |
[% END %] |
76 |
</select> |
77 |
</li> |
58 |
[% CASE 'search_field' %] |
78 |
[% CASE 'search_field' %] |
59 |
<li> |
79 |
<li> |
60 |
<label for="searchfieldstype_filter">Search field:</label> |
80 |
<label for="searchfieldstype_filter">Search field:</label> |
61 |
<select name="searchfieldstype" id="searchfieldstype_filter"> |
81 |
<select name="searchfieldstype" id="searchfieldstype_filter"> |
62 |
[% pref_fields = Koha.Preference('DefaultPatronSearchFields').split(',') %] |
82 |
[% pref_fields = Koha.Preference('DefaultPatronSearchFields').split(',') %] |
63 |
[% default_fields = [ 'firstname,surname,othernames,cardnumber,userid', 'surname', 'cardnumber', 'email', 'borrowernumber', 'userid', 'phone', 'address', 'dateofbirth', 'sort1', 'sort2' ] %] |
83 |
[% default_fields = [ 'firstname,surname,othernames,cardnumber,userid', 'surname', 'cardnumber', 'email', 'borrowernumber', 'userid', 'phone', 'address', 'dateofbirth' ] %] |
64 |
[% search_options = default_fields.merge(pref_fields).unique %] |
84 |
[% search_options = default_fields.merge(pref_fields).unique %] |
65 |
[% FOREACH s_o IN search_options %] |
85 |
[% FOREACH s_o IN search_options %] |
66 |
[% display_name = PROCESS patron_fields name=s_o %] |
86 |
[% display_name = PROCESS patron_fields name=s_o %] |
Lines 295-304
Link Here
|
295 |
return { "like": start_with + "%" } |
315 |
return { "like": start_with + "%" } |
296 |
}, |
316 |
}, |
297 |
"-and": function(){ |
317 |
"-and": function(){ |
|
|
318 |
let filters = []; |
319 |
let f_sort1 = $("#sort1_filter").val(); |
320 |
if ( f_sort1 ) { |
321 |
filters.push({ |
322 |
"me.sort1": f_sort1 |
323 |
}); |
324 |
} |
325 |
let f_sort2 = $("#sort2_filter").val(); |
326 |
if ( f_sort2 ) { |
327 |
filters.push({ |
328 |
"me.sort2": f_sort2 |
329 |
}); |
330 |
} |
331 |
|
298 |
let filter = $("#search_patron_filter").val(); |
332 |
let filter = $("#search_patron_filter").val(); |
299 |
if (!filter) return ""; |
333 |
if (!filter) { |
|
|
334 |
if ( filters.length == 0 ) { |
335 |
return ""; |
336 |
} |
337 |
else { |
338 |
return filters; |
339 |
} |
340 |
} |
300 |
|
341 |
|
301 |
let filters = []; |
|
|
302 |
let search_type = $("#searchtype_filter").val() || "contain"; |
342 |
let search_type = $("#searchtype_filter").val() || "contain"; |
303 |
let search_fields = $("#searchfieldstype_filter").val(); |
343 |
let search_fields = $("#searchfieldstype_filter").val(); |
304 |
if ( !search_fields ) { |
344 |
if ( !search_fields ) { |
Lines 710-715
Link Here
|
710 |
if ( $("#branchcode_filter").val() ) { |
750 |
if ( $("#branchcode_filter").val() ) { |
711 |
searched += _(" in library ") + $("#branchcode_filter").find("option:selected").text(); |
751 |
searched += _(" in library ") + $("#branchcode_filter").find("option:selected").text(); |
712 |
} |
752 |
} |
|
|
753 |
if ( $("#sort1_filter").val() ) { |
754 |
searched += _(" with sort1 ") + $("#sort1_filter").find("option:selected").text(); |
755 |
} |
756 |
if ( $("#sort2_filter").val() ) { |
757 |
searched += _(" with sort2 ") + $("#sort2_filter").find("option:selected").text(); |
758 |
} |
713 |
$("#searchpattern").text(searched); |
759 |
$("#searchpattern").text(searched); |
714 |
$("#searchpattern").parent().show(); |
760 |
$("#searchpattern").parent().show(); |
715 |
} |
761 |
} |
Lines 745-750
Link Here
|
745 |
$("#searchtype_filter option[value='contain']").prop("selected", true); |
791 |
$("#searchtype_filter option[value='contain']").prop("selected", true); |
746 |
$("#categorycode_filter option:first").prop("selected", true); |
792 |
$("#categorycode_filter option:first").prop("selected", true); |
747 |
$("#branchcode_filter option:first").prop("selected", true); |
793 |
$("#branchcode_filter option:first").prop("selected", true); |
|
|
794 |
$("#sort1_filter option:first").prop("selected", true); |
795 |
$("#sort2_filter option:first").prop("selected", true); |
748 |
$("#firstletter_filter").val(''); |
796 |
$("#firstletter_filter").val(''); |
749 |
$("#search_patron_filter").val(''); |
797 |
$("#search_patron_filter").val(''); |
750 |
/* remove any search string added by firstletter search */ |
798 |
/* remove any search string added by firstletter search */ |