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

(-)a/installer/data/mysql/atomicupdate/bug_33117.pl (+17 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "33117",
5
    description => "Patron checkout is not able to find patrons if using a second surname or other name during the search",
6
    up => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        $dbh->do(q{
11
            INSERT INTO systempreferences (`variable`,`value`,`explanation`,`options`,`type`)
12
            VALUES ('PatronAutoCompleteSearchMethod','starts_with','Allows staff to set a default method when searching for patrons with autocomplete','starts_with|contains','Choice');
13
        });
14
15
        say $out "Added new system preference 'PatronAutoCompleteSearchMethod'";
16
    },
17
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 552-557 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
552
('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
('PassItemMarcToXSLT','0',NULL,'If enabled, item fields in the MARC record will be made avaiable to XSLT sheets. Otherwise they will be removed.','YesNo'),
553
('PatronAnonymizeDelay','',NULL,'Delay for anonymizing patrons', 'Integer'),
553
('PatronAnonymizeDelay','',NULL,'Delay for anonymizing patrons', 'Integer'),
554
('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
('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'),
555
('PatronAutoCompleteSearchMethod','starts_with','Choose which search method to use by default when searching with PatronAutoComplete','starts_with|choice','Choice'),
555
('PatronDuplicateMatchingAddFields','surname|firstname|dateofbirth', NULL,'A list of fields separated by "|" to deduplicate patrons when created','Free'),
556
('PatronDuplicateMatchingAddFields','surname|firstname|dateofbirth', NULL,'A list of fields separated by "|" to deduplicate patrons when created','Free'),
556
('patronimages','0',NULL,'Enable patron images for the staff interface','YesNo'),
557
('patronimages','0',NULL,'Enable patron images for the staff interface','YesNo'),
557
('PatronRemovalDelay','',NULL,'Delay for removing anonymized patrons', 'Integer'),
558
('PatronRemovalDelay','',NULL,'Delay for removing anonymized patrons', 'Integer'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc (+1 lines)
Lines 71-76 Link Here
71
71
72
<script>
72
<script>
73
    var defaultPatronSearchFields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname,middle_name,surname,othernames,cardnumber,userid' | html %]";
73
    var defaultPatronSearchFields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname,middle_name,surname,othernames,cardnumber,userid' | html %]";
74
    var patronAutoCompleteSearchMethod = "[% Koha.Preference('PatronAutoCompleteSearchMethod') || 'contains' | html %]";
74
    var loggedInLibrary = '[% Branches.GetLoggedInBranchcode | html %]';
75
    var loggedInLibrary = '[% Branches.GetLoggedInBranchcode | html %]';
75
    var singleBranchMode = '[% singleBranchMode | html %]';
76
    var singleBranchMode = '[% singleBranchMode | html %]';
76
</script>
77
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+6 lines)
Lines 26-31 Circulation: Link Here
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
                  starts_with: "Starts with"
33
                  contains: "Contains"
34
            - Enable this search method to determine whether to use Starts with or Contains for autocomplete patron searches.
29
        -
35
        -
30
            - pref: itemBarcodeInputFilter
36
            - pref: itemBarcodeInputFilter
31
              choices:
37
              choices:
(-)a/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js (-2 / +2 lines)
Lines 2-7 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 = patronAutoCompleteSearchMethod === 'contains' ? '%' : '';
5
    if ( options ) {
6
    if ( options ) {
6
        if ( options['link-to'] ) {
7
        if ( options['link-to'] ) {
7
            link_to = options['link-to'];
8
            link_to = options['link-to'];
Lines 22-28 function patron_autocomplete(node, options) { Link Here
22
                    let subquery_or = [];
23
                    let subquery_or = [];
23
                    defaultPatronSearchFields.split(',').forEach(function(field,i){
24
                    defaultPatronSearchFields.split(',').forEach(function(field,i){
24
                        subquery_or.push(
25
                        subquery_or.push(
25
                            {["me."+field]: {'like': pattern + '%'}}
26
                            {["me."+field]: {'like': leading_wildcard + pattern + '%'}}
26
                        );
27
                        );
27
                    });
28
                    });
28
                    subquery_and.push(subquery_or);
29
                    subquery_and.push(subquery_or);
29
- 

Return to bug 33117