[Bug 9407] New: patrons search should match substrings
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9407 Bug ID: 9407 Summary: patrons search should match substrings Classification: Unclassified Change sponsored?: --- Product: Koha Version: master Hardware: All URL: http://intranet/cgi-bin/koha/members/member.pl OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Patrons Assignee: koha-bugs@lists.koha-community.org Reporter: mjr@software.coop CC: gmcharlt@gmail.com, kyle.m.hall@gmail.com Depends on: 8516 If a patron lives at 4345 Library Rd, a search on Street Address for Library should find it. However, it does not, but a search for 4345 Library does. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9407 --- Comment #1 from MJ Ray (software.coop) <mjr@software.coop> --- Created attachment 14636 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=14636&action=edit Bug 9070: patrons search should match substrings If a patron lives at 4345 Library Rd, a search on Street Address for Library should find it. However, it does not, but a search for 4345 Library does. This patch adds a "Search Type" drop-down, defaulting to the current behaviour. To test: 1) Search for a patron based on a non-leading part of a field. 2) Should return no results. 3) Search again with "Search Type" of "Contains". 4) Should return the patron. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9407 MJ Ray (software.coop) <mjr@software.coop> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Patch complexity|--- |Small patch Severity|enhancement |minor -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9407 MJ Ray (software.coop) <mjr@software.coop> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #14636|0 |1 is obsolete| | --- Comment #2 from MJ Ray (software.coop) <mjr@software.coop> --- Created attachment 14637 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=14637&action=edit Bug 9407: patrons search should match substrings If a patron lives at 4345 Library Rd, a search on Street Address for Library should find it. However, it does not, but a search for 4345 Library does. This patch adds a "Search Type" drop-down, defaulting to the current behaviour. To test: 1) Search for a patron based on a non-leading part of a field. 2) Should return no results. 3) Search again with "Search Type" of "Contains". 4) Should return the patron. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9407 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Patch doesn't apply CC| |jonathan.druart@biblibre.co | |m --- Comment #3 from Jonathan Druart <jonathan.druart@biblibre.com> --- Hi MJ, could you resubmit your patch please? Applying: Bug 9407: patrons search should match substrings fatal: sha1 information is lacking or useless (koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc). Repository lacks necessary blobs to fall back on 3-way merge. Cannot fall back to three-way merge. Patch failed at 0001 Bug 9407: patrons search should match substrings -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9407 MJ Ray (software.coop) <mjr@software.coop> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #14637|0 |1 is obsolete| | --- Comment #4 from MJ Ray (software.coop) <mjr@software.coop> --- Created attachment 14659 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=14659&action=edit Bug 9407: patrons search should match substrings If a patron lives at 4345 Library Rd, a search on Street Address for Library should find it. However, it does not, but a search for 4345 Library does. This patch adds a "Search Type" drop-down, defaulting to the current behaviour. To test: 1) Search for a patron based on a non-leading part of a field. 2) Should return no results. 3) Search again with "Search Type" of "Contains". 4) Should return the patron. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9407 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Patch doesn't apply |Needs Signoff --- Comment #5 from Jonathan Druart <jonathan.druart@biblibre.com> --- MJ, Thanks! I will signoff your patch but I have 1 question: Don't you think the following change gives the code easier to read? -my $searchtype = $input->param('searchtype'); -my %searchtype_ok = ( 'contain' => 1 ); -if ( !defined($searchtype_ok{$searchtype}) ) { - undef $searchtype; -} - my $from = ( $startfrom - 1 ) * $resultsperpage; my $to = $from + $resultsperpage; my ($count,$results); if ($member || keys %$patron) { #($results)=Search($member || $patron,{surname=>1,firstname=>1},[$from,$to],undef,["firstname","surname","email","othernames"] ); - my $search_scope = $searchtype || ( $quicksearch ? "field_start_with" : "start_with" ); + my $search_scope = ( $input->param('searchtype') eq 'contain' ) + ? 'contain' + : ( $quicksearch ? "field_start_with" : "start_with" ); -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9407 --- Comment #6 from MJ Ray (software.coop) <mjr@software.coop> --- That change makes the code easier to read for now, but would have to be changed to something like the perlfaq4 idiom I used if C4::Patrons::Search (and C4::SQLHelper::SearchInTable) gains other possible values that we want to allow, or if someone chooses to add the currently-supported "exact" type. Should I add a comment to note that I'm using the perlfaq4 idiom to ease future expansion, or use the simpler form for now? -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9407 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #14659|0 |1 is obsolete| | --- Comment #7 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 14698 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=14698&action=edit [SIGNED-OFF] Bug 9407: patrons search should match substrings If a patron lives at 4345 Library Rd, a search on Street Address for Library should find it. However, it does not, but a search for 4345 Library does. This patch adds a "Search Type" drop-down, defaulting to the current behaviour. To test: 1) Search for a patron based on a non-leading part of a field. 2) Should return no results. 3) Search again with "Search Type" of "Contains". 4) Should return the patron. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9407 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off CC| |kyle@bywatersolutions.com -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9407 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA --- Comment #8 from Jonathan Druart <jonathan.druart@biblibre.com> --- (In reply to comment #6)
That change makes the code easier to read for now, but would have to be changed to something like the perlfaq4 idiom I used if C4::Patrons::Search (and C4::SQLHelper::SearchInTable) gains other possible values that we want to allow, or if someone chooses to add the currently-supported "exact" type. Should I add a comment to note that I'm using the perlfaq4 idiom to ease future expansion, or use the simpler form for now?
MJ, I think it is more complicated to maintain a code in a philosophy of "think about the future if... and if ...". To me the code must be simple at a given moment. So I am in favour of not modifying the code until someone add another value. It was just a proposition and you presented arguments so the patch can pass QA :) -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9407 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #14698|0 |1 is obsolete| | --- Comment #9 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 14736 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=14736&action=edit Bug 9407: patrons search should match substrings If a patron lives at 4345 Library Rd, a search on Street Address for Library should find it. However, it does not, but a search for 4345 Library does. This patch adds a "Search Type" drop-down, defaulting to the current behaviour. To test: 1) Search for a patron based on a non-leading part of a field. 2) Should return no results. 3) Search again with "Search Type" of "Contains". 4) Should return the patron. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9407 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |mjr@software.coop |ity.org | QA Contact| |jonathan.druart@biblibre.co | |m -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9407 Jared Camins-Esakov <jcamins@cpbibliography.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master --- Comment #10 from Jared Camins-Esakov <jcamins@cpbibliography.com> --- This patch has been pushed to master. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9407 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |Pushed to Stable CC| |chris@bigballofwax.co.nz --- Comment #11 from Chris Cormack <chris@bigballofwax.co.nz> --- Pushed to 3.10.x and 3.8.x will be in 3.10.3 ad 3.8.10 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org