Commit Graph

60820 Commits

Author SHA1 Message Date
David Cook f83a2d39eb
Bug 30261: Update unit tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-20 11:54:32 +00:00
David Cook 532d10a800
Bug 30261: Render opac 404 for opac/tracklinks.pl
This patch updates C4::Output::output_error to take
an additional argument which contains an "interface"
parameter, so that opac/tracklinks.pl can generate
an OPAC error instead of an Intranet error.

Test plan:
0. Apply patch and koha-plack --restart kohadev
1. Go to http://localhost:8081/test.pl
2. Note normal Intranet 404 error
3. Go to http://localhost:8080/cgi-bin/koha/tracklinks.pl?uri=https%3A%2F%2Ftest.com&biblionumber=29
4. Note normal Opac 404 error
4b. For extra points, note that tracklinks.pl returns a 404 instead of a 302 to the 404.pl page
5. Change 'TrackClicks' syspref to "Track"
6. Go to http://localhost:8080/cgi-bin/koha/tracklinks.pl?uri=https%3A%2F%2Ftest.com&biblionumber=29
7. Note normal Opac 404 error
7b. For extra points, note that tracklinks.pl returns a 404 instead of a 302 to the 404.pl page
8. Rejoice!

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-20 11:54:32 +00:00
Fridolin Somers c10e7a67df
Bug 31717: Value builder unimarc_field_010.pl also use 214$c
Value builder unimarc_field_010.pl tries to find publisher from ISBN in order to fill 210$c.
Since there is now 214$c for publisher this value builder should be adapted.
214 is more important than 210 so if there are both, only 214 will be filled.

Test plan :
1) Choose an existing record with an ISBN and a published in biblioitems.publishercode,
   For example 9782070612369 and Gallimard
2) Use value builder unimarc_field_010.pl on 010$a
3) Create a new record
4) Enter 9782070612369 in 010$a
5) Click on value builder icon on this subfield
6) Check you see 'Gallimard' in 214$c

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-20 11:54:32 +00:00
Marcel de Rooy 911fdc330c
Bug 41699: (QA follow-up) Spelling
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-20 11:54:32 +00:00
Janusz Kaczmarek cb9679cfd8
Bug 41699: onsite_checkout not available in Statistics wizards
In Reports > Statistics wizards > Circulation there is no option to
extract information about entries with statistics.type =
'onsite_checkout' (it is lacking from the Type list: Checkout, Renewal,
Checkin, Local use).

Test plan
=========
1. In a fresh ktd instance set OnSiteCheckouts systempreferece to
   'Enable'.
2. Make an onsite checkout (mind the advanced checkout options icon) of
   any item to any patron from your lilbrary.
3. From Reports > Statistics wizards > Circulation check the issue
   statistics (Checkout, Local use) for the current day.
4. Note that you are unable to see the checkuot in the statistics.
5. Apply the patch; restart all.
6. You should be able to choose Onsite checkout from the Circulation
   statistics Type drop-down list and also you will now see the onsite
   checkout in statistics result.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-20 11:54:32 +00:00
Jonathan Druart d331c7aba8
Bug 40744: Ignore --del-exp-selfreg if pref is not set
If PatronSelfRegistration we should ignore (i.e. do nothing) if
--del-exp-selfreg is passed to cleanup_database.pl

It prevents the script to warn that the pref is not set.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-20 11:54:31 +00:00
David Nind e70e6a233e
Bug 42020: (follow-up) Fix spelling for button - web site to website
Changes the spelling for the button in the pop-up window (when a
library URL is defined) - "Visit web site" to "Visit website".

The common spelling now is just website.

Sponsored-by: Pontificia Università di San Tommaso d'Aquino (Angelicum)
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-20 11:54:31 +00:00
Janusz Kaczmarek 194a3b4a9f
Bug 42020: (Bug 39482 follow-up) Library info link shown in OPAC without OpacLibraryInfo and library URL
Prior to Bug 39482 a link to library info modal (with (i) icon) was
generated only if OpacLibraryInfo was defined (cf. original Bug
29616). Now it is there even if there is no OpacLibraryInfo at all
and no URL defined for the library. It is generated in any
circumstances.

The test on $item->holding_branch->opac_info( { lang => $lang } ) in
opac-detail.pl now returns always true. This is because
Koha::Library::opac_info returns a RS now, and not an object, as it
was before (find_best_match --> search_for_display).

