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' selected='selected'>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' selected='selected'>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 / +13 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 74-85 Link Here
74
                        <li>
75
                        <li>
75
                            <label for="searchtype_filter">Search type:</label>
76
                            <label for="searchtype_filter">Search type:</label>
76
                            <select name="searchtype" id="searchtype_filter">
77
                            <select name="searchtype" id="searchtype_filter">
77
                              [% IF searchtype == "start_with" %]
78
                              [% IF searchtype == "starts_with" %]
78
                                <option value='start_with' selected="selected">Starts with</option>
79
                                <option value='starts_with' selected="selected">Starts with</option>
79
                                <option value="contain">Contains</option>
80
                                <option value="contains">Contains</option>
80
                              [% ELSE %]
81
                              [% ELSE %]
81
                                <option value='start_with'>Starts with</option>
82
                                <option value='starts_with'>Starts with</option>
82
                                <option value="contain" selected="selected">Contains</option>
83
                                <option value="contains" selected="selected">Contains</option>
83
                              [% END %]
84
                              [% END %]
84
                            </select>
85
                            </select>
85
                        </li>
86
                        </li>
Lines 339-345 Link Here
339
                    }
340
                    }
340
                    let patterns = pattern.split(/[\s,]+/).filter(function(s){ return s.length });
341
                    let patterns = pattern.split(/[\s,]+/).filter(function(s){ return s.length });
341
342
342
                    let search_type = $("#searchtype_filter").val() || "contain";
343
                    let filters = [];
344
                    let search_type = $("#searchtype_filter").val() || "contains";
343
                    let search_fields = $("#searchfieldstype_filter").val();
345
                    let search_fields = $("#searchfieldstype_filter").val();
344
                    if ( !search_fields ) {
346
                    if ( !search_fields ) {
345
                        search_fields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname,middle_name,surname,othernames,cardnumber,userid' | html %]";
347
                        search_fields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname,middle_name,surname,othernames,cardnumber,userid' | html %]";
Lines 349-355 Link Here
349
                    patterns.forEach(function(pattern,i){
351
                    patterns.forEach(function(pattern,i){
350
                        let sub_or = [];
352
                        let sub_or = [];
351
                        search_fields.split(',').forEach(function(attr,ii){
353
                        search_fields.split(',').forEach(function(attr,ii){
352
                            sub_or.push({["me."+attr]:{"like":(search_type == "contain" ? "%" : "" ) + pattern + "%"}});
354
                            sub_or.push({["me."+attr]:{"like":(search_type == "contains" ? "%" : "" ) + pattern + "%"}});
353
                            if ( attr == 'dateofbirth' ) {
355
                            if ( attr == 'dateofbirth' ) {
354
                                try {
356
                                try {
355
                                    let d = $date_to_rfc3339(pattern);
357
                                    let d = $date_to_rfc3339(pattern);
Lines 368-374 Link Here
368
                        patterns.forEach(function(pattern,i){
370
                        patterns.forEach(function(pattern,i){
369
                            let sub_or = [];
371
                            let sub_or = [];
370
                            sub_or.push({
372
                            sub_or.push({
371
                                "extended_attributes.value": { "like": "%" + pattern + (search_type == "contain" ? "%" : "" )},
373
                                "extended_attributes.value": { "like": "%" + pattern + (search_type == "contains" ? "%" : "" )},
372
                                "extended_attributes.code": extended_attribute_types
374
                                "extended_attributes.code": extended_attribute_types
373
                            });
375
                            });
374
                            subquery_and.push(sub_or);
376
                            subquery_and.push(sub_or);
Lines 758-764 Link Here
758
        function update_search_description(){
760
        function update_search_description(){
759
            var searched = $("#searchfieldstype_filter").find("option:selected").text();
761
            var searched = $("#searchfieldstype_filter").find("option:selected").text();
760
            if ( $("#search_patron_filter").val() ) {
762
            if ( $("#search_patron_filter").val() ) {
761
                if ( $("#searchtype_filter").val() == 'start_with' ) {
763
                if ( $("#searchtype_filter").val() == 'starts_with' ) {
762
                    searched += _(" starting with ");
764
                    searched += _(" starting with ");
763
                } else {
765
                } else {
764
                    searched += _(" containing ");
766
                    searched += _(" containing ");
Lines 846-852 Link Here
846
848
847
        function clearFilters() {
849
        function clearFilters() {
848
            $("#searchfieldstype_filter option:first").prop("selected", true);
850
            $("#searchfieldstype_filter option:first").prop("selected", true);
849
            $("#searchtype_filter option[value='contain']").prop("selected", true);
851
            $("#searchtype_filter option[value='[% searchtype || 'contains' | html %]']").prop("selected", true);
850
            $("#categorycode_filter option:first").prop("selected", true);
852
            $("#categorycode_filter option:first").prop("selected", true);
851
            $("#branchcode_filter option:first").prop("selected", true);
853
            $("#branchcode_filter option:first").prop("selected", true);
852
            $("#sort1_filter").val('').trigger("change");
854
            $("#sort1_filter").val('').trigger("change");
(-)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/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