Bug 34517 - Add option to search patron attribute in standard search
Summary: Add option to search patron attribute in standard search
Status: Needs documenting
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Nick Clemens (kidclamp)
QA Contact: Katrin Fischer
URL:
Keywords:
Depends on: 26916
Blocks: 36301
  Show dependency treegraph
 
Reported: 2023-08-11 13:06 UTC by Nick Clemens (kidclamp)
Modified: 2024-03-12 16:33 UTC (History)
10 users (show)

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


Attachments
Bug 34517: DB updates (3.14 KB, patch)
2023-08-11 19:37 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34517: DO NOT PUSH - Schema Updates (1.86 KB, patch)
2023-08-11 19:37 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34517: Add boolean to search columns for schema (899 bytes, patch)
2023-08-11 19:37 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34517: Add option search patron attributes by default (6.94 KB, patch)
2023-08-11 19:37 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34517: DB updates (3.15 KB, patch)
2023-08-17 20:03 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34517: DO NOT PUSH - Schema Updates (1.86 KB, patch)
2023-08-17 20:03 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34517: Add boolean to search columns for schema (901 bytes, patch)
2023-08-17 20:03 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34517: Add option search patron attributes by default (7.80 KB, patch)
2023-08-17 20:03 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34517: DB updates (3.19 KB, patch)
2023-08-18 09:04 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 34517: DO NOT PUSH - Schema Updates (1.91 KB, patch)
2023-08-18 09:05 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 34517: Add boolean to search columns for schema (951 bytes, patch)
2023-08-18 09:05 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 34517: Add option search patron attributes by default (7.84 KB, patch)
2023-08-18 09:05 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 34517: DB updates (3.19 KB, patch)
2023-08-18 09:05 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 34517: DO NOT PUSH - Schema Updates (1.91 KB, patch)
2023-08-18 09:05 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 34517: Add boolean to search columns for schema (951 bytes, patch)
2023-08-18 09:05 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 34517: Add option search patron attributes by default (7.84 KB, patch)
2023-08-18 09:05 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 34517: DB updates (3.19 KB, patch)
2023-08-18 09:05 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 34517: DO NOT PUSH - Schema Updates (1.91 KB, patch)
2023-08-18 09:05 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 34517: Add boolean to search columns for schema (951 bytes, patch)
2023-08-18 09:05 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 34517: Add option search patron attributes by default (7.84 KB, patch)
2023-08-18 09:05 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 34517: DB updates (3.20 KB, patch)
2023-08-18 09:13 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 34517: DO NOT PUSH - Schema Updates (1.92 KB, patch)
2023-08-18 09:13 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 34517: Add boolean to search columns for schema (960 bytes, patch)
2023-08-18 09:13 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 34517: Add option search patron attributes by default (7.85 KB, patch)
2023-08-18 09:13 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 34517: DB updates (3.26 KB, patch)
2023-11-05 01:21 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 34517: DO NOT PUSH - Schema Updates (1.97 KB, patch)
2023-11-05 01:21 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 34517: Add boolean to search columns for schema (1017 bytes, patch)
2023-11-05 01:21 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 34517: Add option search patron attributes by default (7.90 KB, patch)
2023-11-05 01:21 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 34517: (QA follow-up) Perltidy and fix column check (1.98 KB, patch)
2023-11-05 01:21 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 34517: (follow-up) Mark test attribute as searched_by_default (1.24 KB, patch)
2023-11-13 13:05 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34517: (follow-up) Add test for attribute search field and make cleanup more robust (5.15 KB, patch)
2023-11-13 14:13 UTC, Nick Clemens (kidclamp)
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-08-11 13:06:27 UTC
Currently if a patron attribute is marked 'staff_searchable' it is always searched when using a 'standard search' 

