|
Lines 60-68
Link Here
|
| 60 |
<li> |
60 |
<li> |
| 61 |
<label for="searchfieldstype_filter">Search field:</label> |
61 |
<label for="searchfieldstype_filter">Search field:</label> |
| 62 |
<select name="searchfieldstype" id="searchfieldstype_filter"> |
62 |
<select name="searchfieldstype" id="searchfieldstype_filter"> |
| 63 |
[% SET standard = Koha.Preference('DefaultPatronSearchFields') || 'firstname,middle_name,surname,othernames,cardnumber,userid' %] |
63 |
[% SET standard = Koha.Preference('DefaultPatronSearchFields') || 'firstname|middle_name|surname|othernames|cardnumber|userid' %] |
| 64 |
[% default_fields = [ standard, 'surname', 'cardnumber', 'email', 'borrowernumber', 'userid', 'phone', 'address', 'dateofbirth', 'sort1', 'sort2' ] %] |
64 |
[% default_fields = [ standard, 'surname', 'cardnumber', 'email', 'borrowernumber', 'userid', 'phone', 'address', 'dateofbirth', 'sort1', 'sort2' ] %] |
| 65 |
[% search_options = default_fields.merge(standard.split(',')).unique %] |
65 |
[% search_options = default_fields.merge(standard.split('|')).unique %] |
| 66 |
[% FOREACH s_o IN search_options %] |
66 |
[% FOREACH s_o IN search_options %] |
| 67 |
[% display_name = PROCESS patron_fields name=s_o %] |
67 |
[% display_name = PROCESS patron_fields name=s_o %] |
| 68 |
[% NEXT IF !display_name %] |
68 |
[% NEXT IF !display_name %] |
|
Lines 320-332
Link Here
|
| 320 |
let search_type = $("#searchtype_filter").val() || "contain"; |
320 |
let search_type = $("#searchtype_filter").val() || "contain"; |
| 321 |
let search_fields = $("#searchfieldstype_filter").val(); |
321 |
let search_fields = $("#searchfieldstype_filter").val(); |
| 322 |
if ( !search_fields ) { |
322 |
if ( !search_fields ) { |
| 323 |
search_fields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname,middle_name,surname,othernames,cardnumber,userid' | html %]"; |
323 |
search_fields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname|middle_name|surname|othernames|cardnumber|userid' | html %]"; |
| 324 |
} |
324 |
} |
| 325 |
|
325 |
|
| 326 |
let subquery_and = []; |
326 |
let subquery_and = []; |
| 327 |
patterns.forEach(function(pattern,i){ |
327 |
patterns.forEach(function(pattern,i){ |
| 328 |
let sub_or = []; |
328 |
let sub_or = []; |
| 329 |
search_fields.split(',').forEach(function(attr,ii){ |
329 |
search_fields.split('|').forEach(function(attr,ii){ |
| 330 |
sub_or.push({["me."+attr]:{"like":(search_type == "contain" ? "%" : "" ) + pattern + "%"}}); |
330 |
sub_or.push({["me."+attr]:{"like":(search_type == "contain" ? "%" : "" ) + pattern + "%"}}); |
| 331 |
if ( attr == 'dateofbirth' ) { |
331 |
if ( attr == 'dateofbirth' ) { |
| 332 |
try { |
332 |
try { |