Commit Graph

61039 Commits

Author SHA1 Message Date
Kevin Carnes ea4600476e
Bug 21941: Fix GROUP BY in circ/reserveratios.pl
When using strict_sql_modes, the Hold ratios page causes an Incorrect
GROUP BY error and returns an Error 500.

This patch removes uncessary columns from the database query and adds
the biblio columns to the GROUP BY statement, so they can be selected.
Since it's already grouped by biblionumber, it should not cause any
additional rows to be created.

Test plan:
1. Make sure that strict_sql_modes is enabled in the koha-conf.xml
   file.
2. Place at least one hold on a book.
3. Go to Circulation and select Hold ratios.
4. Observe that you get an Error 500.
5. Apply patch.
6. Repeat step 3.
7. Observe that you can view the page.
8. If the table is empty, change the ratio to 1.
9. Sign off.

Sponsored-by: Lund University Library
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-09 08:27:25 -06:00
Paul Derscheid 3a6a79a607
Bug 15792: Throttle patron renewal links to prevent double-clicks
- Replace plain <a> renewal links in patron_messages.inc with the
  reusable throttled-button component introduced in Bug 40896
- Covers all four renewal links: warndeparture and expired states,
  in both circulation and patron detail contexts
- Include throttledButton.js in circulation.tt and moremember.tt
- Add persist mode and done icon state to throttled-button component
  so the button stays disabled on bfcache restore with a check icon
  instead of a misleading spinner

Test plan:
1) Create or update a patron category with an enrollment fee and an
   enrollment period in months (e.g. 24 months)
2) Create a patron of that type and write off any initial enrollment
   fee
3) Set the patron's dateexpiry to the past so the account is expired
4) Go to /cgi-bin/koha/circ/circulation.pl and scan the patron
5) Observe the "Renew" link in the expiration warning now shows as a
   small button with a rotate icon
6) Click "Renew" and confirm the button becomes disabled with a
   spinner, preventing a second click
7) Verify the patron is renewed correctly with only one enrollment
   fee charged and the correct expiry date
8) Press the browser back button to return via bfcache
9) Verify the button remains disabled and shows a check icon instead
   of the spinner, indicating the action was already completed
10) Repeat from the patron detail page (moremember.pl) to verify the
    same throttle and done-state behavior there
11) Test the warndeparture case by setting dateexpiry to a near-future
    date and confirming the same behavior

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-09 08:27:25 -06:00
Owen Leonard 96d2287a6a
Bug 42017: Fix content type of OPAC news RSS
This patch updates opac-news-rss.pl so that it outputs data with the
correct content type, text/xml.

To reproduce you must have at least one news item in your system. From
the OPAC main page, click the RSS feed link.
  - If you are using Firefox or Chrome you will see unstyled plain test
    on the screen.
You may or may not be able to see the problem if your
browser (e.g. Vivaldi) has a built-in RSS reader.

To test, apply the patch and restart services.

- In the OPAC, from the main page, click the RSS feed link at the bottom
  of the OPAC news list.
- You should see the XML view of the feed. This confirms that the
  browser is receiving the correct content type.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-09 08:27:17 -06:00
