Bug 39875

Summary: ILL - History check fails if unauthenticated request
Product: Koha Reporter: Pedro Amorim <pedro.amorim>
Component: ILLAssignee: Pedro Amorim <pedro.amorim>
Status: Pushed to stable --- QA Contact: Marcel de Rooy <m.de.rooy>
Severity: normal    
Priority: P5 - low CC: david, m.de.rooy, martin.renvoize, pedro.amorim, tomascohen
Version: MainKeywords: RM_priority
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: Trivial patch Documentation contact:
Documentation submission: Text to go in the release notes:
This fixes the ILL request history check (added in Koha 25.05 by bug 38441 - Allow for an ILL history check workflow stage). If there is no patron, or it is an unauthenticated request, then the check to see if the same request has been made is no longer performed (requires enbaling the ILLHistoryCheck system preference).
Version(s) released in:
25.11.00,25.05.01
Circulation function:
Bug Depends on: 38441    
Bug Blocks:    
Attachments: Bug 39875: Add tests
Bug 39875: Dont show history check
Bug 39875: Add tests
Bug 39875: Dont show history check
Bug 39875: Add tests
Bug 39875: Dont show history check
Bug 39875: Add tests
Bug 39875: Dont show history check
Bug 39875: Add tests
Bug 39875: Dont show history check
Bug 39875: (QA follow-up): Correct historycheck ui_context

Description Pedro Amorim 2025-05-12 13:28:39 UTC

    
Comment 1 Pedro Amorim 2025-05-12 13:33:33 UTC
Created attachment 182273 [details] [review]
Bug 39875: Add tests
Comment 2 Pedro Amorim 2025-05-12 13:33:35 UTC
Created attachment 182274 [details] [review]
Bug 39875: Dont show history check

Unless there is a cardnumber or an authenticated user

Test plan:
1) Apply only the the tests file highlighting the issue:
prove t/db_dependent/Koha/ILL/Request/Workflow/HistoryCheck.t
2) Notice it fails.
3) Apply this patch.
4) Run tests again. Notice it passes.
Comment 3 David Nind 2025-05-12 14:33:05 UTC
Created attachment 182291 [details] [review]
Bug 39875: Add tests

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 David Nind 2025-05-12 14:33:08 UTC
Created attachment 182292 [details] [review]
Bug 39875: Dont show history check

Unless there is a cardnumber or an authenticated user

Test plan:
1) Apply only the the tests file highlighting the issue:
prove t/db_dependent/Koha/ILL/Request/Workflow/HistoryCheck.t
2) Notice it fails.
3) Apply this patch.
4) Run tests again. Notice it passes.

Signed-off-by: David Nind <david@davidnind.com>
Comment 5 Lin Wei 2025-05-12 14:41:30 UTC
Created attachment 182295 [details] [review]
Bug 39875: Add tests

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lin Wei Li <lin-wei.li@inLibro.com>
Comment 6 Lin Wei 2025-05-12 14:41:33 UTC
Created attachment 182296 [details] [review]
Bug 39875: Dont show history check

Unless there is a cardnumber or an authenticated user

Test plan:
1) Apply only the the tests file highlighting the issue:
prove t/db_dependent/Koha/ILL/Request/Workflow/HistoryCheck.t
2) Notice it fails.
3) Apply this patch.
4) Run tests again. Notice it passes.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lin Wei Li <lin-wei.li@inLibro.com>
Comment 7 Marcel de Rooy 2025-05-30 07:30:24 UTC
 FAIL   Koha/ILL/Request/Workflow/HistoryCheck.pm
   FAIL   tidiness
                File is not tidy, please run `perl misc/devel/tidy.pl Koha/ILL/Request/Workflow/HistoryCheck.pm`

 FAIL   t/db_dependent/Koha/ILL/Request/Workflow/HistoryCheck.t
   FAIL   tidiness
                File is not tidy, please run `perl misc/devel/tidy.pl t/db_dependent/Koha/ILL/Request/Workflow/HistoryCheck.t`
Comment 8 Pedro Amorim 2025-05-30 13:12:21 UTC
Created attachment 182858 [details] [review]
Bug 39875: Add tests

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lin Wei Li <lin-wei.li@inLibro.com>
Comment 9 Pedro Amorim 2025-05-30 13:12:24 UTC
Created attachment 182859 [details] [review]
Bug 39875: Dont show history check

Unless there is a cardnumber or an authenticated user

Test plan:
1) Apply only the the tests file highlighting the issue:
prove t/db_dependent/Koha/ILL/Request/Workflow/HistoryCheck.t
2) Notice it fails.
3) Apply this patch.
4) Run tests again. Notice it passes.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lin Wei Li <lin-wei.li@inLibro.com>
Comment 10 Marcel de Rooy 2025-06-06 07:33:45 UTC
Created attachment 183051 [details] [review]
Bug 39875: Add tests

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lin Wei Li <lin-wei.li@inLibro.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 11 Marcel de Rooy 2025-06-06 07:33:47 UTC
Created attachment 183052 [details] [review]
Bug 39875: Dont show history check

Unless there is a cardnumber or an authenticated user

Test plan:
1) Apply only the the tests file highlighting the issue:
prove t/db_dependent/Koha/ILL/Request/Workflow/HistoryCheck.t
2) Notice it fails.
3) Apply this patch.
4) Run tests again. Notice it passes.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lin Wei Li <lin-wei.li@inLibro.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 12 Pedro Amorim 2025-06-06 09:47:55 UTC
Created attachment 183065 [details] [review]
Bug 39875: (QA follow-up): Correct historycheck ui_context

This ui_context is supposed to be opac, not staff.
For the purposes of these tests, this is not important, as the ui_context is
only needed for the template params and this is testing if the history check
stage is supposed to show or not.
Reckon this was a copy paste without consequences hence missed, but the code
is now semantically more correct.

prove t/db_dependent/Koha/ILL/Request/Workflow/HistoryCheck.t
Comment 13 Lucas Gass (lukeg) 2025-06-06 15:43:51 UTC
Nice work everyone!

Pushed to main for 25.11
Comment 14 Paul Derscheid 2025-06-22 21:47:00 UTC
Nice work everyone!

Pushed to 25.05.x for 25.05.03
Comment 15 David Nind 2025-07-01 21:18:16 UTC
Attempted a release note - please update it if I haven't got it right.