Bugzilla – Attachment 148383 Details for
Bug 33117
Patron checkout search not working if searching with second surname
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33117: Added new syspref Patronautocompletesesarchmethod
Bug-33117-Added-new-syspref-Patronautocompletesesa.patch (text/plain), 15.37 KB, created by
Laura Escamilla
on 2023-03-17 18:15:45 UTC
(
hide
)
Description:
Bug 33117: Added new syspref Patronautocompletesesarchmethod
Filename:
MIME Type:
Creator:
Laura Escamilla
Created:
2023-03-17 18:15:45 UTC
Size:
15.37 KB
patch
obsolete
>From 429970df2170cc7624c15d25a886435e51af51b0 Mon Sep 17 00:00:00 2001 >From: John Doe <you@example.com> >Date: Thu, 9 Mar 2023 16:20:03 +0000 >Subject: [PATCH] Bug 33117: Added new syspref Patronautocompletesesarchmethod >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Added a new system preference called "PatronAutoCompleteSearchMethod" >which allows staff to choose between "Starts with" or "Contains" when >searching for patrons. The "Contains" option should be useful when >searching for patrons that have multiple surnames or when searching >using a patron's middle name. > >Test Plan: >1. Create a patron that has a first name, middle name and two surnames. (i.e. Adela Maria, Hernandez Acosta). >2. Search for the patron using their first name and first surname. Confirm that a record is found. >3. Search for the patron using their first name and second surname. Confirm that no record is found. >4. Search for the patron using their middle name and first surname. Confirm that a record is found. >5. Search for the patron using their middle name and second surname. Confirm that no record is found. >6. Apply the patch. >7. Under Administration > Global System Preferences > search for âPatronAutocompleteSearchMethodâ >8. Choose âContainsâ instead of âStarts withâ for the system preference. >9. Repeat steps 2-4. The patron record should appear for all search methods. >10. Sign off! >--- > C4/Installer.pm | 4 ++-- > installer/data/mysql/atomicupdate/bug_33117.pl | 16 ++++++++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 1 + > .../prog/en/includes/js_includes.inc | 4 ++-- > .../prog/en/modules/acqui/duplicate_orders.tt | 2 +- > .../prog/en/modules/acqui/histsearch.tt | 3 ++- > .../modules/admin/preferences/circulation.pref | 8 +++++++- > .../prog/en/modules/circ/curbside_pickups.tt | 2 +- > .../prog/en/modules/course_reserves/course.tt | 3 ++- > .../prog/en/modules/patron_lists/list.tt | 3 ++- > .../prog/en/modules/reserve/request.tt | 2 +- > .../prog/en/modules/virtualshelves/shelves.tt | 2 +- > .../intranet-tmpl/prog/js/pages/tags-review.js | 2 +- > .../intranet-tmpl/prog/js/patron-autocomplete.js | 12 +++++++----- > koha-tmpl/intranet-tmpl/prog/js/viewlog.js | 2 +- > 15 files changed, 47 insertions(+), 19 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_33117.pl > >diff --git a/C4/Installer.pm b/C4/Installer.pm >index ffab0ed76a..ffdde8c262 100644 >--- a/C4/Installer.pm >+++ b/C4/Installer.pm >@@ -734,9 +734,9 @@ sub run_db_rev { > my $schema = Koha::Database->new->schema; > $schema->txn_do( > sub { >- $db_rev->{up}->( { dbh => $schema->storage->dbh, out => $outfh } ); >+ $db_rev->{up}->( { dbh => $schema->storage->dbh, out => $outfh }, ); > } >- ); >+ ); > } > catch { > $error = $_; >diff --git a/installer/data/mysql/atomicupdate/bug_33117.pl b/installer/data/mysql/atomicupdate/bug_33117.pl >new file mode 100755 >index 0000000000..5212efd8ad >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_33117.pl >@@ -0,0 +1,16 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "33117", >+ description => "Patron checkout search not working if searching with second surname", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ >+ $dbh->do(q{INSERT INTO systempreferences (`variable`, `value`, `explanation`, `options`, `type`) VALUES >+ ('PatronAutoCompleteSearchMethod','1','Allows staff to search for patrons using the method','Starts with|Contains','YesNo'), >+ }); >+ # sysprefs >+ say $out "Added new system preference 'PatronAutocompleteSearchMethod'"; >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index b12f1ce170..a6793b3f55 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -551,6 +551,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('PassItemMarcToXSLT','0',NULL,'If enabled, item fields in the MARC record will be made avaiable to XSLT sheets. Otherwise they will be removed.','YesNo'), > ('PatronAnonymizeDelay','',NULL,'Delay for anonymizing patrons', 'Integer'), > ('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'), >+('PatronAutocompleteSearchMethod','1','Allows staff to search for patrons using the method 'Starts with|Contains','YesNo'), > ('PatronDuplicateMatchingAddFields','surname|firstname|dateofbirth', NULL,'A list of fields separated by "|" to deduplicate patrons when created','Free'), > ('patronimages','0',NULL,'Enable patron images for the staff interface','YesNo'), > ('PatronRemovalDelay','',NULL,'Delay for removing anonymized patrons', 'Integer'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >index 2d1af01c4f..0b7b61c9de 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >@@ -78,11 +78,11 @@ > $(document).ready(function(){ > [% IF ( CAN_user_circulate_circulate_remaining_permissions ) %] > if ( $("#findborrower").length ) { >- patron_autocomplete($("#findborrower"), { 'link-to': 'circ' }); >+ patron_autocomplete($("#findborrower"), { 'link-to': 'circ' },'[%Koha.Preference('PatronAutocompleteSearchMethod') | html %]'); > } > [% END %] > if ( $("#searchmember").length ) { >- patron_autocomplete($("#searchmember"), { 'link-to': 'patron' }); >+ patron_autocomplete($("#searchmember"), { 'link-to': 'patron' },'[%Koha.Preference('PatronAutocompleteSearchMethod') | html %]'); > } > }); > </script> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicate_orders.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicate_orders.tt >index 9997b9b765..4a25fae8e9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicate_orders.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicate_orders.tt >@@ -347,7 +347,7 @@ Acquisitions › Koha > $("#find_patron").val('').focus(); > return false; > } >- }); >+ },'[%Koha.Preference('PatronAutocompleteSearchMethod') | html %]'); > $("body").on("click",".removePatron",function(e){ > e.preventDefault(); > var divid = $(this).parent().attr("id"); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt >index 4e56d56d21..08675e6656 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt >@@ -1,6 +1,7 @@ > [% USE raw %] > [% USE Asset %] > [% USE KohaDates %] >+[% USE Koha %] > [% USE TablesSettings %] > [% USE Branches %] > [% SET footerjs = 1 %] >@@ -187,7 +188,7 @@ > $("#find_patron").val('').focus(); > return false; > } >- }); >+ },'[%Koha.Preference('PatronAutocompleteSearchMethod') | html %]'); > $("body").on("click",".removePatron",function(e){ > e.preventDefault(); > var divid = $(this).parent().attr("id"); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index df40f15c46..43c574951f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -25,7 +25,13 @@ Circulation: > 1: Try > 0: "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. >+ - Only returns the first 10 results at a time. >+ - >+ - pref: PatronAutocompleteSearchMethod >+ choices: >+ 1: "Starts with" >+ 0: "Contains" >+ - allows staff to choose between "Starts with" or "Contains" when searching for patrons. > - > - pref: itemBarcodeInputFilter > choices: >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/curbside_pickups.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/curbside_pickups.tt >index cd79451dc8..ee71a55819 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/curbside_pickups.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/curbside_pickups.tt >@@ -655,7 +655,7 @@ > window.location.href = "/cgi-bin/koha/circ/curbside_pickups.pl?op=find-patron&borrowernumber=" + ui.item.patron_id; > return false; > } >- }); >+ },'[%Koha.Preference('PatronAutocompleteSearchMethod') | html %]'); > } > > $("#pickup-tabs a[data-toggle='tab']").on("shown.bs.tab", function (e) { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt >index 702637f92f..2656494ab1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt >@@ -1,4 +1,5 @@ > [% PROCESS 'i18n.inc' %] >+[% USE Koha %] > [% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>[% IF course_name %] Edit [% course_name | html %] [% ELSE %] New course [% END %] › Course reserves › Koha</title> >@@ -181,7 +182,7 @@ > AddInstructor( ui.item.surname + ", " + ui.item.firstname, ui.item.patron_id ); > return false; > } >- }); >+ },'[%Koha.Preference('PatronAutocompleteSearchMethod') | html %]'); > > if ( ! $('#instructors').html() ) { > $('#course_instructors').hide(); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/list.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/list.tt >index 49ce23cc11..2d2f572c0a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/list.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/list.tt >@@ -1,5 +1,6 @@ > [% USE raw %] > [% USE Asset %] >+[% USE Koha %] > [% USE KohaDates %] > [% USE TablesSettings %] > [% SET footerjs = 1 %] >@@ -267,7 +268,7 @@ > $("#find_patron").val('').focus(); > return false; > } >- }); >+ },'[%Koha.Preference('PatronAutocompleteSearchMethod') | html %]'); > $("body").on("click",".removePatron",function(e){ > e.preventDefault(); > var divid = $(this).parent().attr("id"); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >index e2d33c5415..7d14597d86 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -1680,7 +1680,7 @@ > Sticky.hcSticky({ > stickTo: "#existing_holds", > stickyClass: "floating" >- }); >+ },'[%Koha.Preference('PatronAutocompleteSearchMethod') | html %]'); > > [% IF Koha.Preference('EnableItemGroupHolds') %] > $(':radio[name="item_group_id"]').change(function(){ >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >index 12a4b826d2..d2b649038d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >@@ -961,7 +961,7 @@ > $('#new_owner').val( ui.item.patron_id ); > $('#find_patron').val('').focus(); > return false; >- }}); >+ }},'[%Koha.Preference('PatronAutocompleteSearchMethod') | html %]'); > > $('#transferform').submit(function() { > if( $('#new_owner').val() == '' ) { >diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/tags-review.js b/koha-tmpl/intranet-tmpl/prog/js/pages/tags-review.js >index d1588f6a86..30bea8912c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/pages/tags-review.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/pages/tags-review.js >@@ -163,5 +163,5 @@ $(document).ready(function() { > $("#approver").val( ui.item.patron_id ); > return false; > } >- }); >+ },'[%Koha.Preference('PatronAutocompleteSearchMethod') | html %]'); > }); >diff --git a/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js b/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js >index 49ff14f84b..cc3d05dc21 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js >@@ -1,4 +1,4 @@ >-function patron_autocomplete(node, options) { >+function patron_autocomplete(node, options, search_type) { > let link_to; > let url_params; > let on_select_callback; >@@ -20,10 +20,11 @@ function patron_autocomplete(node, options) { > .filter(function(s){ return s.length }) > .forEach(function(pattern,i){ > let subquery_or = []; >- defaultPatronSearchFields.split(',').forEach(function(field,i){ >+ defaultPatronSearchFields.split(',').forEach(function(field,i,search_type){ > subquery_or.push( > {["me."+field]: {'like': pattern + '%'}} >- ); >+ {["me."+field]: {'like': pattern}} >+ ); > }); > subquery_and.push(subquery_or); > }); >@@ -47,7 +48,7 @@ function patron_autocomplete(node, options) { > error: function(e) { > if ( e.state() != 'rejected' ) { > alert( __("An error occurred. Check the logs") ); >- } >+ e > return response(); > } > }); >@@ -97,6 +98,7 @@ function patron_autocomplete(node, options) { > + ( item.firstname ? item.firstname.escapeHtml() : "" ) > + cardnumber.escapeHtml() > + " <small>" >+ > + ( item.date_of_birth > ? $date(item.date_of_birth) > + "<span class=\"age_years\"> (" >@@ -120,4 +122,4 @@ function patron_autocomplete(node, options) { > + "</a>" ) > .appendTo( ul ); > }; >-} >+ } >diff --git a/koha-tmpl/intranet-tmpl/prog/js/viewlog.js b/koha-tmpl/intranet-tmpl/prog/js/viewlog.js >index 568320af81..26474da152 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/viewlog.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/viewlog.js >@@ -148,5 +148,5 @@ $(document).ready(function(){ > $("#user").val( ui.item.patron_id ); > return false; > } >- }); >+ },'[%Koha.Preference('PatronAutocompleteSearchMethod') | html %]'); > }); >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33117
:
148018
|
148027
|
148095
|
148131
|
148138
|
148278
|
148279
|
148280
|
148282
|
148336
|
148383
|
148384
|
148443
|
148445
|
148467
|
148481
|
150781
|
150896
|
150897
|
150898
|
151090
|
151091
|
151302
|
151314
|
151317
|
151769
|
151771
|
151825
|
151845
|
152549
|
152552
|
152554
|
152555
|
152556
|
152562
|
152563
|
152564
|
152565
|
154309