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

(-)a/C4/Installer.pm (-2 / +2 lines)
Lines 734-742 sub run_db_rev { Link Here
734
        my $schema = Koha::Database->new->schema;
734
        my $schema = Koha::Database->new->schema;
735
        $schema->txn_do(
735
        $schema->txn_do(
736
            sub {
736
            sub {
737
                $db_rev->{up}->( { dbh => $schema->storage->dbh, out => $outfh } );
737
                $db_rev->{up}->( { dbh => $schema->storage->dbh, out => $outfh }, );
738
            }
738
            }
739
        );
739
         );
740
    }
740
    }
741
    catch {
741
    catch {
742
        $error = $_;
742
        $error = $_;
(-)a/installer/data/mysql/atomicupdate/bug_33117.pl (+16 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "33117",
5
    description => "Patron checkout search not working if searching with second surname",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
   
10
        $dbh->do(q{INSERT INTO systempreferences (`variable`, `value`, `explanation`, `options`, `type`) VALUES
11
    ('PatronAutoCompleteSearchMethod','1','Allows staff to search for patrons using the method','Starts with|Contains','YesNo'), 
12
    });
13
        # sysprefs
14
        say $out "Added new system preference 'PatronAutocompleteSearchMethod'";
15
    },
16
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 551-556 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
551
('PassItemMarcToXSLT','0',NULL,'If enabled, item fields in the MARC record will be made avaiable to XSLT sheets. Otherwise they will be removed.','YesNo'),
551
('PassItemMarcToXSLT','0',NULL,'If enabled, item fields in the MARC record will be made avaiable to XSLT sheets. Otherwise they will be removed.','YesNo'),
552
('PatronAnonymizeDelay','',NULL,'Delay for anonymizing patrons', 'Integer'),
552
('PatronAnonymizeDelay','',NULL,'Delay for anonymizing patrons', 'Integer'),
553
('PatronAutoComplete','1','Try|Don\'t try','to guess the patron being entered while typing a patron search for circulation or patron search. Only returns the first 10 results at a time.','YesNo'),
553
('PatronAutoComplete','1','Try|Don\'t try','to guess the patron being entered while typing a patron search for circulation or patron search. Only returns the first 10 results at a time.','YesNo'),
554
('PatronAutocompleteSearchMethod','1','Allows staff to search for patrons using the method  'Starts with|Contains','YES/NO'),
554
('PatronDuplicateMatchingAddFields','surname|firstname|dateofbirth', NULL,'A list of fields separated by "|" to deduplicate patrons when created','Free'),
555
('PatronDuplicateMatchingAddFields','surname|firstname|dateofbirth', NULL,'A list of fields separated by "|" to deduplicate patrons when created','Free'),
555
('patronimages','0',NULL,'Enable patron images for the staff interface','YesNo'),
556
('patronimages','0',NULL,'Enable patron images for the staff interface','YesNo'),
556
('PatronRemovalDelay','',NULL,'Delay for removing anonymized patrons', 'Integer'),
557
('PatronRemovalDelay','',NULL,'Delay for removing anonymized patrons', 'Integer'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc (-2 / +2 lines)
Lines 78-88 Link Here
78
    $(document).ready(function(){
78
    $(document).ready(function(){
79
        [% IF ( CAN_user_circulate_circulate_remaining_permissions ) %]
79
        [% IF ( CAN_user_circulate_circulate_remaining_permissions ) %]
80
            if ( $("#findborrower").length ) {
80
            if ( $("#findborrower").length ) {
81
                patron_autocomplete($("#findborrower"), { 'link-to': 'circ' });
81
                patron_autocomplete($("#findborrower"), { 'link-to': 'circ' },'[%Koha.Preference('PatronAutocompleteSearchMethod') | html %]');
82
            }
82
            }
83
        [% END %]
83
        [% END %]
84
        if ( $("#searchmember").length ) {
84
        if ( $("#searchmember").length ) {
85
            patron_autocomplete($("#searchmember"), { 'link-to': 'patron' });
85
            patron_autocomplete($("#searchmember"), { 'link-to': 'patron' },'[%Koha.Preference('PatronAutocompleteSearchMethod') | html %]');
86
        }
86
        }
87
    });
87
    });
88
    </script>
88
    </script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicate_orders.tt (-1 / +1 lines)
Lines 347-353 Acquisitions &rsaquo; Koha Link Here
347
                        $("#find_patron").val('').focus();
347
                        $("#find_patron").val('').focus();
348
                        return false;
348
                        return false;
349
                    }
349
                    }
350
                });
350
                },'[%Koha.Preference('PatronAutocompleteSearchMethod') | html %]');
