|
Lines 56-61
Link Here
|
| 56 |
[% END %] |
56 |
[% END %] |
| 57 |
</select> |
57 |
</select> |
| 58 |
</li> |
58 |
</li> |
|
|
59 |
[% CASE 'sort1' %] |
| 60 |
<li> |
| 61 |
<label for="sort1_filter">Sort1:</label> |
| 62 |
<select id="sort1_filter"> |
| 63 |
<option value="">Any</option> |
| 64 |
[% FOREACH s1 IN sort1 %] |
| 65 |
<option value="[% s1 | html %]">[% s1 | html %]</option> |
| 66 |
[% END %] |
| 67 |
</select> |
| 68 |
</li> |
| 69 |
[% CASE 'sort2' %] |
| 70 |
<li> |
| 71 |
<label for="sort2_filter">Sort2:</label> |
| 72 |
<select id="sort2_filter"> |
| 73 |
<option value="">Any</option> |
| 74 |
[% FOREACH s2 IN sort2 %] |
| 75 |
<option value="[% s2 | html %]">[% s2 | html %]</option> |
| 76 |
[% END %] |
| 77 |
</select> |
| 78 |
</li> |
| 59 |
[% CASE 'search_field' %] |
79 |
[% CASE 'search_field' %] |
| 60 |
<li> |
80 |
<li> |
| 61 |
<label for="searchfieldstype_filter">Search field:</label> |
81 |
<label for="searchfieldstype_filter">Search field:</label> |
|
Lines 308-318
Link Here
|
| 308 |
return { "like": start_with + "%" } |
328 |
return { "like": start_with + "%" } |
| 309 |
}, |
329 |
}, |
| 310 |
"-and": function(){ |
330 |
"-and": function(){ |
|
|
331 |
let filters = []; |
| 332 |
let f_sort1 = $("#sort1_filter").val(); |
| 333 |
if ( f_sort1 ) { |
| 334 |
filters.push({ |
| 335 |
"me.sort1": f_sort1 |
| 336 |
}); |
| 337 |
} |
| 338 |
let f_sort2 = $("#sort2_filter").val(); |
| 339 |
if ( f_sort2 ) { |
| 340 |
filters.push({ |
| 341 |
"me.sort2": f_sort2 |
| 342 |
}); |
| 343 |
} |
| 344 |
|
| 311 |
let pattern = $("#search_patron_filter").val(); |
345 |
let pattern = $("#search_patron_filter").val(); |
| 312 |
if (!pattern) return ""; |
346 |
if (!pattern) { |
|
|
347 |
if ( filters.length == 0 ) { |
| 348 |
return ""; |
| 349 |
} |
| 350 |
else { |
| 351 |
return filters; |
| 352 |
} |
| 353 |
} |
| 313 |
let patterns = pattern.split(' ').filter(function(s){ return s.length }); |
354 |
let patterns = pattern.split(' ').filter(function(s){ return s.length }); |
| 314 |
|
355 |
|
| 315 |
let filters = []; |
|
|
| 316 |
let search_type = $("#searchtype_filter").val() || "contain"; |
356 |
let search_type = $("#searchtype_filter").val() || "contain"; |
| 317 |
let search_fields = $("#searchfieldstype_filter").val(); |
357 |
let search_fields = $("#searchfieldstype_filter").val(); |
| 318 |
if ( !search_fields ) { |
358 |
if ( !search_fields ) { |
|
Lines 728-733
Link Here
|
| 728 |
if ( $("#branchcode_filter").val() ) { |
768 |
if ( $("#branchcode_filter").val() ) { |
| 729 |
searched += _(" in library ") + $("#branchcode_filter").find("option:selected").text(); |
769 |
searched += _(" in library ") + $("#branchcode_filter").find("option:selected").text(); |
| 730 |
} |
770 |
} |
|
|
771 |
if ( $("#sort1_filter").val() ) { |
| 772 |
searched += _(" with sort1 ") + $("#sort1_filter").find("option:selected").text(); |
| 773 |
} |
| 774 |
if ( $("#sort2_filter").val() ) { |
| 775 |
searched += _(" with sort2 ") + $("#sort2_filter").find("option:selected").text(); |
| 776 |
} |
| 731 |
$("#searchpattern").text(searched); |
777 |
$("#searchpattern").text(searched); |
| 732 |
$("#searchpattern").parent().show(); |
778 |
$("#searchpattern").parent().show(); |
| 733 |
} |
779 |
} |
|
Lines 785-790
Link Here
|
| 785 |
$("#searchtype_filter option[value='contain']").prop("selected", true); |
831 |
$("#searchtype_filter option[value='contain']").prop("selected", true); |
| 786 |
$("#categorycode_filter option:first").prop("selected", true); |
832 |
$("#categorycode_filter option:first").prop("selected", true); |
| 787 |
$("#branchcode_filter option:first").prop("selected", true); |
833 |
$("#branchcode_filter option:first").prop("selected", true); |
|
|
834 |
$("#sort1_filter option:first").prop("selected", true); |
| 835 |
$("#sort2_filter option:first").prop("selected", true); |
| 788 |
$("#firstletter_filter").val(''); |
836 |
$("#firstletter_filter").val(''); |
| 789 |
$("#search_patron_filter").val(''); |
837 |
$("#search_patron_filter").val(''); |
| 790 |
/* remove any search string added by firstletter search */ |
838 |
/* remove any search string added by firstletter search */ |