This patch restores the original behavior designed in Bug 29616.

Test plan:
1. Have a standard ktd installation.
2. Make sure there is no OpacLibraryInfo defined in HTML customizations.
3. Make sure there is no URL for any library.
4. In OPAC, perform any search. On a detail page you would see a link
   to an empty modal from the Current library items column.
5. Apply the patch ; restart_all.
6. Repeat p. 4. There should be no link generated now.
7. Extent the test to follow Bug 29616 logic:

A. One with both branches.branchurl and OpacLibraryInfo defined
B. One with branches.branchurl but no OpacLibraryInfo defined
C. One with OpacLibraryInfo defined but no branches.branchurl
D. One with neither branches.branchurl nor OpacLibraryInfo defined
(neither for a specific library, nor default one)

View the bibliographic detail page in the OPAC for title(s) which have
holdings from the libraries you configured above. In the holdings table,
check the behavior of the library name in the "Current library" or "Home
library" columns *

- Case A: The library name appears as a link with an "info" icon.
  Clicking it shows the library information in a modal window. In the
  modal footer, a "Visit web site" button should take you to the correct
  URL.
- Case B: The library name appears as a link without an icon. Clicking
  the link takes you to the correct URL.
- Case C: The library name appears as a link with an "info" icon.
  Clicking it shows the library information in a modal window. In the
  modal footer there is no "Visit web site" button.
- Case D: The library name is plain text.

* Display of "Current library" and/or "Home library" is controlled by
  the OpacLocationBranchToDisplay system preference.

Sponsored-by: Pontificia Università di San Tommaso d'Aquino (Angelicum)
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-20 11:54:31 +00:00
Martin Renvoize 10cb20415b
Bug 41367: Add AdminMenu island and integrate into Record sources
- Replace static TT admin-menu sidebar with AdminMenu.vue island web component
  registered in the islands componentRegistry
- Fix NavigationItem to conditionally apply breadcrumb-item class via
  isBreadcrumb prop, fixing incorrect class on left-menu items
- Update record_sources.tt to use sub-header/main-container wrappers
  with aside='admin-menu', rendering the admin sidebar and breadcrumbs
- Update RecordSources/Main.vue to use Teleport for breadcrumbs into
  the sub-header container and remove self-contained layout

Test plan:
  1. Go to Administration > Catalog > Record sources
  2. Confirm the administration sidebar menu appears on the left side of
     the page, with all sections visible according to your permissions
     (System preferences, Basic parameters, Catalog, etc.)
  3. Confirm the breadcrumb trail at the top reads:
       Koha > Administration > Record sources
  4. Confirm the "Catalog" section of the sidebar is
     expanded and "Record sources" is not highlighted as current
     (it lives in the main content area, not the sidebar)
  5. Click another link in the sidebar (e.g. "System preferences") and
     confirm navigation works normally
  6. Return to Record sources and add, edit, and delete a record source
     to confirm the sidebar does not interfere with the SPA behaviour
  7. Navigate to any other admin page (e.g. Libraries, Item types) and
     confirm the sidebar still renders correctly on those pages

Sponsored-by: OpenFifth <https://openfifth.co.uk>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-20 11:54:31 +00:00
Martin Renvoize b3357ab31b
Bug 41834: Fix GetDelimiterChoices after options column removed from sysprefs.sql
We removed the `options` column from all sysprefs.sql INSERT statements,
leaving CSVDelimiter.options as NULL in the DB. This broke GetDelimiterChoices()
which relied on that column for the list of valid delimiter choices, resulting
in empty dropdowns across all report pages and an uninitialized value warning in
the test suite.

Fix by hardcoding the choices (matching admin.pref) and reading the
current value via C4::Context->preference() instead of a raw DB query.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-20 11:53:44 +00:00
Martin Renvoize 9818b3bf8d
Bug 41834: DBRev 25.12.00.029
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-20 11:22:03 +00:00
Jonathan Druart 8864c23f3d
Bug 41834: Set pref to 0 if '' passed for YesNo
This is a bit ugly, we do that already in t/db_dependent/check_sysprefs.t
We could have this moved to a "is_boolean" method of
Koha::Config::SyspPref (LATER)

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-20 11:10:13 +00:00
Martin Renvoize 33f3240b54
Bug 41587: (follow-up) Fix js-yaml version conflict with resolutions override
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-20 09:04:21 +00:00
Paul Derscheid 787295b7f1
Bug 41587: (follow-up) Fix newly reported dependency vulnerabilities
- Bump minimatch dependency and resolution from ^3.0.2 to ^3.1.4 (HIGH)
- Bump lodash dependency and resolution from ^4.17.12 to ^4.17.23 (MODERATE)
- Add resolution for fast-xml-parser ^4.5.4 (CRITICAL)
- Add resolution for undici ^6.23.0 (MODERATE)
- Add resolution for serialize-javascript ^7.0.3 (HIGH)

