Bug 40865

Summary: Single patron result does not redirect
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: Staff interfaceAssignee: Jonathan Druart <jonathan.druart>
Status: Needs documenting --- QA Contact: Marcel de Rooy <m.de.rooy>
Severity: normal    
Priority: P5 - low CC: baptiste.wojtkowski, blawlor, carthur, cbrannon, ephetteplace, eric_styles, gmcharlt, jonathan.druart, julie, kkrueger, lucas, m.de.rooy, maxeinergl, mikko.liimatainen, pedro.amorim, rcoert, sbcornell
Version: MainKeywords: rel_25_05_candidate, release-notes-needed
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33495
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.11.00,25.05.05
Circulation function:
Bug Depends on: 38255    
Bug Blocks:    
Attachments: Bug 40865: Redirect if only one patron is found
Bug 40865: Add a cypress test
Bug 40865: Redirect if only one patron is found
Bug 40865: Add a cypress test
Bug 40865: Redirect if only one patron is found
Bug 40865: Add a cypress test

Description Nick Clemens (kidclamp) 2025-09-23 19:34:17 UTC
Possibly related to bug 36302 

To recreate:
1 - Search for 'edna acosta' in check out search on koha home page
2 - See the one result
3 - You are expected to be redirected to the patron's page
Comment 1 Pedro Amorim 2025-09-24 09:43:22 UTC
e9b8004d197876dea8c38374c08ec00451e37020 is the first bad commit
commit e9b8004d197876dea8c38374c08ec00451e37020
Author: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date:   Thu Nov 28 16:20:24 2024 +0100

    Bug 38255: Replace dataTable constructor with kohaTable - Staff
    
    Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
    Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
    Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
    
    ----
    
    reset HEAD to commit before 38255, redirect works:
    b4662eb60acbfe64ca60934ec31d9d078f0fac5a
    
    reset HEAD to first commit of bug 38255, redirect doesnt work:
    e9b8004d197876dea8c38374c08ec00451e37020

    reset to final commit of bug 38255, redirect still doesnt work:
    8ff56432d125fee3fdb32499382e01707876c758
Comment 2 Mikko Liimatainen 2025-09-25 09:43:34 UTC
This is a good feature for us. Name searches should never redirect even if there is a single result.

I would like to again suggest that there should be a system preference similar to the catalogue preference RedirectToSoleResult for patrons. We would like it to only redirect on exact match of a card number.
Comment 3 Jonathan Druart 2025-09-25 10:54:23 UTC
Created attachment 186917 [details] [review]
Bug 40865: Redirect if only one patron is found

Regression from
  commit e9b8004d197876dea8c38374c08ec00451e37020
  Bug 38255: Replace dataTable constructor with kohaTable - Staff

We should keep the params passed and not override them

Test plan:
1 - Search for 'edna acosta' in check out search on koha home page
2 - See the one result
3 - You are expected to be redirected to the patron's page
Comment 4 Jonathan Druart 2025-09-25 11:31:08 UTC
Several things to note:
1. main is broken at the moment (we are waiting for bug 40876 and bug 40565)
2. We need a test here
3. I am currently trying to catch possible side-effects
Comment 5 Jonathan Druart 2025-09-25 12:04:02 UTC
Created attachment 186920 [details] [review]
Bug 40865: Add a cypress test
Comment 6 Sarah Cornell 2025-09-25 14:14:26 UTC
+1 for a system preference selecting the behavior.  We would like name searches even with partial information to redirect to the patron's page when there is only one result.
Comment 7 Jonathan Druart 2025-09-25 14:55:14 UTC
This patch is restoring the historical behaviour. If we need a pref it should be on a separate bug report IMO.
Comment 8 Christopher Brannon 2025-09-25 16:15:35 UTC
Great.  That would be perfect for bug 33495.
Comment 9 Brendan Lawlor 2025-09-25 18:12:10 UTC
Created attachment 186926 [details] [review]
Bug 40865: Redirect if only one patron is found

Regression from
  commit e9b8004d197876dea8c38374c08ec00451e37020
  Bug 38255: Replace dataTable constructor with kohaTable - Staff

We should keep the params passed and not override them

Test plan:
1 - Search for 'edna acosta' in check out search on koha home page
2 - See the one result
3 - You are expected to be redirected to the patron's page

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Comment 10 Brendan Lawlor 2025-09-25 18:12:13 UTC
Created attachment 186927 [details] [review]
Bug 40865: Add a cypress test

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Comment 11 Brendan Lawlor 2025-09-25 18:14:54 UTC
This works as described to restore the original behavior of redirecting when one result is returned. 

Note when testing you may have to do yarn build && restart_all for it to take effect
Comment 12 Marcel de Rooy 2025-09-26 06:41:51 UTC
Created attachment 186955 [details] [review]
Bug 40865: Redirect if only one patron is found

Regression from
  commit e9b8004d197876dea8c38374c08ec00451e37020
  Bug 38255: Replace dataTable constructor with kohaTable - Staff

We should keep the params passed and not override them

Test plan:
1 - Search for 'edna acosta' in check out search on koha home page
2 - See the one result
3 - You are expected to be redirected to the patron's page

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 13 Marcel de Rooy 2025-09-26 06:41:53 UTC
Created attachment 186956 [details] [review]
Bug 40865: Add a cypress test

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 14 Lucas Gass (lukeg) 2025-09-26 16:41:49 UTC
Nice work everyone!

Pushed to main for 25.11
Comment 15 Gretchen Maxeiner 2025-09-29 12:25:07 UTC
Will this fix also restore direct access for other non-cardnumber searches besides name? Our patrons use ProxIDs at the circulation desk, and that uses a unique ID that is in a sort field. We need this to go direct to the patron record and check-out screen as it did before. This is affecting every checkout we do. For this reason I would also ask if this be backported to 25.05 so that it will be available sooner. Thank you!
Comment 16 Kristi Krueger 2025-10-02 13:05:57 UTC
Is this a candidate for backport?
Comment 17 Paul Derscheid 2025-10-23 21:11:12 UTC
Nice work everyone!

Pushed to 25.05.x
Comment 18 Baptiste Wojtkowski (bwoj) 2025-10-31 14:45:49 UTC
Bug not reproduced in 24.11.x, code is different, not backporting.