351
                $("body").on("click",".removePatron",function(e){
351
                $("body").on("click",".removePatron",function(e){
352
                    e.preventDefault();
352
                    e.preventDefault();
353
                    var divid = $(this).parent().attr("id");
353
                    var divid = $(this).parent().attr("id");
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt (-1 / +2 lines)
Lines 1-6 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Asset %]
2
[% USE Asset %]
3
[% USE KohaDates %]
3
[% USE KohaDates %]
4
[% USE Koha %]
4
[% USE TablesSettings %]
5
[% USE TablesSettings %]
5
[% USE Branches %]
6
[% USE Branches %]
6
[% SET footerjs = 1 %]
7
[% SET footerjs = 1 %]
Lines 187-193 Link Here
187
                    $("#find_patron").val('').focus();
188
                    $("#find_patron").val('').focus();
188
                    return false;
189
                    return false;
189
                }
190
                }
190
            });
191
            },'[%Koha.Preference('PatronAutocompleteSearchMethod') | html %]');
191
            $("body").on("click",".removePatron",function(e){
192
            $("body").on("click",".removePatron",function(e){
192
                e.preventDefault();
193
                e.preventDefault();
193
                var divid = $(this).parent().attr("id");
194
                var divid = $(this).parent().attr("id");
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-1 / +7 lines)
Lines 25-31 Circulation: Link Here
25
                  1: Try
25
                  1: Try
26
                  0: "Don't try"
26
                  0: "Don't try"
27
            - to guess the patron being entered while typing a patron search for circulation or patron search.
27
            - to guess the patron being entered while typing a patron search for circulation or patron search.
28
            - Only returns the first 10 results at a time.
28
            - Only returns the first 10 results at a time.	    
29
        -
30
            - pref: PatronAutocompleteSearchMethod
31
              choices:
32
                  1: "Starts with"
33
                  0: "Contains
34
             -allows staff to choose between "Starts with" or "Contains" when searching for patrons.
29
        -
35
        -
30
            - pref: itemBarcodeInputFilter
36
            - pref: itemBarcodeInputFilter
31
              choices:
37
              choices:
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/curbside_pickups.tt (-1 / +1 lines)
Lines 655-661 Link Here
655
                        window.location.href = "/cgi-bin/koha/circ/curbside_pickups.pl?op=find-patron&borrowernumber=" + ui.item.patron_id;
655
                        window.location.href = "/cgi-bin/koha/circ/curbside_pickups.pl?op=find-patron&borrowernumber=" + ui.item.patron_id;
656
                        return false;
656
                        return false;
657
                    }
657
                    }
658
                });
658
                },'[%Koha.Preference('PatronAutocompleteSearchMethod') | html %]');
659
            }
659
            }
660
660
661
            $("#pickup-tabs a[data-toggle='tab']").on("shown.bs.tab", function (e) {
661
            $("#pickup-tabs a[data-toggle='tab']").on("shown.bs.tab", function (e) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt (-1 / +2 lines)
Lines 1-4 Link Here
1
[% PROCESS 'i18n.inc' %]
1
[% PROCESS 'i18n.inc' %]
2
[% USE Koha %]
2
[% SET footerjs = 1 %]
3
[% SET footerjs = 1 %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
<title>[% IF course_name %] Edit [% course_name | html %] [% ELSE %] New course [% END %] &rsaquo; Course reserves &rsaquo; Koha</title>
5
<title>[% IF course_name %] Edit [% course_name | html %] [% ELSE %] New course [% END %] &rsaquo; Course reserves &rsaquo; Koha</title>
Lines 181-187 Link Here
181
                        AddInstructor( ui.item.surname + ", " + ui.item.firstname, ui.item.patron_id );
182
                        AddInstructor( ui.item.surname + ", " + ui.item.firstname, ui.item.patron_id );
182
                        return false;
183
                        return false;
183
                    }
184
                    }
184
                });
185
                },'[%Koha.Preference('PatronAutocompleteSearchMethod') | html %]');
185
186
186
                if ( ! $('#instructors').html() ) {
187
                if ( ! $('#instructors').html() ) {
187
                    $('#course_instructors').hide();
188
                    $('#course_instructors').hide();
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/list.tt (-1 / +2 lines)
Lines 1-5 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Asset %]
2
[% USE Asset %]
3
[% USE Koha %]
3
[% USE KohaDates %]
4
[% USE KohaDates %]
4
[% USE TablesSettings %]
5
[% USE TablesSettings %]
5
[% SET footerjs = 1 %]
6
[% SET footerjs = 1 %]
Lines 267-273 Link Here
267
                    $("#find_patron").val('').focus();
268
                    $("#find_patron").val('').focus();
268
                    return false;
269
                    return false;
269
                }
270
                }
270
            });