It should be possible to make attributes searchable without searching them by default
Comment 1 Nick Clemens (kidclamp) 2023-08-11 19:37:24 UTC
Created attachment 154389 [details] [review]
Bug 34517: DB updates
Comment 2 Nick Clemens (kidclamp) 2023-08-11 19:37:26 UTC
Created attachment 154390 [details] [review]
Bug 34517: DO NOT PUSH - Schema Updates
Comment 3 Nick Clemens (kidclamp) 2023-08-11 19:37:28 UTC
Created attachment 154391 [details] [review]
Bug 34517: Add boolean to search columns for schema
Comment 4 Nick Clemens (kidclamp) 2023-08-11 19:37:30 UTC
Created attachment 154392 [details] [review]
Bug 34517: Add option search patron attributes by default

This patch moves form any staff_searchable attribute being automatically
included in the the Standard patron serch, to allowing the librarian to choose.
Current searchable attributes will be marked as 'searched_by_default'

To test:
1 - Add a searchable patron attribute type
2 - Add some values
3 - Confirm they are searched in a 'Standard' patron search
4 - Apply patch
5 - Go to admin - >patron attribute types
6 - Note new 'Searching' column
7 - Confirm attribute is 'Searched by default'
8 - Confirm searches work as before
9 - Edit the attribute type
10 - Uncheck 'searched_by_default'
11 - Save
12 - Confirm attribute not searched in 'Standard' search
13 - Select the attribute in patron search dropdowns
14 - Confirm it is correctly searched
Comment 5 Inkeri Hakulinen 2023-08-17 11:10:45 UTC
At the test phase step 13 the new patron attribute does not appear in any dropdown menus, so I cannot test if it's searchable or not. Other steps until that work as planned.
Comment 6 Inkeri Hakulinen 2023-08-17 11:14:03 UTC
I tested this but I couldn't get it working.
Comment 7 Kelly McElligott 2023-08-17 11:57:49 UTC Comment hidden (obsolete)
Comment 8 Andrew Auld 2023-08-17 13:04:11 UTC
Something broke when I applied the patch on the sandbox and went back to Patron Attributes in admin
Comment 9 Nick Clemens (kidclamp) 2023-08-17 20:03:38 UTC
Created attachment 154575 [details] [review]
Bug 34517: DB updates
Comment 10 Nick Clemens (kidclamp) 2023-08-17 20:03:41 UTC
Created attachment 154576 [details] [review]
Bug 34517: DO NOT PUSH - Schema Updates
Comment 11 Nick Clemens (kidclamp) 2023-08-17 20:03:44 UTC
Created attachment 154577 [details] [review]
Bug 34517: Add boolean to search columns for schema
Comment 12 Nick Clemens (kidclamp) 2023-08-17 20:03:47 UTC
Created attachment 154578 [details] [review]
Bug 34517: Add option search patron attributes by default

This patch moves form any staff_searchable attribute being automatically
included in the the Standard patron serch, to allowing the librarian to choose.
Current searchable attributes will be marked as 'searched_by_default'