Test plan:
- yarn audit --level high should show 0 vulnerabilities
- yarn build && yarn build:prod should complete without errors
- yarn cypress run should complete without (or currently expected) errors

@RM: You will need to push yarn.lock as well

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-20 07:58:58 +00:00
Paul Derscheid 92d2dfc4e3
Bug 41587: Fix moderate severity node dependency vulnerabilities
- Add resolution for micromatch ^4.0.8
- Add resolution for @cypress/request ^3.0.0
- Add resolution for js-yaml ^4.1.1

Test plan:
- yarn audit --level moderate should show reduced vulnerability count
- yarn build && yarn build:prod should complete without errors
- yarn cypress run should complete without (or currently expected) errors

@RM: You will need to push yarn.lock as well

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-20 07:58:51 +00:00
Paul Derscheid 8dd068675b
Bug 41587: Fix critical and high severity node dependency vulnerabilities
- Upgrade gulp-exec to ^5.0.0 (fixes lodash.template HIGH)
- Add resolution for form-data ^2.5.4 (CRITICAL)
- Add resolution for braces ^3.0.3 (HIGH)
- Add resolution for qs ^6.14.1 (HIGH)

Test plan:
- yarn audit --level high should show 0 vulnerabilities
- yarn build && yarn build:prod should complete without errors
- yarn cypress run should return without (or currently expected) errors

@RM: You will need to push yarn.lock as well

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-20 07:58:41 +00:00
David Cook e403698cd2
Bug 41834: (follow-up) nullify marcflavour in atomicupdate
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-20 07:57:23 +00:00
Jonathan Druart 92b8e9ea3c
Bug 41834: Fix order of underscore
In the previous tests we had:
  $b =~ s/_/ZZZ/g;    # mysql sorts underscore last, if you modify this qa-test-tools will need adjustments

But this is wrong, try:
  select variable from systempreferences;
and confirm that hide_marc is before hidelostitems and that
intranet_includes is before IntranetAddMastheadLibraryPulldown

We will deal with qa-test-tools once this is pushed.

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-20 07:57:20 +00:00
Jonathan Druart e249392147
Bug 41834: Remove columns from sysprefs.sql
In vim `:%s/^\(('[^']*', \?'[^']*'\).*/\1),/`

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-20 07:57:17 +00:00
Jonathan Druart 10e1708456
Bug 41834: Set systempreferences's options, explanation and type to NULL
We currently have to set options, explanation and type in sysprefs.sql and the atomic/dbrev files.
However we (almost) never use them, we rely on the values in the yml files.

We could remove them and don't require them when when add new sysprefs.

It will avoid the mess we currently have (mismatch between new and updated installations, see bug 41682 and bug 41800).

Instead of fixing the discrepancies (again, see bug 41800) we should
NULL the 3 columns in sysprefs.sql and so at the DB level to rely only
on the yaml files.

This patch does several things:
1. Remove the 3 columns from sysprefs.sql to use the default NULL
2. Atomic update:
 * Set to NULL for existing installations as well
 * Rename UseICUStyleQUotes => UseICUStyleQuotes
 * Delete OpacMoreSearches and OPACMySummaryNote, old prefs that have been moved
 to additional contents
3. Fix some errors in yaml files (mostly empty entries)
4. Move parsing of yaml files to a dedicated Koha::Devel::Syspref module
5. Retrieve all yaml content using new methods added to Koha::Config::SysPrefs
(that will be reused in follow-up bugs)