Martin Renvoize c513dee502
Bug 41368: Fix ManageMarcImport Cypress test timing issue
Replace the no-op `#job_callback` existence check with a recursive
`cy.wait('@jobPoll')` that loops through each `/api/v1/jobs/*` poll
response (arriving every ~1s) until it sees `status: finished`. This
avoids any fixed timeout — the test proceeds as soon as the API signals
completion, however long that takes on a given machine.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-01 09:53:45 -06:00
Martin Renvoize 92b1c11e3c
Bug 40383: (follow-up) Fix insertSampleEdifactMessages for new schema
We moved host/username/password out of vendor_edi_accounts into a
separate file_transports table between PQA and Pushed. Update the
Cypress test fixture to insert a file_transports record first and
reference it via file_transport_id, and clean it up in
deleteSampleEdifactMessages.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-27 16:29:16 +01:00
Martin Renvoize d35f76316d
Bug 41980: (follow-up) Fix Cypress test ambiguous field code search
Typing "CE" in the allow_fields dropdown now matches both
"CE - Unused" and "AY - Sequence number" (case-insensitive
match on "ce" in "Sequence"), causing the wrong option to be
selected. Use "CE - " to uniquely target the intended option.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-27 16:29:07 +01:00
Martin Renvoize 35a1757c97
Bug 40383: (RM follow-up) Use csrf_token over csrfToken
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-27 11:15:06 +01:00
Martin Renvoize 679afb31ec
Bug 35380: (RM follow-up) Move TT to own script tag
Adhere to JS19

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-27 11:03:06 +01:00
Martin Renvoize 320e08a715
Bug 41462: (RM follow-up) Add koha_objects_class
Add the missing plural class mapper to the OAI Sets schema file

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-27 10:44:28 +01:00
Brendan Lawlor b3163a009b
Bug 41638: (QA follow-up) Make label for alt contact city consistent with main and alt address city
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:30 +01:00
Owen Leonard ecbaf3b4d5
Bug 41638: (follow-up) Fix more instances, some markup errors
I've added changes for member-alt-address-style.inc,
member-alt-contact-style.inc, and member-main-address-style.inc.

I've also made some related markup corrections: Missing ID on some
inputs, incorrect "for" label on some labels. These fixes don't correct
*all* validation errors but it's an improvement.

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:30 +01:00
Lisette Scheer d8a2496888
Bug 41638: Add IDs to labels on patron edit
When targeting with jquery and css, labels on the patron edit screen
can be fragile and complicated.
This patch adds ids to all the labels that follow the following
convention:

<label for="surname" class="required" id="surname_label">

Each id is the "for" with _label appended.

To Test:
1. Before applying the patch, go to add a new patron
2. Right click on the page and use the browser inspector/inspect
   element.
3. Observe there are no ids for the field labels.
4. Apply patch
5. Reload the page
6. Observe there are now ids for the fields.
7. Go through all the fields and confirm there is an id and that they
   follow the convention above.
8. Change mandatory fields and confirm the labels are still correct.
9. Edit an existing patron and confirm the ids are still present.
10. Sign off!

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:29 +01:00
Martin Renvoize ed3f0dcab2
Bug 41980: (Follow-up) Improve SIP2 field code descriptions
- Use sentence case for all dropdown descriptions
- Add 'Unused' descriptions for AR, AW, AX, BA, BB, BC, BJ, CE
- Move SIP field codes outside translatable strings to avoid
  untranslatable codes being sent to translators
- Update AE/AV/DA tooltip text: use 'Template Toolkit' (not
  'Template::Toolkit'), imperative form, and clearer object
  field descriptions

Signed-off-by: John Vinke <jvinke@austinseminary.edu>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:29 +01:00
Martin Renvoize 780ae2d3e3
Bug 41980: Add more descriptive labels to SIP2 field codes
- Add field name labels to all entries in getSIPFields() used by the
  Allow/Hide fields dropdowns (e.g. "CV - Alert Type" instead of "CV")
  sourced from C4::SIP::Sip::Constants field identifier names
- Add tooltips to ae_field_template, av_field_template and
  da_field_template explaining what each SIP field represents and
  which Template::Toolkit objects are available
- Improve ct_always_send tooltip to explain CT is Destination Location
- Improve cv_send_00_on_success tooltip to explain CV alert type codes
- Improve cv_triggers_alert tooltip to clarify the two alert behaviours
- Improve cr_item_field tooltip to explain CR is Collection Code

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: John Vinke <jvinke@austinseminary.edu>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:29 +01:00
Martin Renvoize 560dd35740
Bug 40841: DBRev 25.12.00.040
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:28 +01:00
Tomás Cohen Arazi 3c87468669
Bug 40841: Add limits configuration UI
This patch adds branch limits selection to the Z30.50/SRU configuration
page.

Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:28 +01:00
Tomás Cohen Arazi d6aae094b4
Bug 40841: Implement library limits on Z39.50 searches
This patchset implements Z39.50/SRU limits by branch in Koha.

