Bug 41249

Summary: ILL batches should be compatible with AutoILLBackendPriority
Product: Koha Reporter: Pedro Amorim <pedro.amorim>
Component: ILLAssignee: Pedro Amorim <pedro.amorim>
Status: Needs Signoff --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: edith.speller, jeremy.evans, lisette, pedro.amorim, richard.bridgen, tomascohen
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 41247    
Bug Blocks:    
Attachments: Bug 41249: Preparation Move confirmauto logic to earlier in controller
Bug 41249: Update toolbar batches button logic
Bug 41249: Auto backend batch modal column
Bug 41249: Add cypress tests

Description Pedro Amorim 2025-11-13 15:48:47 UTC
AutoILLBackendPriority suggests the top most available backend in priority when creating a new ILL request. This should also work the same when creating requests through the ILL batches functionality.
Comment 1 Pedro Amorim 2025-11-14 16:32:58 UTC
Created attachment 189619 [details] [review]
Bug 41249: Preparation Move confirmauto logic to earlier in controller

This is in order to be able to have a have_batch_auto_backends_json which contains all backends that are compatible with both:
A) AutoILLBackendPriority sys pref and
B) ILL batches
Comment 2 Pedro Amorim 2025-11-14 16:33:02 UTC
Created attachment 189620 [details] [review]
Bug 41249: Update toolbar batches button logic

Same behaviour as regular 'new ILL request' button, i.e. if AutoILLBackendPriorty sys pref is being used, do not present the backend options upon clicking 'new batch'
Comment 3 Pedro Amorim 2025-11-14 16:33:05 UTC
Created attachment 189621 [details] [review]
Bug 41249: Auto backend batch modal column
Comment 4 Pedro Amorim 2025-11-14 16:33:08 UTC
Created attachment 189622 [details] [review]
Bug 41249: Add cypress tests

cypress run --spec t/cypress/integration/ILL/Batches_spec.ts

Test plan:
1) Enable ILLModule
2) Install a backend compatible with ILL batches + AutoILLBackendPriority sys pref:
https://github.com/openfifth/koha-ill-backend-plugin/releases/tag/v2.0.8
3) Install a metadata enrichment plugin (required for ILL batches):
https://github.com/openfifth/koha-plugin-api-pubmed/releases/tag/1.1.1
4) Enable AutoILLBackendPriority sys pref by checking 'PluginBackend'
5) Visit the ILL module:
<staff_url>/cgi-bin/koha/ill/ill-requests.pl
6) Notice the 'New ILL requests batch' shows. Click that.
7) Enter any name, '42' for cardnumber and any library. Click 'Continue'.
8) On t'he textarea that shows enter the following pubmed IDs (separated by new line)
    123
    321
    456
9) Notice that PluginBackend will sometimes be red, sometimes be yellow and sometimes be green. This is a test backend and that will happen randomly. Repeat step 8) for more test result samples.
10) Notice that, when green, PluginBackend will be pre-selected. When yellow, it'll allow you to select it but not pre-select it and when red doesnt allow it to be selected at all.
11) Play around with the selection of backends and click 'Add items to batch' and verify that each request was created in the respective selected backend.