Bug 34106

Summary: Patron search in member-search-box.inc always defaults to 'Starts with' search
Product: Koha Reporter: Lucas Gass <lucas>
Component: PatronsAssignee: Lucas Gass <lucas>
Status: RESOLVED FIXED QA Contact: Martin Renvoize <martin.renvoize>
Severity: major    
Priority: P5 - low CC: eveal, gmcharlt, kyle.m.hall, martin.renvoize, pedro.amorim, rcoert, sally.healey
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34094
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.02,22.11.08
Bug Depends on:    
Bug Blocks: 36339, 34094    
Attachments: Bug 34106: Retain searchtype parameter in member-search-box
Bug 34106: Retain searchtype parameter in member-search-box
Bug 34106: Retain searchtype parameter in member-search-box
Bug 34106: Update header search box searchtype when form is submitted
Bug 34106: Retain searchtype parameter in member-search-box
Bug 34106: Update header search box searchtype when form is submitted

Description Lucas Gass 2023-06-22 21:58:04 UTC
To recreate:

1. In the main search header switch to 'Search patrons'. Bring up the dropdown and look at 'Search type:'. 
2. It defaults to 'Starts with'.
3. Go to '/cgi-bin/koha/members/members-home.pl' and look at the 'Search type:' on the left side. 
4. It defaults to 'Contains'
5. Do a patron search from both these places, setting the 'Search type' to contains. 
6. The search bar in the header always resets to 'Starts with'
Comment 1 Lucas Gass 2023-06-22 21:58:53 UTC
I think these should both default to 'contains'/ And if you do a search with 'contains' it should always retain that parameter.
Comment 2 Lucas Gass 2023-06-22 22:01:46 UTC
Created attachment 152604 [details] [review]
Bug 34106: Retain searchtype parameter in member-search-box

To test:

1. In the main search header switch to 'Search patrons'. Bring up the dropdown and look at 'Search type:'.
2. It defaults to 'Starts with'.
3. Go to '/cgi-bin/koha/members/members-home.pl' and look at the 'Search type:' on the left side.
4. It defaults to 'Contains'
5. Do a patron search from both these places, setting the 'Search type' to contains.
6. The search bar in the header always resets to 'Starts with'
7. Apply patch
8. Try everything again. By default both places should default to contain.
9. If you change the 'Search type' the search in the main header should always retain that value.
Comment 3 Lucas Gass 2023-06-22 22:02:36 UTC
Marked as major because this can severely effect library workflows.
Comment 4 ByWater Sandboxes 2023-06-23 14:18:38 UTC
Created attachment 152641 [details] [review]
Bug 34106: Retain searchtype parameter in member-search-box

To test:

1. In the main search header switch to 'Search patrons'. Bring up the dropdown and look at 'Search type:'.
2. It defaults to 'Starts with'.
3. Go to '/cgi-bin/koha/members/members-home.pl' and look at the 'Search type:' on the left side.
4. It defaults to 'Contains'
5. Do a patron search from both these places, setting the 'Search type' to contains.
6. The search bar in the header always resets to 'Starts with'
7. Apply patch
8. Try everything again. By default both places should default to contain.
9. If you change the 'Search type' the search in the main header should always retain that value.

Signed-off-by: Ed Veal <eveal@mckinneytexas.org>
Comment 5 Martin Renvoize 2023-06-27 11:40:22 UTC
Please see also bug 34094 and bug 34092.. They both also resolve this issue I believe and attempt to ratify the code too.
Comment 6 Martin Renvoize 2023-06-27 13:42:51 UTC
Created attachment 152743 [details] [review]
Bug 34106: Retain searchtype parameter in member-search-box

To test:

1. In the main search header switch to 'Search patrons'. Bring up the dropdown and look at 'Search type:'.
2. It defaults to 'Starts with'.
3. Go to '/cgi-bin/koha/members/members-home.pl' and look at the 'Search type:' on the left side.
4. It defaults to 'Contains'
5. Do a patron search from both these places, setting the 'Search type' to contains.
6. The search bar in the header always resets to 'Starts with'
7. Apply patch
8. Try everything again. By default both places should default to contain.
9. If you change the 'Search type' the search in the main header should always retain that value.

Signed-off-by: Ed Veal <eveal@mckinneytexas.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 7 Pedro Amorim 2023-06-27 14:41:28 UTC
Created attachment 152748 [details] [review]
Bug 34106: Update header search box searchtype when form is submitted

We're updating the side menu searchtype when the search header is submitted, we should also update the searchtype in the search header when the form is submitted
Comment 8 Pedro Amorim 2023-06-27 14:43:49 UTC
@Lucas For me it felt weird having it update one way but not the other.
Can you test my patch and confirm it makes sense? Feel free to drop it if it doesn't!
Comment 9 Lucas Gass 2023-06-27 19:11:56 UTC
Since this is fixed in Bug 34094 we can mark this as resolved.

*** This bug has been marked as a duplicate of bug 34094 ***
Comment 10 Martin Renvoize 2023-06-28 09:14:53 UTC
Sorry Lucas, I don't think I was very clear here.. I rebased 34094 upon this removing the inline fixes there so we could keep the distinct parts of the fix clear and separate.. Pedro also added a follow-up to your patch here to improve the handling further.

I've unmarked it as duplicate and restored the dependency chain.. just going to test and SO it myself here now.
Comment 11 Martin Renvoize 2023-06-28 12:27:09 UTC
Created attachment 152785 [details] [review]
Bug 34106: Retain searchtype parameter in member-search-box

To test:

1. In the main search header switch to 'Search patrons'. Bring up the dropdown and look at 'Search type:'.
2. It defaults to 'Starts with'.
3. Go to '/cgi-bin/koha/members/members-home.pl' and look at the 'Search type:' on the left side.
4. It defaults to 'Contains'
5. Do a patron search from both these places, setting the 'Search type' to contains.
6. The search bar in the header always resets to 'Starts with'
7. Apply patch
8. Try everything again. By default both places should default to contain.
9. If you change the 'Search type' the search in the main header should always retain that value.

Signed-off-by: Ed Veal <eveal@mckinneytexas.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 12 Martin Renvoize 2023-06-28 12:27:12 UTC
Created attachment 152786 [details] [review]
Bug 34106: Update header search box searchtype when form is submitted

We're updating the side menu searchtype when the search header is submitted,
we should also update the searchtype in the search header when the form is submitted

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 13 Lucas Gass 2023-06-28 14:26:54 UTC
Sorry for the confusion here. Thanks Martin and Pedro, the follow-up makes perfect sense to me.
Comment 14 Tomás Cohen Arazi 2023-07-03 13:34:48 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 15 Martin Renvoize 2023-07-17 15:00:20 UTC
Thanks for all the hard work!

Pushed to 23.05.x for the next release
Comment 16 Matt Blenkinsop 2023-07-18 13:00:26 UTC
Nice work everyone!

Pushed to oldstable for 22.11.x