Key implementation notes:
- Follows Koha's established pattern for library limits
- A new table linking to library limits is added
- The admin UI is adjusted so the form includes library limit selection
- Z39.50/SRU search controllers use the `search_with_library_limits`
  methods to correctly constraint the offered servers.

To test:
1. Apply this patches
2. Run:
   $ ktd --shell
  k$ updatedatabase
=> SUCCESS: Database upgrade goes well
3. Re-run:
  k$ updatedatabase
=> SUCCESS: No explosions, DB update idempotent
4. Restart everything:
  k$ restart_all
5. POint your browser to the admin page:
   http://kohadev-intra.localhost/cgi-bin/koha/admin/z3950servers.pl
=> SUCCESS: A new column is displayed for library limits brief
6. Edit `LIBRARY OF CONGRESS`
=> SUCCESS: The form includes the usual library limit selection UI
7. Choose some branches, excluding your current one (KTD's default is
   'Centerville').
8. Save
=> SUCCESS: It is saved correctly
=> SUCCESS: The table shows the edited library has the library limits
set
9. Edit again
=> SUCCESS: The selected limits are preserved when editing
10. Pick some authorities Z39.50 target, and exclude your current branch
    for testing purposes.
11. Go to Cataloguing, and choose 'New from Z39.50/SRU'
=> SUCCESS: Limits are respected!
12. Go to Authorities, and choose 'New from Z39.50/SRU'
=> SUCCESS: Limits are respected!
13. Same as 11 but with the advanced editor
=> SUCCESS: Limits are respected!
14. Sign off :-D

Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:28 +01:00
Tomás Cohen Arazi e389129d61
Bug 40841: DBIC schema [DO NOT PUSH]
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:27 +01:00
Tomás Cohen Arazi 1abd451c5d
Bug 40841: Add Z39.50 library limits
This patch adds the library limits mixin to the Z39.50 classes following
a well established pattern in Koha.

Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:27 +01:00
Tomás Cohen Arazi 3169620db5
Bug 40841: DB changes
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:27 +01:00
Kyle M Hall 79ebdb9db7
Bug 41462: (QA follow-up) Add basic unit tests and koha_object_class methods
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:26 +01:00
Aleisha Amohia adcbd749e4
Bug 41462: Add Koha::OAI::Set(s) and Koha::OAI::Set::Biblio(s)
This architectural changes makes these tables available to the Koha namespace, and therefore the REST APIs.

To test: Confirm t/00-load.t tests pass and check for any syntax/tidy errors.

Sponsored-by: Auckland University of Technology
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:26 +01:00
Martin Renvoize da840f6c3f
Bug 40504: DBRev 25.12.00.039
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:26 +01:00
Martin Renvoize 16aa1edccd
Bug 40504: (QA follow-up) Fix QA script failures
- Add POD for _limit_counter in Koha::ILL::Request
- Add nonce attribute to <script> tag in select_manager.inc
- Collapse multi-line template tags in ill-requests.tt and suggestion.tt

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:25 +01:00
Lisette Scheer 6dfe1bf93a
Bug 40504: (QA follow-up) Tidy
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:25 +01:00
Jonathan Druart c3b6df654e
Bug 40504: Fix DB structure comparison
Fix misc4dev/run_tests.pl --run-db-compare-only

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:24 +01:00
Pedro Amorim f2bb65c4f9
Bug 40504: (QA follow-up): Prevent exiting without considering managed_by
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:24 +01:00
Pedro Amorim d997fc5981
Bug 40504: [DONT PUSH] dbic
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:24 +01:00
Pedro Amorim eaf50203b2
Bug 40504: (QA follow-up): Add 'managed by' filter
This adds a 'Managed by:' filter input on the left side filters.

