Bug 41247

Summary: ILL batches modal does not reset correctly
Product: Koha Reporter: Pedro Amorim <pedro.amorim>
Component: ILLAssignee: Pedro Amorim <pedro.amorim>
Status: Signed Off --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: david, edith.speller, jeremy.evans, lisette, pedro.amorim, 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:    
Bug Blocks: 41249    
Attachments: Bug 41247: Improve ILL batches modal resetability
Bug 41247: Preparation: Cypress plugins
Bug 41247: Add cypress tests
Bug 41247: Preparation: Cypress XML plugin
Bug 41247: Add cypress tests
Bug 41247: Add cypress tests
Bug 41247: Add cypress tests
Bug 41247: Improve ILL batches modal resetability
Bug 41247: Preparation: Cypress XML plugin
Bug 41247: Add cypress tests

Description Pedro Amorim 2025-11-13 14:21:44 UTC

    
Comment 1 Pedro Amorim 2025-11-13 15:37:23 UTC
Created attachment 189572 [details] [review]
Bug 41247: Improve ILL batches modal resetability

Test plan, preparation:
A) Enable ILLModule
B) Install a metadata enrichment plugin, e.g:
https://github.com/openfifth/koha-plugin-api-pubmed/releases/tag/1.1.1
C) Restart plack to pick up the newly installed plugin if needed.
D) Create a new batch, visit:
<staff_url>/cgi-bin/koha/ill/ill-requests.pl?

Issue #1:
1.1) Click 'New ILL requests batch'
1.2) Enter a name, '42' on the cardnumber and any library. Click 'Continue'.
1.3) Click the 'Close' button (or click anywhere outside the modal) to close the modal.
1.4) Repeat 1.1). Notice the 'Continue' button is no longer there.

Issue #2:
2.1) Click 'New ILL requests batch'
2.2) Enter a name, '42' on the cardnumber and any library. Click 'Continue'.
2.3) Enter '123' on the textarea, click 'Process identifiers'.
2.4) Notice a 'Add items to batch' buttons appears. Don't click that, as before, close the modal.
2.5) Repeat 2.1) Notice the progress bar shows right off the bat (it shouldn't) with NaN as its value as well as table elements (export button, 'No entries to show' message, etc, with no table.

Apply patch, hard-refresh the browser and repeat Issues 1 and 2. Confirm the patch fixes them.
Comment 2 Pedro Amorim 2025-11-14 13:44:28 UTC Comment hidden (obsolete)
Comment 3 Pedro Amorim 2025-11-14 13:44:31 UTC Comment hidden (obsolete)
Comment 4 Pedro Amorim 2025-11-14 14:17:32 UTC
Created attachment 189607 [details] [review]
Bug 41247: Preparation: Cypress XML plugin

Add a way to access and manipulate koha-conf.xml (we need to ensure plugins_restricted is 0 for the actual tests)
Comment 5 Pedro Amorim 2025-11-14 14:17:34 UTC Comment hidden (obsolete)
Comment 6 Pedro Amorim 2025-11-14 14:26:32 UTC Comment hidden (obsolete)
Comment 7 Pedro Amorim 2025-11-14 16:24:36 UTC
Created attachment 189618 [details] [review]
Bug 41247: Add cypress tests

Apply just the 2 cypress tests patches, run:
cypress run --spec t/cypress/integration/ILL/Batches_spec.ts

Notice it fails.
Apply the fix patch. Repeat the command above. Tests must pass.
Comment 8 David Nind 2026-01-03 18:33:38 UTC
Everything works as per the test plan.

However, I've failed QA as after the patches:
1. Do steps 1.1 to 1.3 or 2.1 to 2.5, an use the batch name 'Batch 1'
2. Create a new batch, and use the same batch number you used before, such as 'Batch 1'
3. You get a browser pop-up error message: "A batch named Batch 1 already exists"

Testing notes (using KTD):
1. To run the tests, apply these two patches:
   - Bug 41247: Improve ILL batches modal resetability 
   - Bug 41247: Add cypress tests 
2. Run the tests, they fail: cypress run --spec t/cypress/integration/ILL/Batches_spec.ts
3. Apply the patch: Bug 41247: Preparation: Cypress XML plugin
4. Repeat step 2 - they now pass
Comment 9 Pedro Amorim 2026-01-05 11:32:52 UTC
Thank you for your time testing here David, as always, much appreciated.

(In reply to David Nind from comment #8)

> However, I've failed QA as after the patches:
> 1. Do steps 1.1 to 1.3 or 2.1 to 2.5, an use the batch name 'Batch 1'
> 2. Create a new batch, and use the same batch number you used before, such
> as 'Batch 1'
> 3. You get a browser pop-up error message: "A batch named Batch 1 already
> exists" they now pass

This is the intended error handling for this particular modal and even though I agree it isn't "pretty", it is working as the original feature was pushed a few years ago and it is not related to the patches here. Improvements to this particular error handling behavior (i.e. prevent more than one batch with same name) should land on a different bug report.
Comment 10 David Nind 2026-01-05 18:45:56 UTC
Created attachment 190903 [details] [review]
Bug 41247: Improve ILL batches modal resetability

Test plan, preparation:
A) Enable ILLModule
B) Install a metadata enrichment plugin, e.g:
https://github.com/openfifth/koha-plugin-api-pubmed/releases/tag/1.1.1
C) Restart plack to pick up the newly installed plugin if needed.
D) Create a new batch, visit:
<staff_url>/cgi-bin/koha/ill/ill-requests.pl?

Issue #1:
1.1) Click 'New ILL requests batch'
1.2) Enter a name, '42' on the cardnumber and any library. Click 'Continue'.
1.3) Click the 'Close' button (or click anywhere outside the modal) to close the modal.
1.4) Repeat 1.1). Notice the 'Continue' button is no longer there.

Issue #2:
2.1) Click 'New ILL requests batch'
2.2) Enter a name, '42' on the cardnumber and any library. Click 'Continue'.
2.3) Enter '123' on the textarea, click 'Process identifiers'.
2.4) Notice a 'Add items to batch' buttons appears. Don't click that, as before, close the modal.
2.5) Repeat 2.1) Notice the progress bar shows right off the bat (it shouldn't) with NaN as its value as well as table elements (export button, 'No entries to show' message, etc, with no table.

Apply patch, hard-refresh the browser and repeat Issues 1 and 2. Confirm the patch fixes them.

Signed-off-by: David Nind <david@davidnind.com>
Comment 11 David Nind 2026-01-05 18:46:00 UTC
Created attachment 190904 [details] [review]
Bug 41247: Preparation: Cypress XML plugin

Add a way to access and manipulate koha-conf.xml (we need to ensure plugins_restricted is 0 for the actual tests)

Signed-off-by: David Nind <david@davidnind.com>
Comment 12 David Nind 2026-01-05 18:46:04 UTC
Created attachment 190905 [details] [review]
Bug 41247: Add cypress tests

Apply just the 2 cypress tests patches, run:
cypress run --spec t/cypress/integration/ILL/Batches_spec.ts

Notice it fails.
Apply the fix patch. Repeat the command above. Tests must pass.

Signed-off-by: David Nind <david@davidnind.com>