Bug 38441

Summary: ILL - Allow for a history check workflow stage
Product: Koha Reporter: Pedro Amorim <pedro.amorim>
Component: ILLAssignee: Pedro Amorim <pedro.amorim>
Status: Needs Signoff --- QA Contact: Testopia <testopia>
Severity: new feature    
Priority: P5 - low CC: andrew.auld, edith.speller, jeremy.evans, katrin.fischer, martin.renvoize, pedro.amorim, tomascohen
Version: Main   
Hardware: All   
OS: All   
URL: https://github.com/PTFS-Europe/koha/commits/bug_38441/
Change sponsored?: --- Patch complexity: Medium patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 36197, 37448    
Bug Blocks:    
Attachments: Bug 38441: New 'ILLHistoryCheck' system preference
Bug 38441: atomicupdate
Bug 38441: HistoryCheck Koha class
Bug 38441: ILLHistoryCheck: Staff UI
Bug 38441: ILLHistoryCheck: OPAC
Bug 38441: Allow / render HTML in ILL staff notes
Bug 38441: Style updates for staffnotes
Bug 38441: Add tests

Description Pedro Amorim 2024-11-14 10:49:36 UTC
A workflow stage that performs a check on whether an ILL request being placed has already been placed in the past or not.
Comment 1 Pedro Amorim 2024-11-15 16:20:28 UTC
Created attachment 174604 [details] [review]
Bug 38441: New 'ILLHistoryCheck' system preference
Comment 2 Pedro Amorim 2024-11-15 16:20:30 UTC
Created attachment 174605 [details] [review]
Bug 38441: atomicupdate
Comment 3 Pedro Amorim 2024-11-15 16:20:32 UTC
Created attachment 174606 [details] [review]
Bug 38441: HistoryCheck Koha class
Comment 4 Pedro Amorim 2024-11-15 16:20:36 UTC
Created attachment 174607 [details] [review]
Bug 38441: ILLHistoryCheck: Staff UI
Comment 5 Pedro Amorim 2024-11-15 16:20:38 UTC
Created attachment 174608 [details] [review]
Bug 38441: ILLHistoryCheck: OPAC
Comment 6 Pedro Amorim 2024-11-15 16:20:41 UTC
Created attachment 174609 [details] [review]
Bug 38441: Allow / render HTML in ILL staff notes
Comment 7 Pedro Amorim 2024-11-15 16:20:43 UTC
Created attachment 174610 [details] [review]
Bug 38441: Style updates for staffnotes

- Use pre for staffnotes in staff illview
- Ensure <pre> has same font-family as rest of the page
- Render html for staff notes in list. Truncate to 100 chars max
Comment 8 Pedro Amorim 2024-11-15 16:20:45 UTC
Created attachment 174611 [details] [review]
Bug 38441: Add tests

Test plan:
1) Apply patches
2) Run (ignore if using a sandbox):
  $ reset_all
3) Visit ILL system preferences:
  <staff_url>/cgi-bin/koha/admin/preferences.pl?tab=interlibrary_loans
4) Enable ILLModule and ILLHistoryCheck system preferences

-- STAFF testing --

5) Create a new ILL request, visit:
  <staff_url>/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=Standard
6) Pick type = 'Journal article', enter '123' for ISSN, '42' for cardnumber and any library. Click create.
7) Repeat 5) and 6). Notice you're now on the 'Request history check' screen. Verify your previous ILL request is listed. Click 'Submit anyway'.
8) Repeat 5) and 6). But pick a different patron cardnumber this time e.g. '23529000035676'.
9) Verify you're shown the 'Request history check' screen listing the 2 previously created requests. Click 'Submit anyway'.
10) Repeat 5 and 6). Use cardnumber '23529000035676' again.
11) Verify you're shown the 'Request history check' screen. The listing now shows the requests found for this patron first, then lists the remaining found requests for other patrons.

-- OPAC testing --

12) Place a new request through the OPAC, visit:
  <opac_url>/cgi-bin/koha/opac-illrequests.pl?op=add_form&backend=Standard
13) Pick type = 'Journal article', enter '123' for ISSN. Click 'Create'. Notice it shows the 'history check' screen listing the existing 2 requests. Click 'Submit anyway'.
14) Return to the Staff UI:
  <staff_url>/cgi-bin/koha/ill/ill-requests.pl
15) Click on the latest ILL request. Verify 'Staff notes' contain information relating to already existing ILL requests.

-- Bonus testing --
16) On the Staff UI, create a new request for cardnumber 23529000035676 with ISSN = 321
17) On the OPAC, logged in as koha:koha, place a request with ISSN = 321. Verify you don't get shown the history check but the staff notes is still added
18) Play around with ILLModuleDisclaimerByType and
    ILLOpacUnauthenticatedRequest (easy)
19) Play around with ILLCheckAvailability and AutoILLBackendPriority
    (reach out for help using these preferences)

Run tests:
$ prove t/db_dependent/Koha/ILL/Request/Workflow/HistoryCheck.t