View | Details | Raw Unified | Return to bug 34094
Collapse All | Expand All

(-)a/circ/circulation.pl (-2 lines)
Lines 150-157 my @failedreturns = $query->multi_param('failedreturn'); Link Here
150
our %return_failed = ();
150
our %return_failed = ();
151
for (@failedreturns) { $return_failed{$_} = 1; }
151
for (@failedreturns) { $return_failed{$_} = 1; }
152
152
153
my $searchtype = $query->param('searchtype') || q{contain};
154
155
my $branch = C4::Context->userenv->{'branch'};
153
my $branch = C4::Context->userenv->{'branch'};
156
154
157
for my $barcode ( @$barcodes ) {
155
for my $barcode ( @$barcodes ) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/member-search-box.inc (-5 / +6 lines)
Lines 4-9 Link Here
4
[% USE Koha %]
4
[% USE Koha %]
5
[% PROCESS 'patronfields.inc' %]
5
[% PROCESS 'patronfields.inc' %]
6
[% IF CAN_user_borrowers_edit_borrowers %]
6
[% IF CAN_user_borrowers_edit_borrowers %]
7
    [%- SET searchtype = Koha.Preference('DefaultPatronSearchMethod') -%]
7
    [% IF( bs_tab_active ) %]
8
    [% IF( bs_tab_active ) %]
8
        <div id="patron_search" role="tabpanel" class="tab-pane active">
9
        <div id="patron_search" role="tabpanel" class="tab-pane active">
9
    [% ELSE %]
10
    [% ELSE %]
Lines 36-47 Link Here
36
                <div>
37
                <div>
37
                    <label for="searchtype" class="control-label">Search type</label>
38
                    <label for="searchtype" class="control-label">Search type</label>
38
                    <select name="searchtype" id="searchtype" class="form-control">
39
                    <select name="searchtype" id="searchtype" class="form-control">
39
                        [% IF searchtype == 'start_with' %]
40
                        [% IF searchtype == 'starts_with' %]
40
                            <option value='start_with'>Starts with</option>
41
                            <option value='starts_with' selected="selected">Starts with</option>
41
                            <option value='contain'>Contains</option>
42
                            <option value='contains'>Contains</option>
42
                        [% ELSE %]
43
                        [% ELSE %]
43
                            <option value='start_with'>Starts with</option>
44
                            <option value='starts_with'>Starts with</option>
44
                            <option value='contain'>Contains</option>
45
                            <option value='contains' selected="selected">Contains</option>
45
                        [% END %]
46
                        [% END %]
46
                    </select>
47
                    </select>
47
                </div>
48
                </div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc (-11 / +12 lines)
Lines 20-26 Link Here
20
[%# - branch: select library list %]
20
[%# - branch: select library list %]
21
[%# - category: select patron category list %]
21
[%# - category: select patron category list %]
22
[%# - search_field: select patron field list %]
22
[%# - search_field: select patron field list %]
23
[%# - search_type: select 'contain' or 'start with' %]
23
[%# - search_type: select 'contains' or 'starts with' %]
24
[%- SET searchtype = Koha.Preference('DefaultPatronSearchMethod') -%]
24
[% BLOCK patron_search_filters %]
25
[% BLOCK patron_search_filters %]
25
    <form id="patron_search_form">
26
    <form id="patron_search_form">
26
        <fieldset class="brief">
27
        <fieldset class="brief">
Lines 64-75 Link Here
64
                        <li>
65
                        <li>
65
                            <label for="searchtype_filter">Search type:</label>
66
                            <label for="searchtype_filter">Search type:</label>
66
                            <select name="searchtype" id="searchtype_filter">
67
                            <select name="searchtype" id="searchtype_filter">
67
                              [% IF searchtype == "start_with" %]
68
                              [% IF searchtype == "starts_with" %]
68
                                <option value='start_with' selected="selected">Starts with</option>
69
                                <option value='starts_with' selected="selected">Starts with</option>
69
                                <option value="contain">Contains</option>
70
                                <option value="contains">Contains</option>
70
                              [% ELSE %]
71
                              [% ELSE %]
71
                                <option value='start_with'>Starts with</option>
72
                                <option value='starts_with'>Starts with</option>
72
                                <option value="contain" selected="selected">Contains</option>
73
                                <option value="contains" selected="selected">Contains</option>
73
                              [% END %]
74
                              [% END %]
74
                            </select>
75
                            </select>
75
                        </li>
76
                        </li>
Lines 303-309 Link Here
303
                    let patterns = pattern.split(/[\s,]+/).filter(function(s){ return s.length });
304
                    let patterns = pattern.split(/[\s,]+/).filter(function(s){ return s.length });
304
305
305
                    let filters = [];
306
                    let filters = [];
306
                    let search_type = $("#searchtype_filter").val() || "contain";
307
                    let search_type = $("#searchtype_filter").val() || "contains";
307
                    let search_fields = $("#searchfieldstype_filter").val();
308
                    let search_fields = $("#searchfieldstype_filter").val();
308
                    if ( !search_fields ) {
309
                    if ( !search_fields ) {
309
                        search_fields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname,middle_name,surname,othernames,cardnumber,userid' | html %]";
310
                        search_fields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname,middle_name,surname,othernames,cardnumber,userid' | html %]";
Lines 313-319 Link Here
313
                    patterns.forEach(function(pattern,i){
314
                    patterns.forEach(function(pattern,i){
314
                        let sub_or = [];
315
                        let sub_or = [];
315
                        search_fields.split(',').forEach(function(attr,ii){
316
                        search_fields.split(',').forEach(function(attr,ii){
316
                            sub_or.push({["me."+attr]:{"like":(search_type == "contain" ? "%" : "" ) + pattern + "%"}});
317
                            sub_or.push({["me."+attr]:{"like":(search_type == "contains" ? "%" : "" ) + pattern + "%"}});
317
                            if ( attr == 'dateofbirth' ) {
318
                            if ( attr == 'dateofbirth' ) {
318
                                try {
319
                                try {
319
                                    let d = $date_to_rfc3339(pattern);
320
                                    let d = $date_to_rfc3339(pattern);
Lines 332-338 Link Here
332
                        patterns.forEach(function(pattern,i){
333
                        patterns.forEach(function(pattern,i){
333
                            let sub_or = [];
334
                            let sub_or = [];
334
                            sub_or.push({
335
                            sub_or.push({
335
                                "extended_attributes.value": { "like": "%" + pattern + (search_type == "contain" ? "%" : "" )},
336
                                "extended_attributes.value": { "like": "%" + pattern + (search_type == "contains" ? "%" : "" )},
336
                                "extended_attributes.code": extended_attribute_types
337
                                "extended_attributes.code": extended_attribute_types
337
                            });
338
                            });
338
                            subquery_and.push(sub_or);
339
                            subquery_and.push(sub_or);
Lines 717-723 Link Here
717
        function update_search_description(){
718
        function update_search_description(){
718
            var searched = $("#searchfieldstype_filter").find("option:selected").text();
719
            var searched = $("#searchfieldstype_filter").find("option:selected").text();
719
            if ( $("#search_patron_filter").val() ) {
720
            if ( $("#search_patron_filter").val() ) {
720
                if ( $("#searchtype_filter").val() == 'start_with' ) {
721
                if ( $("#searchtype_filter").val() == 'starts_with' ) {
721
                    searched += _(" starting with ");
722
                    searched += _(" starting with ");
722
                } else {
723
                } else {
723
                    searched += _(" containing ");
724
                    searched += _(" containing ");
Lines 787-793 Link Here
787
788
788
        function clearFilters() {
789
        function clearFilters() {
789
            $("#searchfieldstype_filter option:first").prop("selected", true);
790
            $("#searchfieldstype_filter option:first").prop("selected", true);
790
            $("#searchtype_filter option[value='contain']").prop("selected", true);
791
            $("#searchtype_filter option[value='[% searchtype || 'contains' | html %]']").prop("selected", true);
791
            $("#categorycode_filter option:first").prop("selected", true);
792
            $("#categorycode_filter option:first").prop("selected", true);
792
            $("#branchcode_filter option:first").prop("selected", true);
793
            $("#branchcode_filter option:first").prop("selected", true);
793
            $("#firstletter_filter").val('');
794
            $("#firstletter_filter").val('');
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt (-1 / +2 lines)
Lines 9-14 Link Here
9
[% SET libraries = Branches.all %]
9
[% SET libraries = Branches.all %]
10
[% SET categories = Categories.all.unblessed %]
10
[% SET categories = Categories.all.unblessed %]
11
[% SET columns = ['cardnumber', 'name-address', 'dateofbirth', 'branch', 'category', 'dateexpiry', 'checkouts', 'account_balance', 'borrowernotes', 'action'] %]
11
[% SET columns = ['cardnumber', 'name-address', 'dateofbirth', 'branch', 'category', 'dateexpiry', 'checkouts', 'account_balance', 'borrowernotes', 'action'] %]
12
[% SET searchtype = Koha.Preference('DefaultPatronSearchMethod') %]
12
[% PROCESS 'patron-search.inc' %]
13
[% PROCESS 'patron-search.inc' %]
13
[% INCLUDE 'doc-head-open.inc' %]
14
[% INCLUDE 'doc-head-open.inc' %]
14
<title>Patrons[% IF ( searching ) %] &rsaquo; Search results[% END %] &rsaquo; Koha</title>
15
<title>Patrons[% IF ( searching ) %] &rsaquo; Search results[% END %] &rsaquo; Koha</title>
Lines 282-288 Link Here
282
                $("searchfieldstype_filter").val("[% searchfieldstype | html %]");
283
                $("searchfieldstype_filter").val("[% searchfieldstype | html %]");
283
            [% END %]
284
            [% END %]
284
            [% IF searchtype %]
285
            [% IF searchtype %]
285
                $("#searchtype_filter").val("[% searchtype | html %]");
286
                $("#searchtype_filter option[value='[% searchtype | html %]']").prop("selected", true);
286
            [% END %]
287
            [% END %]
287
            [% IF categorycode_filter %]
288
            [% IF categorycode_filter %]
288
                $("#categorycode_filter").val("[% categorycode_filter | html %]");
289
                $("#categorycode_filter").val("[% categorycode_filter | html %]");
(-)a/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js (-1 / +1 lines)
Lines 2-8 function patron_autocomplete(node, options) { Link Here
2
    let link_to;
2
    let link_to;
3
    let url_params;
3
    let url_params;
4
    let on_select_callback;
4
    let on_select_callback;
5
    let leading_wildcard = defaultPatronSearchMethod === 'contains' ? '%' : '';
5
    let leading_wildcard = defaultPatronSearchMethod === 'contain' ? '%' : '';
6
    if ( options ) {
6
    if ( options ) {
7
        if ( options['link-to'] ) {
7
        if ( options['link-to'] ) {
8
            link_to = options['link-to'];
8
            link_to = options['link-to'];
(-)a/members/member.pl (-2 lines)
Lines 75-81 $template->param( Link Here
75
    searchmember        => $searchmember,
75
    searchmember        => $searchmember,
76
    branchcode_filter   => scalar $input->param('branchcode_filter'),
76
    branchcode_filter   => scalar $input->param('branchcode_filter'),
77
    categorycode_filter => scalar $input->param('categorycode_filter'),
77
    categorycode_filter => scalar $input->param('categorycode_filter'),
78
    searchtype          => scalar $input->param('searchtype') || 'contain',
79
    searchfieldstype    => $searchfieldstype,
78
    searchfieldstype    => $searchfieldstype,
80
    PatronsPerPage      => C4::Context->preference("PatronsPerPage") || 20,
79
    PatronsPerPage      => C4::Context->preference("PatronsPerPage") || 20,
81
    do_not_defer_loading => !$defer_loading,
80
    do_not_defer_loading => !$defer_loading,
82
- 

Return to bug 34094