Bug 34067 - Patron attributes search handles 'starts with'/contains incorrectly
Summary: Patron attributes search handles 'starts with'/contains incorrectly
Status: RESOLVED DUPLICATE of bug 34092
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Nick Clemens (kidclamp)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-20 13:46 UTC by Nick Clemens (kidclamp)
Modified: 2023-07-14 07:58 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 34067: Correct patron attributes 'starts with' search (1.80 KB, patch)
2023-06-20 13:50 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34067: Correct patron attributes 'starts with' search (1.84 KB, patch)
2023-06-20 16:08 UTC, Sam Lau
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 2023-06-20 13:46:02 UTC
The search we currently form is:
"extended_attributes.value": { "like": "%" + pattern + (search_type == "contain" ? "%" : "" )},

Which defaults to an 'ends with' search
Comment 1 Nick Clemens (kidclamp) 2023-06-20 13:50:20 UTC
Created attachment 152485 [details] [review]
Bug 34067: Correct patron attributes 'starts with' search

To test:
1 - Add a new searchable patron attribute type:
    Koha->Adminsitration->Patron attribute types
2 - Edit a patron and add a value 'alphabeta' for the attribute
3 - Go to 'Patrons', cick the settings icon in search and confirm search type is 'starts with'
4 - Type 'alpha' in the search bar, enter
5 - No patron found, wrong
6 - Type 'beta' in search bar, enter
7 - Patron found, wrong
8 - Apply patch
9 - Search for 'alpha', it finds the patron!
10 - Search for 'beta', patron not found
11 - Change search type to 'contains'
12 - Search for 'beta'
13 - Patron found!
Comment 2 Sam Lau 2023-06-20 16:08:05 UTC
Created attachment 152491 [details] [review]
Bug 34067: Correct patron attributes 'starts with' search

To test:
1 - Add a new searchable patron attribute type:
    Koha->Adminsitration->Patron attribute types
2 - Edit a patron and add a value 'alphabeta' for the attribute
3 - Go to 'Patrons', cick the settings icon in search and confirm search type is 'starts with'
4 - Type 'alpha' in the search bar, enter
5 - No patron found, wrong
6 - Type 'beta' in search bar, enter
7 - Patron found, wrong
8 - Apply patch
9 - Search for 'alpha', it finds the patron!
10 - Search for 'beta', patron not found
11 - Change search type to 'contains'
12 - Search for 'beta'
13 - Patron found!

Signed-off-by: Sam Lau <samalau@gmail.com>
Comment 3 Nick Clemens (kidclamp) 2023-07-10 13:59:06 UTC
This is solved in master by 34092 - that should either be backported, or we move this patch to a stables only queue and fix it here
Comment 4 Pedro Amorim 2023-07-10 14:40:50 UTC
I believe the plan is to push bug 34092 to 22.11.x, but we're waiting for it for first land on 23.05.x.
Comment 5 Nick Clemens (kidclamp) 2023-07-10 17:35:09 UTC
(In reply to Pedro Amorim from comment #4)
> I believe the plan is to push bug 34092 to 22.11.x, but we're waiting for it
> for first land on 23.05.x.

I'm going to close this as a duplicate then, thanks for the fix :-)

*** This bug has been marked as a duplicate of bug 34092 ***
Comment 6 Jonathan Druart 2023-07-11 07:04:53 UTC
(In reply to Pedro Amorim from comment #4)
> I believe the plan is to push bug 34092 to 22.11.x, but we're waiting for it
> for first land on 23.05.x.

I personally think we should extract the patron autocomplete (and or patron search) from staff-global and put it back into a specific js file.