Test plan:
1. Run updatedatabase and confirm that now all systempreferences rows in DB
have options, explanation and type set to NULL (except local-use prefs)
2. `prove t/db_dependent/check_sysprefs.t` should return green
3. Confirm that the UI is still working correctly

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-20 07:57:11 +00:00
Martin Renvoize b7eea37e1a
Bug 41247: (follow-up) Fix Cypress test after administration rename
Bug 41494 renamed "Koha administration" to "Administration" in the
staff interface. Update the Batches_spec.ts Cypress test to use the
new label.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-20 07:55:20 +00:00
Martin Renvoize 764a468ec3
Bug 42098: (follow-up) Enable plugin in ImportBatch.t test
The Handler::run change to skip disabled plugins broke the
RecordsFromMarcPlugin subtest in ImportBatch.t. The MarcFieldValues
plugin was installed but never enabled, so Handler::run returned
early. Add $plugin->enable() before calling RecordsFromMarcPlugin.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-20 07:51:01 +00:00
Jonathan Druart 5059a0b360
Bug 41989: Call getlanguage after get_template_and_user
This patch prevents the UI to randomly change the language when reaching
addbooks

The problem is that getlanguage is called BEFORE get_template_and_user,
without, and "interface" (C4::Context->interface) is not set yet.

Open C4/Languages.pm, search "sub getlanguage"
We first read the cache, then if there is no interface we reach
GetTranslatedLanguages that does return languages in a random order,
then we pick the first one
765         @languages = map { $_->{rfc4646_subtag} } @{ getTranslatedLanguages( $interface, $theme ) };
783     $language = shift @languages unless $language;

We must call getlanguage AFTER that the cache is populated.

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-19 10:52:24 +00:00
Jonathan Druart 1984f205ed
Bug 39055: Adjust xt tests to handle login_op
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-19 10:51:48 +00:00
David Cook 2691d566ed
Bug 39055: Fix login condition when using op and login_op
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-19 10:51:45 +00:00
David Cook 137b41c510
Bug 39055: Add change to Koha::App::Plugin::CSRF and fix unit test
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-19 10:51:41 +00:00
David Cook 1e504eb771
Bug 39055: Add more login_op checks to middleware
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-19 10:51:38 +00:00
Jonathan Druart 9121cbd8a4
Bug 39055: Fix mojo/acquisition/vendors.t
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-19 10:51:33 +00:00
David Cook 16c8d0d9a4
Bug 39055: Change "op" to "login_op" when logging in to allow original op to flow through
This patch changes "op" to "login_op" when logging in, so that the original op can
flow through to whichever controller is processing the login and subsequent op.

Test plan:
0. apply the patch and koha-plack --restart kohadev
1. Without logging in, go to the following:
http://localhost:8081/cgi-bin/koha/reports/guided_reports.pl?id=1&op=run
2. Log in and note that you can see the report
3. Try logging into the OPAC
4. Try logging into the self-checkout
5. Create a new self-reg account and try logging in with the auto-filled details
6. Test anything else you can think to test here

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-19 10:51:27 +00:00
Pedro Amorim e838b70be7
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>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-19 10:45:11 +00:00
Pedro Amorim 0387ebfb97
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>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-19 10:44:01 +00:00
Pedro Amorim b591b668d2
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>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-19 10:43:52 +00:00
Fridolin Somers 3b4db6dba6
Bug 40306: Use GET in form of value_builder/unimarc_field_4XX.pl
Since CSRF procetion form without CUD action must use GET instead of POST
Fix value_builder/unimarc_field_4XX.pl

Test plan:
1) Use UNIMARC DB
2) Be sure value builder unimarc_field_4XX.pl is defined on 461$t
3) Create a new biblio record
4) On 461$t click on 'Tag editor' icon
5) Perform a search
6) Click on choose
7) Field 461 is filled

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-19 10:42:29 +00:00
Tomás Cohen Arazi d210db0e6b
Bug 41173: (follow-up) Don't pass params to base routes in breadcrumbs
The ERMHome route is a base route that doesn't accept params, but
NavigationItem was passing all current route params (license_id,
agreement_id, etc.) to it, causing Vue Router errors.

Fix by checking if the route is a base route (is_base flag) and
passing an empty params object in that case.

Test plan:
1. Run Cypress tests: yarn cypress run
2. Verify AdditionalFields_spec.ts now passes all 12 tests
3. Navigate to ERM module and verify breadcrumbs work correctly

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-19 10:22:16 +00:00
Jonathan Druart 4ae4efd268
Bug 41173: Add a Cypress test
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-19 10:22:14 +00:00
Tomas Cohen Arazi 5f95a00d4f
Bug 41173: Fix ERM breadcrumb causing page reload
The main ERM route was missing a 'name' property, causing the
navigation store to treat it as an external path (.pl extension).
This resulted in breadcrumb links using href instead of router-link,
causing unwanted page reloads.

