Bug 30098 - Patron search redirects when one result on any page of results
Summary: Patron search redirects when one result on any page of results
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Nick Clemens
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 30325
  Show dependency treegraph
 
Reported: 2022-02-14 18:38 UTC by Nick Clemens
Modified: 2022-03-25 08:59 UTC (History)
9 users (show)

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


Attachments
Bug 30098: ONly redirect from patron search if single result is on first page (1.75 KB, patch)
2022-02-14 18:40 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 30098: ONly redirect from patron search if single result is on first page (1.90 KB, patch)
2022-02-15 15:39 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 30098: Only redirect from patron search if single result is on first page (1.96 KB, patch)
2022-03-01 15:22 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens 2022-02-14 18:38:01 UTC
The patron search has a redirect built in to send you directly to the patron if there is only a single result from your search.

This is also triggered, however, when a later page has only 1 result

To recreate:
1 - Perform a patron search that returns 41 results, on Koha testing docker, 'a' works
2 - Go to second page of results, works
3 - Go to third page of results, redirected to the patron
Comment 1 Nick Clemens 2022-02-14 18:40:11 UTC
Created attachment 130564 [details] [review]
Bug 30098: ONly redirect from patron search if single result is on first page

This patch simply adds a check that we are oin the first page (starting at result 0)
before redirecting to a isngle patron

To test:
1 - Perform a patron search that returns 41 results, on Koha testing docker, 'a' works
2 - Go to second page of results, works
3 - Go to third page of results, redirected to the patron
4 - Apply patch
5 - Repeat search and paging
6 - On third page you remian in results and are not redirected to patron
Comment 2 Kyle M Hall 2022-02-15 15:39:47 UTC
Created attachment 130626 [details] [review]
Bug 30098: ONly redirect from patron search if single result is on first page

This patch simply adds a check that we are oin the first page (starting at result 0)
before redirecting to a isngle patron

To test:
1 - Perform a patron search that returns 41 results, on Koha testing docker, 'a' works
2 - Go to second page of results, works
3 - Go to third page of results, redirected to the patron
4 - Apply patch
5 - Repeat search and paging
6 - On third page you remian in results and are not redirected to patron

Signed-off-by: Emmanuel Bétemps <e.betemps@gmail.com>
Comment 3 Jonathan Druart 2022-02-18 09:04:41 UTC
I've fixed that on by 30063 by testing json.iTotalDisplayRecords == 1, I think it's the correct way to do.
Comment 4 Martin Renvoize 2022-03-01 15:22:45 UTC
Created attachment 131191 [details] [review]
Bug 30098: Only redirect from patron search if single result is on first page

This patch simply adds a check that we are oin the first page (starting at result 0)
before redirecting to a isngle patron

To test:
1 - Perform a patron search that returns 41 results, on Koha testing docker, 'a' works
2 - Go to second page of results, works
3 - Go to third page of results, redirected to the patron
4 - Apply patch
5 - Repeat search and paging
6 - On third page you remian in results and are not redirected to patron

Signed-off-by: Emmanuel Bétemps <e.betemps@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Martin Renvoize 2022-03-01 15:25:52 UTC
Hmm, just read Jonathans comment.. I think he's right, that's a slightly cleaner solution with one less test.  I'll PQA as there's not real issue with this code and leave it to the RM to decide which of the two options is 'nicest'... we can always have the solution from bug 30063 once that's worked it's way through anyway.

PQA
Comment 6 Fridolin Somers 2022-03-04 01:50:31 UTC
Mmmm tiny patch and it works, I push and send my best wishes to Bug 30063
Comment 7 Fridolin Somers 2022-03-04 02:12:26 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄
Comment 8 Kyle M Hall 2022-03-04 14:57:37 UTC
Pushed to 21.11.x for 21.11.04
Comment 9 Andrew Fuerste-Henry 2022-03-20 15:53:22 UTC
Pushed to 21.05.x for 21.05.13
Comment 10 Victor Grousset/tuxayo 2022-03-21 00:19:54 UTC
Not backported to oldoldstable (20.11.x). Feel free to ask if it's needed.
Comment 11 Jonathan Druart 2022-03-21 13:06:30 UTC
This does not work. There is no redirect if only 1 patron is returned.
Comment 12 Fridolin Somers 2022-03-21 22:18:10 UTC
(In reply to Jonathan Druart from comment #11)
> This does not work. There is no redirect if only 1 patron is returned.

Oh crap !
We did not saw this.

I've opened Bug 30325.
The fix from comment 3 looks perfect.

Lets validate it fast for this month release.
Comment 13 Andrew Fuerste-Henry 2022-03-24 17:30:25 UTC
(In reply to Andrew Fuerste-Henry from comment #9)
> Pushed to 21.05.x for 21.05.13

I've reverted this in 21.05.x, it is no longer backported.
Comment 14 Jonathan Druart 2022-03-25 08:59:52 UTC
(In reply to Andrew Fuerste-Henry from comment #13)
> (In reply to Andrew Fuerste-Henry from comment #9)
> > Pushed to 21.05.x for 21.05.13
> 
> I've reverted this in 21.05.x, it is no longer backported.

I think you should pick bug 30325 then.