271
            },'[%Koha.Preference('PatronAutocompleteSearchMethod') | html %]');
271
            $("body").on("click",".removePatron",function(e){
272
            $("body").on("click",".removePatron",function(e){
272
                e.preventDefault();
273
                e.preventDefault();
273
                var divid = $(this).parent().attr("id");
274
                var divid = $(this).parent().attr("id");
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-1 / +1 lines)
Lines 1680-1686 Link Here
1680
            Sticky.hcSticky({
1680
            Sticky.hcSticky({
1681
                stickTo: "#existing_holds",
1681
                stickTo: "#existing_holds",
1682
                stickyClass: "floating"
1682
                stickyClass: "floating"
1683
            });
1683
            },'[%Koha.Preference('PatronAutocompleteSearchMethod') | html %]');
1684
1684
1685
            [% IF Koha.Preference('EnableItemGroupHolds') %]
1685
            [% IF Koha.Preference('EnableItemGroupHolds') %]
1686
                $(':radio[name="item_group_id"]').change(function(){
1686
                $(':radio[name="item_group_id"]').change(function(){
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt (-1 / +1 lines)
Lines 961-967 Link Here
961
                    $('#new_owner').val( ui.item.patron_id );
961
                    $('#new_owner').val( ui.item.patron_id );
962
                    $('#find_patron').val('').focus();
962
                    $('#find_patron').val('').focus();
963
                    return false;
963
                    return false;
964
                }});
964
                }},'[%Koha.Preference('PatronAutocompleteSearchMethod') | html %]');
965
965
966
                $('#transferform').submit(function() {
966
                $('#transferform').submit(function() {
967
                    if( $('#new_owner').val() == '' ) {
967
                    if( $('#new_owner').val() == '' ) {
(-)a/koha-tmpl/intranet-tmpl/prog/js/pages/tags-review.js (-1 / +1 lines)
Lines 163-167 $(document).ready(function() { Link Here
163
            $("#approver").val( ui.item.patron_id );
163
            $("#approver").val( ui.item.patron_id );
164
            return false;
164
            return false;
165
        }
165
        }
166
    });
166
    },'[%Koha.Preference('PatronAutocompleteSearchMethod') | html %]');
167
});
167
});
(-)a/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js (-4 / +5 lines)
Lines 1-4 Link Here
1
function patron_autocomplete(node, options) {
1
function patron_autocomplete(node, options, search_type) {
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;
Lines 20-29 function patron_autocomplete(node, options) { Link Here
20
                .filter(function(s){ return s.length })
20
                .filter(function(s){ return s.length })
21
                .forEach(function(pattern,i){
21
                .forEach(function(pattern,i){
22
                    let subquery_or = [];
22
                    let subquery_or = [];
23
                    defaultPatronSearchFields.split(',').forEach(function(field,i){
23
                    defaultPatronSearchFields.split(',').forEach(function(field,i,search_type){
24
                        subquery_or.push(
24
                        subquery_or.push(
25
                            {["me."+field]: {'like': pattern + '%'}}
25
                            {["me."+field]: {'like': pattern + '%'}}
26
                        );
26
                            {["me."+field]: {'like': pattern}}
27
                          );
27
                    });
28
                    });
28
                    subquery_and.push(subquery_or);
29
                    subquery_and.push(subquery_or);
29
                });
30
                });
Lines 97-102 function patron_autocomplete(node, options) { Link Here
97
                + ( item.firstname ? item.firstname.escapeHtml() : "" )
98
                + ( item.firstname ? item.firstname.escapeHtml() : "" )
98
                + cardnumber.escapeHtml()
99
                + cardnumber.escapeHtml()
99
                + " <small>"
100
                + " <small>"
101
                    + ( item.date_of_birth
100
                    + ( item.date_of_birth
102
                    + ( item.date_of_birth
101
                        ?   $date(item.date_of_birth)
103
                        ?   $date(item.date_of_birth)
102
                          + "<span class=\"age_years\"> ("
104
                          + "<span class=\"age_years\"> ("
Lines 120-123 function patron_autocomplete(node, options) { Link Here
120
            + "</a>" )
122
            + "</a>" )
121
        .appendTo( ul );
123
        .appendTo( ul );
122
    };
124
    };
123
}
(-)a/koha-tmpl/intranet-tmpl/prog/js/viewlog.js (-2 / +1 lines)
Lines 148-152 $(document).ready(function(){ Link Here
148
            $("#user").val( ui.item.patron_id );
148
            $("#user").val( ui.item.patron_id );
149
            return false;
149
            return false;
150
        }
150
        }
151
    });
151
    },'[%Koha.Preference('PatronAutocompleteSearchMethod') | html %]');
152
});
152
});
153
- 

Return to bug 33117