To test:
1. Navigate to ERM module
2. Go to any sub-section (Agreements, Licenses, etc.)
3. Click on 'E-resource management' in the breadcrumb
=> FAIL: Notice the page reloads!
4. Apply the patch
5. Repeat steps 1-3
=> SUCCES: Verify the page doesn't reload and navigation works smoothly
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-19 10:22:07 +00:00
Kyle M Hall 42472f6b34
Bug 42098: EDIFACT edi_cron.pl runs disabled plugins due to bug in Koha::Plugins::Handler::run
It appears that edi_cron.pl will run disabled EDI plugins. It uses Koha::Plugins::Handler::run that does not check if the plugins is gets are disabled.

Koha::Plugins::Handler::run needs to be fixed to not run disabled plugins.

Test Plan:
1) Apply this patch
2) prove t/db_dependent/Koha/Plugins/Plugins.t

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-19 10:20:35 +00:00
Jonathan Druart c1ab7be960
Bug 41384: Trying to fix SIP2/Accounts.ts random failures
The intercept is done too late, it must be done before we load the view,
and then we should wait for it.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2026-03-18 14:24:32 +01:00
Jonathan Druart be37389414
Bug 38262: (follow-up 2) Fix cypress tests
16:40:49       <failure message="The following error originated from your application code, not from Cypress. It was caused by an unhandled promise rejection.
16:40:49
16:40:49   &gt; response.filter is not a function
16:40:49
16:40:49 When Cypress detects uncaught errors originating from your application it will automatically fail the current test.
16:40:49
16:40:49 This behavior is configurable, and you can choose to turn this off by listening to the `uncaught:exception` event.
16:40:49
16:40:49 https://on.cypress.io/uncaught-exception-from-application" type="TypeError"><![CDATA[TypeError: The following error originated from your application code, not from Cypress. It was caused by an unhandled promise rejection.
16:40:49
16:40:49   > response.filter is not a function
16:40:49
16:41:13 When Cypress detects uncaught errors originating from your application it will automatically fail the current test.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2026-03-18 09:50:23 +01:00
Jonathan Druart a6a6fafe74
Bug 38262: Do not fail if at least one additional field exists in DB
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2026-03-18 09:50:22 +01:00
Jonathan Druart b936dc5d73
Bug 38365: Fix Cypress tests
ReferenceError: window is not defined
    at /kohadevbox/koha/t/cypress/plugins/dist/api-client.cjs.js:521:26
    at /kohadevbox/koha/t/cypress/plugins/dist/api-client.cjs.js:523:3
    at Object.<anonymous> (/kohadevbox/koha/t/cypress/plugins/dist/api-client.cjs.js:747:3)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Object.require.extensions.<computed> [as .js] (/kohadevbox/Cypress/12.17.4/Cypress/resources/app/node_modules/ts-node/dist/index.js:851:20)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)
    at require (node:internal/modules/helpers:182:18)
    at Object.<anonymous> (/kohadevbox/koha/t/cypress/plugins/api-client.js:11:23)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Object.require.extensions.<computed> [as .js] (/kohadevbox/Cypress/12.17.4/Cypress/resources/app/node_modules/ts-node/dist/index.js:851:20)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)
    at require (node:internal/modules/helpers:182:18)
    at Object.<anonymous> (/kohadevbox/koha/t/cypress/plugins/insertData.js:14:29)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Object.require.extensions.<computed> [as .js] (/kohadevbox/Cypress/12.17.4/Cypress/resources/app/node_modules/ts-node/dist/index.js:851:20)