Signed-off-by: Jeremy Evans <Jeremy.Evans@ukhsa.gov.uk>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:23 +01:00
Pedro Amorim 2a9e51c9b2
Bug 40504: atomicupdate
Signed-off-by: Jeremy Evans <Jeremy.Evans@ukhsa.gov.uk>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:23 +01:00
Pedro Amorim 124a7bed65
Bug 40504: Add tests
Test plan, ktd, apply patches:
1) Enable ILLModule
2) Create a new ILL request, visit:
<staff_url>/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=Standard
3) Set a 'type', add a cardnumber e.g. '23529000035676', and a library. Click 'Submit'.
4) Notice the new 'Managed by' field entry on the 'Manage request' page. This should be assigned to your logged in user.
5) Click 'Edit request' from the top toolbar
6) Notice the new 'Managed by' form entry. Click 'Select manager' and click 'Search'. Only the 'koha' user should be returned.
7) Notice the message at the top 'Only staff with superlibrarian or ILL permissions are returned in the search results'.
8) Let's give 'ill' permissions to Edna Acosta, visit:
<staff_url>/cgi-bin/koha/members/member-flags.pl?member=5
9) Search for 'ill' permission (Search for 'interlibrary' on the top right search bar) and set 'ill' permission to Edna Acosta. Save.
10) Repeat 6). Notice that now when you use the patron search modal Edna Acosta is also returned. Select Edna. Click 'Submit' to edit the request.
11) Edit again. Notice the 'Managed by' is showing 'You', with the message 'Previously was Edna Acosta'. This is the desired behavior mimicked from Suggestions i.e. the staff member that is editing the request details is assumed to becomes it's manager by default. The staff member must click 'Keep existing manager' if they want to submit changes without changing the request's manager. Test buttons, save, verify that it all works.
12) Visit the ILL list table:
<staff_url>/cgi-bin/koha/ill/ill-requests.pl
13) Click 'columns' and pick 'Managed by'. Notice it shows correctly with the link to the patron and sorting also works.
14) Create a new user without permissions (OPAC only user)
15) Access the OPAC ILL and login as that user (preferably on a different browser session as we'll want to access the staff UI as staff member again), visit:
<opac_url>/cgi-bin/koha/opac-illrequests.pl?op=add_form&backend=Standard
16) Pick a type and click 'Create'
17) Repeat 12) Notice the newly created request from OPAC is 'Managed by': Nobody. This is intentional as that request still needs to be assigned to a staff member.

Suggestions testing:
1) This testing is also important as the existing suggestions 'Managed by' functionality has been abstracted to be utilized by both the suggestions and ILL module.
2) Access suggestions, visit:
<staff_url>/cgi-bin/koha/suggestion/suggestion.pl
3) Click 'New purchase suggestion'. Notice the select manager button is also there. Click it and click 'search'. On the modal, the following message should show 'Only staff with superlibrarian or full suggestions permissions are returned in the search results' and the patrons shown should reflect that.
4) Do the same exercises here as we just did for the ILL module, i.e. create a staff member with permission 'suggestions.suggestions_manage' and ensure that shows on the modal, assign that patron as manager, edit again, verify that it defaults to 'You' and that the 'Keep existing manager' button works as before.
5) Finally, test the suggestions list table, repeat 2) and notice the 'Update manager' action at the bottom, test that that works just as well, by checking a few suggestions boxes, selecting a manager to your selection and clicking the 'Submit' button under it.

Run tests:
prove t/db_dependent/Koha/ILL/Request.t
prove t/db_dependent/api/v1/ill_users.t

Signed-off-by: Jeremy Evans <Jeremy.Evans@ukhsa.gov.uk>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:23 +01:00
Pedro Amorim 11ac1c48ec
Bug 40504: Auto functionality:
- The staff member who creates a new ILL request is automatically assigned as its manager.
- No manager is assigned to ILL requests made by users without 'ill' permission e.g. patrons using the OPAC.
- When an ILL request without a manager has its status changed, the staff member making the change is automatically assigned as its manager e.g. by clicking 'confirm' or 'revert request'.
- It is possible to manually update a request's manager by clicking the 'Edit request' toolbar button when viewing a request. The patron search modal, 'select manager' button and all its functionality is shared with the 'select manager' present in the suggestions module. This means that when editing an ILL request, the 'managedby' defaults to the staff member editing the request, unless 'Keep existing manager' is clicked, like it happens in suggestions.
- This is fully core built, all backends will automatically hook into this functionality, because:
-- Automatic 'managedby' happen on status change, regardless of backend
-- All requests have access to 'edit request' page, regardless of backend
- Only if a logged in staff member exists does the auto set manager. If no staff member is found, nothing happens e.g. an ILL request status
was changed by a CLI command / cronjob