To test:
1 - Add a searchable patron attribute type
2 - Add some values
3 - Confirm they are searched in a 'Standard' patron search
4 - Apply patch
5 - Go to admin - >patron attribute types
6 - Note new 'Searching' column
7 - Confirm attribute is 'Searched by default'
8 - Confirm searches work as before
9 - Edit the attribute type
10 - Uncheck 'searched_by_default'
11 - Save
12 - Confirm attribute not searched in 'Standard' search
13 - Select the attribute in patron search dropdowns
14 - Confirm it is correctly searched
Comment 13 Nick Clemens (kidclamp) 2023-08-18 07:18:40 UTC
(In reply to Andrew Auld from comment #8)
> Something broke when I applied the patch on the sandbox and went back to
> Patron Attributes in admin

Dependencies reordered and rebased, should work now
Comment 14 PTFS Europe Sandboxes 2023-08-18 09:04:58 UTC
Created attachment 154608 [details] [review]
Bug 34517: DB updates

Signed-off-by: Andrew <andrew.auld@ptfs-europe.com>
Comment 15 PTFS Europe Sandboxes 2023-08-18 09:05:00 UTC
Created attachment 154610 [details] [review]
Bug 34517: DO NOT PUSH - Schema Updates

Signed-off-by: Andrew <andrew.auld@ptfs-europe.com>
Comment 16 PTFS Europe Sandboxes 2023-08-18 09:05:03 UTC
Created attachment 154611 [details] [review]
Bug 34517: Add boolean to search columns for schema

Signed-off-by: Andrew <andrew.auld@ptfs-europe.com>
Comment 17 PTFS Europe Sandboxes 2023-08-18 09:05:06 UTC
Created attachment 154612 [details] [review]
Bug 34517: Add option search patron attributes by default

This patch moves form any staff_searchable attribute being automatically
included in the the Standard patron serch, to allowing the librarian to choose.
Current searchable attributes will be marked as 'searched_by_default'

To test:
1 - Add a searchable patron attribute type
2 - Add some values
3 - Confirm they are searched in a 'Standard' patron search
4 - Apply patch
5 - Go to admin - >patron attribute types
6 - Note new 'Searching' column
7 - Confirm attribute is 'Searched by default'
8 - Confirm searches work as before
9 - Edit the attribute type
10 - Uncheck 'searched_by_default'
11 - Save
12 - Confirm attribute not searched in 'Standard' search
13 - Select the attribute in patron search dropdowns
14 - Confirm it is correctly searched

Signed-off-by: Andrew <andrew.auld@ptfs-europe.com>
Comment 18 PTFS Europe Sandboxes 2023-08-18 09:05:27 UTC
Created attachment 154613 [details] [review]
Bug 34517: DB updates

Signed-off-by: Andrew <andrew.auld@ptfs-europe.com>
Comment 19 PTFS Europe Sandboxes 2023-08-18 09:05:30 UTC
Created attachment 154614 [details] [review]
Bug 34517: DO NOT PUSH - Schema Updates

Signed-off-by: Andrew <andrew.auld@ptfs-europe.com>
Comment 20 PTFS Europe Sandboxes 2023-08-18 09:05:33 UTC
Created attachment 154615 [details] [review]
Bug 34517: Add boolean to search columns for schema

Signed-off-by: Andrew <andrew.auld@ptfs-europe.com>
Comment 21 PTFS Europe Sandboxes 2023-08-18 09:05:35 UTC
Created attachment 154616 [details] [review]
Bug 34517: Add option search patron attributes by default

This patch moves form any staff_searchable attribute being automatically
included in the the Standard patron serch, to allowing the librarian to choose.
Current searchable attributes will be marked as 'searched_by_default'

To test:
1 - Add a searchable patron attribute type
2 - Add some values
3 - Confirm they are searched in a 'Standard' patron search
4 - Apply patch
5 - Go to admin - >patron attribute types
6 - Note new 'Searching' column
7 - Confirm attribute is 'Searched by default'
8 - Confirm searches work as before
9 - Edit the attribute type
10 - Uncheck 'searched_by_default'
11 - Save
12 - Confirm attribute not searched in 'Standard' search
13 - Select the attribute in patron search dropdowns
14 - Confirm it is correctly searched

Signed-off-by: Andrew <andrew.auld@ptfs-europe.com>
Comment 22 PTFS Europe Sandboxes 2023-08-18 09:05:48 UTC
Created attachment 154617 [details] [review]
Bug 34517: DB updates

Signed-off-by: Andrew <andrew.auld@ptfs-europe.com>
Comment 23 PTFS Europe Sandboxes 2023-08-18 09:05:51 UTC
Created attachment 154618 [details] [review]
Bug 34517: DO NOT PUSH - Schema Updates

Signed-off-by: Andrew <andrew.auld@ptfs-europe.com>
Comment 24 PTFS Europe Sandboxes 2023-08-18 09:05:54 UTC
Created attachment 154619 [details] [review]
Bug 34517: Add boolean to search columns for schema

Signed-off-by: Andrew <andrew.auld@ptfs-europe.com>
Comment 25 PTFS Europe Sandboxes 2023-08-18 09:05:56 UTC
Created attachment 154620 [details] [review]
Bug 34517: Add option search patron attributes by default

This patch moves form any staff_searchable attribute being automatically
included in the the Standard patron serch, to allowing the librarian to choose.
Current searchable attributes will be marked as 'searched_by_default'

To test:
1 - Add a searchable patron attribute type
2 - Add some values
3 - Confirm they are searched in a 'Standard' patron search
4 - Apply patch
5 - Go to admin - >patron attribute types
6 - Note new 'Searching' column
7 - Confirm attribute is 'Searched by default'
8 - Confirm searches work as before
9 - Edit the attribute type
10 - Uncheck 'searched_by_default'
11 - Save
12 - Confirm attribute not searched in 'Standard' search
13 - Select the attribute in patron search dropdowns
14 - Confirm it is correctly searched

Signed-off-by: Andrew <andrew.auld@ptfs-europe.com>
Comment 26 Andrew Auld 2023-08-18 09:07:07 UTC
Sorry for multiple Sandbox sign-offs...something was glitchy in the connection and it kept failing, but obviously it wasn't!
Great patches, thanks Nick!
Comment 27 ByWater Sandboxes 2023-08-18 09:13:28 UTC
Created attachment 154622 [details] [review]
Bug 34517: DB updates

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Comment 28 ByWater Sandboxes 2023-08-18 09:13:30 UTC
Created attachment 154623 [details] [review]
Bug 34517: DO NOT PUSH - Schema Updates

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Comment 29 ByWater Sandboxes 2023-08-18 09:13:32 UTC
Created attachment 154624 [details] [review]
Bug 34517: Add boolean to search columns for schema

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Comment 30 ByWater Sandboxes 2023-08-18 09:13:34 UTC
Created attachment 154625 [details] [review]
Bug 34517: Add option search patron attributes by default

This patch moves form any staff_searchable attribute being automatically
included in the the Standard patron serch, to allowing the librarian to choose.
Current searchable attributes will be marked as 'searched_by_default'

To test:
1 - Add a searchable patron attribute type
2 - Add some values
3 - Confirm they are searched in a 'Standard' patron search
4 - Apply patch
5 - Go to admin - >patron attribute types
6 - Note new 'Searching' column
7 - Confirm attribute is 'Searched by default'
8 - Confirm searches work as before
9 - Edit the attribute type
10 - Uncheck 'searched_by_default'
11 - Save
12 - Confirm attribute not searched in 'Standard' search
13 - Select the attribute in patron search dropdowns
14 - Confirm it is correctly searched

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Comment 31 Jonathan Druart 2023-09-01 08:44:23 UTC
What's the use case? What are you trying to solve here?
Comment 32 Nick Clemens (kidclamp) 2023-09-01 10:51:34 UTC
(In reply to Jonathan Druart from comment #31)
> What's the use case? What are you trying to solve here?

Not every attribute that a library wants to search needs to be searched every time.

Libraries may have alternate IDs or other fields that they wish to search on their own, and not as part of the standard search.

The dependency adds those to the search options, so this then allows removing from standard search
Comment 33 Katrin Fischer 2023-10-21 09:11:31 UTC
Currently blocked by depending patch not applying.
Comment 34 Katrin Fischer 2023-11-05 01:21:07 UTC
Created attachment 158429 [details] [review]
Bug 34517: DB updates

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 35 Katrin Fischer 2023-11-05 01:21:10 UTC
Created attachment 158430 [details] [review]
Bug 34517: DO NOT PUSH - Schema Updates

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 36 Katrin Fischer 2023-11-05 01:21:14 UTC
Created attachment 158431 [details] [review]
Bug 34517: Add boolean to search columns for schema

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 37 Katrin Fischer 2023-11-05 01:21:17 UTC
Created attachment 158432 [details] [review]
Bug 34517: Add option search patron attributes by default

This patch moves form any staff_searchable attribute being automatically
included in the the Standard patron serch, to allowing the librarian to choose.
Current searchable attributes will be marked as 'searched_by_default'

To test:
1 - Add a searchable patron attribute type
2 - Add some values
3 - Confirm they are searched in a 'Standard' patron search
4 - Apply patch
5 - Go to admin - >patron attribute types
6 - Note new 'Searching' column
7 - Confirm attribute is 'Searched by default'
8 - Confirm searches work as before
9 - Edit the attribute type
10 - Uncheck 'searched_by_default'
11 - Save
12 - Confirm attribute not searched in 'Standard' search
13 - Select the attribute in patron search dropdowns
14 - Confirm it is correctly searched

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 38 Katrin Fischer 2023-11-05 01:21:21 UTC
Created attachment 158433 [details] [review]
Bug 34517: (QA follow-up) Perltidy and fix column check

Without the fix a second run of the database update would fail.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 39 Jonathan Druart 2023-11-07 10:29:13 UTC
IMO selenium tests are required for any changes to patron search.
Comment 40 Tomás Cohen Arazi 2023-11-09 13:15:28 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 41 David Cook 2023-11-09 23:55:36 UTC
(In reply to Jonathan Druart from comment #39)
> IMO selenium tests are required for any changes to patron search.

It looks like a recent change (possibly this one) has broken ./t/db_dependent/selenium/patrons_search.t

Taking a look now...
Comment 42 David Cook 2023-11-10 00:07:42 UTC
(In reply to David Cook from comment #41)
> (In reply to Jonathan Druart from comment #39)
> > IMO selenium tests are required for any changes to patron search.
> 
> It looks like a recent change (possibly this one) has broken
> ./t/db_dependent/selenium/patrons_search.t
> 
> Taking a look now...

Yep, this is the change that broke subtests 22, 23, and 24 in ./t/db_dependent/selenium/patrons_search.t


    not ok 22 - Searching on a searchable attribute returns correct results

    #   Failed test 'Searching on a searchable attribute returns correct results'
    #   at ./t/db_dependent/selenium/patrons_search.t line 277.
    #          got: 'No entries to show (filtered from 80 total entries)'
    #     expected: 'Showing 1 to 2 of 2 entries (filtered from 80 total entries)'
    not ok 23 - Refining with DataTables search works to further filter the original query

    #   Failed test 'Refining with DataTables search works to further filter the original query'
    #   at ./t/db_dependent/selenium/patrons_search.t line 283.
    #          got: 'No entries to show (filtered from 80 total entries)'
    #     expected: 'Showing 1 to 2 of 2 entries (filtered from 80 total entries)'
    not ok 24 - Refining with header filters works to further filter the original query

    #   Failed test 'Refining with header filters works to further filter the original query'
    #   at ./t/db_dependent/selenium/patrons_search.t line 289.
    #          got: 'No entries to show (filtered from 80 total entries)'
    #     expected: 'Showing 1 to 1 of 1 entries (filtered from 80 total entries)'
Comment 43 Fridolin Somers 2023-11-11 07:14:17 UTC
Depends on Bug 26916 not in 23.05.x
Comment 44 Nick Clemens (kidclamp) 2023-11-13 13:05:40 UTC
Created attachment 158876 [details] [review]
Bug 34517: (follow-up) Mark test attribute as searched_by_default
Comment 45 Nick Clemens (kidclamp) 2023-11-13 14:13:45 UTC
Created attachment 158878 [details] [review]
Bug 34517: (follow-up) Add test for attribute search field and make cleanup more robust

This patch adds a test to cover the new functionality of searching an attribute not searched by default.

It also moves the addition of objects to the cleanup array right after they are created. Patrons are added to the front of the array to ensure no constraints are violated when deleting. This change ensures that if the tests die before reachign the end, the data generated is still cleaned up.
Comment 46 Nick Clemens (kidclamp) 2023-11-13 14:14:20 UTC
(In reply to Jonathan Druart from comment #39)
> IMO selenium tests are required for any changes to patron search.

Tests added, with a slight adjustment to improve cleanup
Comment 47 Jonathan Druart 2023-11-14 07:41:46 UTC
Last two patches pushed to master. Thanks!