2026-03-17 09:38:51 +01:00
Jonathan Druart 1e1a446a55
Bug 38365: Fix xt/author/valid-templates.t
13:12:25 #   Failed test '/kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/includes/str/import_from_kbart_file.inc'
13:12:25 #   at xt/author/valid-templates.t line 147.
13:12:25 # undef error - : filter not found
13:12:25
13:12:25 #   Failed test '/kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/includes/str/job_progress.inc'
13:12:25 #   at xt/author/valid-templates.t line 147.
13:12:25 # undef error - : filter not found
13:12:25
13:12:25 #   Failed test [13:12:08] xt/author/valid-templates.t .................................................
13:12:25 Dubious, test returned 28 (wstat 7168, 0x1c00)
13:12:25 Failed 28/870 subtests
13:12:26 '/kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/includes/str/tinymce_i18n.inc'
13:12:26 #   at xt/author/valid-templates.t line 147.
13:12:26 # undef error - : filter not found
13:12:28
13:12:28 #   Failed test '/kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/includes/str/erm_sushi_harvester.inc'
13:12:28 #   at xt/author/valid-templates.t line 147.
13:12:28 # undef error - : filter not found
2026-03-17 09:38:50 +01:00
Jonathan Druart f124229b23
Bug 38365: Fix Koha/Middleware/ContentSecurityPolicy.t
GIT_INSTALL is not set and we get the wrong root.
The test suite does not pass on a non git install anyway.
2026-03-17 09:38:50 +01:00
David Cook edb99983f7
Bug 38365: Require a non-empty nonce in FrameworkPlugin.t
Test plan:
0. Apply the patch
1. Run the following:
prove t/db_dependent/FrameworkPlugin.t \
    t/db_dependent/Koha/Plugins/Valuebuilder_hooks.t \
    t/db_dependent/Koha/UI/Form/Builder/Biblio.t \
    t/db_dependent/Koha/UI/Form/Builder/Item.t \
    t/db_dependent/Serials.t

Squashed version of the following patches:

Bug 38365: Fix Koha/UI/Form/Builder/Biblio.t

    #   Failed test at t/db_dependent/Koha/UI/Form/Builder/Biblio.t line 216.
    #                   '<script nonce="">
    # $(document).ready(function () {
    #
    # });
    # </script>
    # '
    #     doesn't match '(?^us:<script>.*</script>)'
    # Looks like you failed 1 test of 4.

Bug 38365: Fix Koha/UI/Form/Builder/Item.t

 # There were 16 warning(s)
 #     Previous test 0 ''
 #     Use of uninitialized value $csp_nonce in concatenation (.) or string at /kohadevbox/koha/Koha/FrameworkPlugin.pm line 381.
 #  at /kohadevbox/koha/Koha/FrameworkPlugin.pm line 381.

Bug 38365: Fix Serials.t

Bug 38365: Fix FrameworkPlugin.t
2026-03-17 09:38:49 +01:00
Jonathan Druart 99cfa22537
Bug 38365: Do not rely on KOHA_HOME in tests
We never do that in our tests, and KOHA_HOME is not defined for
the kohadev-koha user in ktd.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2026-03-16 11:57:44 +01:00
Lari Taskula 046e0f7885
Bug 38365: Adjust t/mock_templates/opac-tmpl/bootstrap/en/modules/opac-csp.tt
This file now tidies after the patch
"Make tidy.pl compatible with script elements with attributes"

To test:
1. prove t/db_dependent/Koha/Middleware/ContentSecurityPolicy.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2026-03-16 11:57:43 +01:00
Jonathan Druart e00059dd1a
Bug 38365: Add CSP nonces to all inline script and style tags
Signed-off-by: Lari Taskula <lari.taskula@hypernova.fi>

Amended-by: Jonathan Druart
Regenerated the patch on top of bug 41324, using:
perl misc/devel/add_csp_nonces.pl --apply
============================================================
Summary:
  Files scanned:  881
  Files modified: 456
  Tags modified:  800
============================================================

Also note that this manual change:
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-authoritiessearchresultlist.tt
-    <script type="text/JavaScript">
+    <script nonce="[% Koha.CSPNonce | $raw %]">

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2026-03-16 11:57:42 +01:00
David Cook 90f173ac6a
Bug 38365: Add context to Koha::Devel::Files in add_csp_nonces.pl
The add_csp_nonces.pl file should use the exceptions in
Koha::Devel::Files.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2026-03-16 11:57:41 +01:00
Jonathan Druart 62f5411fb5
Bug 38365: Add test_valuebuilder_popup.tt to the exception list
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2026-03-16 11:57:40 +01:00
David Cook 8b17f6158d
Bug 38365: Set __webpack_nonce__ for style-loader plugin and fix fontawesome imports
By setting __webpack_nonce__ webpack/rspack will add the nonce to styles
added using style-loader plugin.

Also, stop fontawesome from auto injecting CSS elements, and instead
manually import them so that they can be picked up by style-loader

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2026-03-16 11:57:39 +01:00