Signed-off-by: Jeremy Evans <Jeremy.Evans@ukhsa.gov.uk>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:22 +01:00
Pedro Amorim e9c3c47bd5
Bug 40504: UI improvements
This turns the 'Select manager' and 'Restore manager' actions to proper buttons, well aligned in where they are displayed. The 'Select manager' functionality in the suggestions table page is also updated to make use of the same reusable button block

Signed-off-by: Jeremy Evans <Jeremy.Evans@ukhsa.gov.uk>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:22 +01:00
Pedro Amorim ade2934e2a
Bug 40504: Add 'managedby' to illrequests
This also includes a 'manager' accessor which returns the Koha::Patron
object

Signed-off-by: Jeremy Evans <Jeremy.Evans@ukhsa.gov.uk>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:22 +01:00
Pedro Amorim b0714a0b22
Bug 40504: Add ill/users API endpoint
Required to get users filtered by 'ill' permission for patron search modal

prove t/db_dependent/api/v1/ill_users.t

Signed-off-by: Jeremy Evans <Jeremy.Evans@ukhsa.gov.uk>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:21 +01:00
Pedro Amorim 2c5bc2875c
Bug 40504: Preparation: Disambiguation of .clear_search
This is required, or clicking 'Clear' on the ILL patron search modal will trigger this event listener and cause a JS error, as the 'regular' ILL table is not shown/initialized when editing an ILL request

Signed-off-by: Jeremy Evans <Jeremy.Evans@ukhsa.gov.uk>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:21 +01:00
Pedro Amorim afa20faf24
Bug 40504: Preparation: Add empty_table_settings option to patron_search_js
This is required for ILL 'select manager' functionality, as table_settings are already defined there and the user modal table will pick that up unless explicitly stated to not use it, thus empty_table_settings

Signed-off-by: Jeremy Evans <Jeremy.Evans@ukhsa.gov.uk>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:21 +01:00
Pedro Amorim 09742f82c7
Bug 40504: Preparation: Abstract 'managed by' functionality from suggestions
Move 'managed by' and 'restore previous manager' form and show
functionality to reusable .inc files

Signed-off-by: Jeremy Evans <Jeremy.Evans@ukhsa.gov.uk>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
2026-03-26 14:21:20 +01:00
Martin Renvoize 59890fa4da
Bug 40383: (follow-up) Add nonce attribute to inline script in basket.tt
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:20 +01:00
Martin Renvoize 631498e94e
Bug 40383: (follow-up) Address code review concerns
- Move TT interface/theme variables into a separate <script> tag to avoid
  mixing template variables with external JavaScript file scope
- Replace local escapeHtml() functions in edifact_interchange.js and
  edifact_errors.js with String.prototype.escapeHtml already defined
  in staff-global.js

Sponsored-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:20 +01:00
Martin Renvoize e9045ddedc
Bug 40383: (QA follow-up) Update Cypress tests to follow current best practices
Remove before()/after() DB hooks — all assertions already use cy.intercept
mocks so no real database messages are needed. Extract repeated button
injection into an openEDIModal() helper. Replace all cy.wait(N) fixed-time
waits with assertion-based waits and cy.wait('@alias') for network sync.
Fix a Bootstrap 5 race condition in the modal-close cleanup test where
hidden.bs.modal fired after the backdrop animation, causing the re-opened
modal's focus class to be removed mid-test.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:19 +01:00
Martin Renvoize 4da37cad60
Bug 40383: Add Cypress test coverage for EDIFACT modal
This patch adds end-to-end testing for the EDIFACT modal interface,
providing coverage of all user interactions and functionality.

**Test Coverage:**
- Modal display and initialization with proper Bootstrap navbar structure
- View toggle functionality between tree and raw display modes
- Search functionality including navigation, result counting, and highlighting
- Focus functionality for basket and invoice contexts
- Error handling for invalid message IDs and network failures
- Accessibility features including keyboard navigation
- Responsive behavior and modal interaction patterns

