Bug 40865 - Single patron result does not redirect
Summary: Single patron result does not redirect
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on: 38255
Blocks:
  Show dependency treegraph
 
Reported: 2025-09-23 19:34 UTC by Nick Clemens (kidclamp)
Modified: 2025-09-25 18:14 UTC (History)
10 users (show)

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


Attachments
Bug 40865: Redirect if only one patron is found (1.42 KB, patch)
2025-09-25 10:54 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 40865: Add a cypress test (2.22 KB, patch)
2025-09-25 12:04 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 40865: Redirect if only one patron is found (1.48 KB, patch)
2025-09-25 18:12 UTC, Brendan Lawlor
Details | Diff | Splinter Review
Bug 40865: Add a cypress test (2.27 KB, patch)
2025-09-25 18:12 UTC, Brendan Lawlor
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) 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