**Test Plan:**
1. Apply patch
2. Ensure KTD environment is running with test data
3. Run tests: `npx cypress run --spec "t/cypress/integration/Acquisitions/Edifact*"`
4. **Verify Test Results:**
5. **Manual Verification:**
   - All test scenarios reflect real user workflows
   - Test data requirements are clearly documented in spec file
   - Test data is cleaned up after the tests are run

Signed-off-by: Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:19 +01:00
Martin Renvoize d726a93518
Bug 40383: Enhanced EDIFACT message modal with search and focus functionality
This patch completely rebuilds the EDIFACT message modal interface, featuring:

**Core Features:**
- Modern Bootstrap 5 navbar with integrated search functionality
- Tree view and raw view display modes for message structure
- Real-time search with regex support and result navigation
- Smart focus functionality that highlights relevant segments based on
  context (basket, invoice)

**User Interface:**
- Bootstrap navbar between modal header and body
- Search form with previous/next navigation and live result counts
- Clean separation between always-visible controls and view-specific toolbars
- Accessibility conscious with proper ARIA labels and semantic markup
- Streamlined DOM structure with direct modal-body scrolling

**Test Plan:**
1. Apply patch and run: yarn css:build to compile SCSS
2. Navigate to Acquisitions > EDIFACT messages
3. Click "View message" on any EDIFACT message
4. **Modal Display Testing:**
   - Verify modal opens with Bootstrap navbar between header and body
   - Confirm tree view is active by default with segment structure visible
   - Click raw view button to verify plain text display
   - Test modal responsiveness by resizing window
5. **Search Functionality Testing:**
   - Enter "UNH" in search field, verify navbar shows result count
   - Use previous/next buttons to navigate between results
   - Test search with terms like "ORDER", "NAD", "LIN" - all results should be found
   - Verify native browser clear button appears and works
   - Test case-insensitive search behavior
6. **Focus Functionality Testing:**
   - From basket page, click enhanced view link - should highlight relevant segments
   - From invoice page, click enhanced view - should focus on invoice-related segments
   - Verify focus highlighting persists during search operations
7. **Error Handling Testing:**
   - Test with invalid message ID, verify error display
   - Test network errors, confirm loading states work properly
8. **Accessibility Testing:**
   - Verify keyboard navigation works with search controls
   - Test screen reader compatibility with ARIA labels
   - Confirm modal can be closed with Escape key

Signed-off-by: Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:19 +01:00
Martin Renvoize 1f5f91e649
Bug 40383: Add JSON representation to Koha::Edifact and JSON download to edimsg.pl
This patch implements a JSON representation of EDIFACT interchanges for enhanced
programmatic access and debugging capabilities.

Backend Changes:
- Add to_json() method to Koha::Edifact module
- Structured JSON output with header, messages array, and trailer
- Segment parsing with raw data, elements arrays, and line_id tracking
- Line item grouping using LIN segment identifiers

Frontend Changes:
- Add JSON download button to edimsg.pl page
- Support for ?format=json parameter and Accept: application/json header
- Proper HTTP content-type handling for JSON responses
- Error handling for missing messages in JSON format

JSON Structure:
{
  "header": "UNB+UNOC:3+...",
  "messages": [
    {
      "header": "UNH+1+QUOTES:D:93A:UN:EAN008'",
      "segments": [
        {
          "tag": "LIN",
          "raw": "LIN+1+1+9780552150040:EN'",
          "elements": ["1", "1", "9780552150040:EN"],
          "line_id": "1"
        }
      ],
      "trailer": "UNT+25+1'"
    }
  ],
  "trailer": "UNZ+1+1'"
}

Test plan:
1. Apply this patch
2. Ensure you have EDIFACT messages in your system
3. Go to Acquisitions > EDIFACT messages
4. Click "View message" for any message
5. Click the new "JSON" button
6. Verify JSON downloads with proper structure
7. Verify direct URL access with ?format=json parameter works
8. Test with Accept: application/json header

Signed-off-by: Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:18 +01:00
Martin Renvoize e8cdc4e9d5
Bug 40383: Add unit tests for Koha::Edifact to_json method
This patch adds unit tests for the new to_json method being introduced
in Koha::Edifact module in the next patch.

The tests verify:
- JSON output generation and validity
- Proper structure with header, messages, and trailer fields
- Message array structure with correct number of messages
- Individual message structure (header, segments, trailer)
- Segment data integrity including raw data and elements arrays
- Line ID functionality for related segments (LIN, QTY, PRI, PIA)

Test plan:
1. Apply this patch and the next one
2. Run: prove t/Edifact.t
3. Verify all 63 tests pass
4. Confirm the new JSON-related tests (22 tests) execute successfully

Sponsored-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:18 +01:00
David Cook 11de56769b
Bug 42072: Improve message about deleting bib records
This patch clarifies which records will be deleted in
the batch item deletion (when no items remain).

Test plan:
0. Apply the patch
1. Go to "Reports" and click "Create from SQL"
2. Create a report with the following SQL:
select itemnumber from items limit 5
3. Run the report and then click "Batch operations with 5 visible records"
on the output page
4. Near the bottom of the screen note that there is a checkbox that
has a label reading "Delete bibliographic records if no items remain."
5. C'est tout!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:18 +01:00
Janusz Kaczmarek 0dc06596e2
Bug 41759: The display of MARC 21 field 026 data (Fingerprint Identifier) is missing (both in intranet and OPAC)
Test plan
=========
1. Make field 026 active for Editor in MARC framework section (e.g. in default
   framework).
2. Edit any bibliographic record (with modified framework) adding 026 field data,
   e.g. 026 ## $a urdu esrt $b eses jecl $c 1790
3. Verify in Normal view (intranet) and in OPAC that you are unable to
   see the inserted data.
4. Apply the patch ; restart_all.
5. Verify in Normal view (intranet) and in OPAC that you are now able to
   see the fingerprint information from 026 field.

Sponsored-by: Ignatianum University in Cracow
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:17 +01:00
Janusz Kaczmarek 71af0f01d1
Bug 41758: Add Fingerprint Identifier data to Elasticsearch index mappings
Libraries cataloguing older monographic resources request fingerprint indexing.

In MARC 21, it would be the content of field 026, in UNIMARC - 012.

Test plan
=========
1. Start up KTD with Elasticsearch: ktd --search-engine es8 up -d
2. Make field 026 active for Editor in MARC framework section (e.g. in default
   framework).
3. Edit any bibliographic record (with modified framework) adding 026 field data,
   e.g. 026 ## $a urdu esrt $b eses jecl $c 1790
4. Verify that you are unable to find the record searching with fingerprint data.
5. Apply the patch ; restart_all.
6. Reindex with: koha-elasticsearch --rebuild -r -d kohadev
7. Now you should be able to find the record searching with fingerprint data
   (performing a general search or prefixed with 'fingerprint-identifier:').

Sponsored-by: Ignatianum University in Cracow
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:17 +01:00
Owen Leonard 4cdce0479c
Bug 42134: String displays incorrectly: words “notices” and “for” appear concatenated
This patch changes the way the notices template checks for the existence
of the TranslateNotices system preference in order to avoid a missing
space in the corresponding label.

To test you should have at least two languages enabled under the
StaffInterfaceLanguages system preference.

- Apply the patch and go to Administration -> System preferences..
- Locate the TranslateNotices preference and set it to "Allow"
- Go to Tools -> Notices and edit a notice.
- The "Modify notice" page should have tabs each of your enabled
  languages as well as "Default."
- Each tab should have a "Format" section. Expand it and check that the
  label for the checkbox at the bottom is correct, e.g. "Apply format
  settings to all notices for this language."
- Return to system preferences and set TranslateNotices to "Don't
  allow."
- Reload the notice edit screen and check the "Format" section. The
  label should now read "Apply format settings to all notices."

Sponsored-by: Athens County Public Libraries
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:17 +01:00
Martin Renvoize 3b75ede4fd
Bug 28884: DBRev 25.12.00.038
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-26 14:21:16 +01:00