Commit Graph

61143 Commits

Author SHA1 Message Date
Hammat Wele 22a13ba009
Bug 8088: Png-images of covers lost transparency
Images of covers must preserve transparency of png-images. This is
useful for example for the covers of CD/DVD disks.

Plan test :
1. Apply the patch.
2. In 'Koha administration > System preferences', set
   'LocalCoverImages' to 'show' and  OPACLocalCoverImages to 'show'.
3. Create a new bibligraphical record
4. In the record details select tab Images and click on upload
5. Click on « Drop files here » and select the image file to upload then
   click «Process images»
6. Search for the record created on step 3
7. Click on the record to view detail page (detail.pl)
8. Click on the image to view it fully
   ---> Notice the background is transparent
9. Save the image and open it
   ---> Notice the background is transparent

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 14:10:15 -06:00
Baptiste 3af877e78a
Bug 39027: Order news on opac-main.pl by publication date instead of ID
On the OPAC, news should rather be ordered by the publication date than
by the creation date (~ id): a user want to see last published news
first and not last created news, regardless of their publication date

TEST PLAN:
1 - Create 3 news, have the 3 news published in an order different from
  their id (for example news 1 => 2020, news 2 => 2025, news 3 => 2023)
2 - Go on http://youropac/cgi-bin/koha/opac-main.pl -> news are ordered
  by ID
APPLY PATCH
3 - Repeat 2 -> news are ordered by Date

Signed-off-by: Mercury <mercury@coffee.geek.nz>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 14:10:14 -06:00
Thomas Klausner 1bb30a26cd
Bug 40577: Bulk biblio ES index update after auth change
When merging (or updating) authorities, the biblios using the auths might also be updated. If this happens, Koha used to create one background job for each biblio. If an auth is used in a lot of biblios, this creates a lot of background jobs, each to index one single biblio.

This patch fixes that by collecting the affected biblios and putting all of them into one reindex background job.

Test plan:

* Apply the patch
* run the unit test t/db_dependent/Authority/Merge.t
* the test should now have 16 tests in total, with a new test #15 output like this:

    1..3
    ok 1 - 3 bibliographic record updated while merging two authorities
    ok 2 - we have only one more background job
    ok 3 - we have the correct biblio ids in the job to be indexed
ok 15 - merge with ModBiblio only creates one indexer background job for multiple biblios
ok 16 - no warnings

Manual test plan (rather cumbersome):

* Start KTD with ElasticSearch
* Create an PERSON authority (eg "100a Test")
* Create three biblios which use that authority in eg 100
* Access the DB to get the count of background jobs
  * `ktd --dbshell`
  * `select count(*) from background_jobs;`
  * the count should be the same as the number of biblios you created (eg 3). But whatever it is, remeber it
* Edit the authority (change 100 to "Test new")
  * check if the change is reflected in the linked biblios (100a = "Test new")
* Check the Background jobs in the DB again:
  * `select count(*) from background_jobs;`
  * should be three more than previously (eg 6)
  * You can use this SQL to verify that the last three jobs each contain one biblionumber (which is what we want to fix):
  * `select json_extract(data,'$.record_ids'),enqueued_on from background_jobs order by enqueued_on desc limit 3;`

+-----------------------------------+---------------------+
| json_extract(data,'$.record_ids') | enqueued_on         |
+-----------------------------------+---------------------+
| [2299]                            | 2026-03-25 13:19:34 |
| [2300]                            | 2026-03-25 13:19:34 |
| [2301]                            | 2026-03-25 13:19:34 |
+-----------------------------------+---------------------+

* Now apply the patch and run restart_all

* Edit the authority again, setting 100a to "Test new patched".
* The biblios should change accordingly
* Check the Background jobs in the DB again:
  * `select count(*) from background_jobs;`
  * This should now be only 1 more then the last time (so eg 7)
  * Check the details of the background jobs:
  * `select json_extract(data,'$.record_ids'),enqueued_on from background_jobs order by enqueued_on desc limit 3;`
  * The most recent entry should now contain three items in one row, and the following two should be the same as in the previous query (i.e. the old jobs from the edit before the patch)

+-----------------------------------+---------------------+
| json_extract(data,'$.record_ids') | enqueued_on         |
+-----------------------------------+---------------------+
| [2299, 2300, 2301]                | 2026-03-25 13:29:17 |
| [2300]                            | 2026-03-25 13:19:34 |
| [2299]                            | 2026-03-25 13:19:34 |
+-----------------------------------+---------------------+

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 14:10:14 -06:00
Janusz Kaczmarek 95267338d5
Bug 42016: Add identifier-other search field for authorities (MARC 21)
MARC 21 authority records often have 024 $a (Other Standard
Identifier) - https://www.loc.gov/marc/authority/ad024.html,
but the field 024 is missing from ES search fields and the record
cannot be found with these identifiers.

Test plan
=========
1. Have a ktd instance with Elasticsearch.
2. Add a 024 field to an authority record, i.e. for Alatriste, Gustavo:
   024 7# $a 86971927 $7 viaf
3. In Authorities, make an 'Entire record' search for the added
   identifier. You should get no results.
4. Apply the patch, reindex with:
   sudo koha-elasticsearch --rebuild -r -d -a kohadev
5. Repeat p. 3. You should now be able to find the record.

Sponsored-by: Pontificia Università di San Tommaso d'Aquino (Angelicum)
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 14:10:07 -06:00
Lucas Gass 98abc435c8
Bug 21820: DBRev 25.12.00.044
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 11:37:19 -06:00
Paul Derscheid 77d6fe1732
Bug 21820: (QA follow-up) Fix bug number in atomicupdate
- bug_number was set to 40853 instead of 21820 (probably copy-paste error)

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 11:37:19 -06:00
Thomas Klausner 55308aa365
Bug 21820: Add ElasticsearchEnableZebraQueue syspref to control Zebra indexing when using Elasticsearch
Previously, Koha always added items to the Zebra queue when indexing via Elasticsearch. This adds a new system preference ElasticsearchEnableZebraQueue that allows disabling this behavior.

Unit Test:

* run the unit test t/db_dependent/Koha/SearchEngine/Elasticsearch/Indexer.t
* there should be a new subtest like this:

    1..5
    ok 1 - We start with an empty zebra queue
    ok 2 - new entry in zebraqueue for auth
    ok 3 - new entry in zebraqueue for biblio
    ok 4 - no new entry in zebraqueue for auth
    ok 5 - no new entry in zebraqueue for biblio
ok 5 - syspref ElasticsearchEnableZebraQueue

Manual Test Plan:

* Start ktd with Elasticsearch enabled
* As there is no interface to the zebraqueue, you need to connect to the DB and use SQL directly
  * ktd --dbshell
  * `select count(*) from zebraqueue;`
  * remember that number
* Edit any biblio or auth
* Check the zebraqueue again via SQL
* There should be one more entry

* Now apply the patch
* Then got to Sysprefs and set ElasticsearchEnableZebraQueue to `Disable`

* Edit another biblio or auth
  * has to be a different one, because Koha will prevent the same ID to be added again to zebraqueue
* Again check  zebraqueue via SQL
* There should be *no* new entry

QA Note:

the qa tool reports
[FAIL] Koha/SearchEngine/Elasticsearch/Indexer.pm
   FAIL	 pod_coverage
		sub _get_record has no pod coverage.

But this patch does not touch this code, so I guess this fail is caused by a stricter qa tool

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 11:37:18 -06:00
Tomás Cohen Arazi 75eeedd735
Bug 22639: Add export mappings button to mappings page
This patch adds an 'Export mappings' button to the Elasticsearch
mappings configuration page. It triggers a YAML download of the
current search field mappings using the new API endpoint.

To test:
1. Apply this patch (and the previous API endpoint patch)
2. Navigate to Administration > Search engine configuration
=> SUCCESS: An 'Export mappings' button appears next to 'Reset mappings'
3. Click 'Export mappings'
=> SUCCESS: A 'search_mappings.yaml' file is downloaded
4. Verify the YAML file contains the expected mappings structure
=> SUCCESS: File contains search fields grouped by index
5. Sign off :-D

Signed-off-by: Laurence <laurence.rault@biblibre.com>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 11:37:18 -06:00
Tomás Cohen Arazi caa52ddf91
Bug 22639: Add GET /config/search_mappings endpoint
This patch adds a new API endpoint to retrieve the search field
mappings configuration (search fields and their MARC mappings, grouped
by index).

The endpoint supports content negotiation:
- application/json (default)
- application/yaml (for export/import compatibility)

An optional 'type' query parameter allows filtering mappings by MARC
type (marc21 or unimarc).

Implementation notes:
- New controller: Koha::REST::V1::Config::SearchMappings
- Reuses Koha::SearchEngine::Elasticsearch::raw_elasticsearch_mappings
- Registers 'application/yaml' MIME type in Koha::REST::V1
- Permission: manage_search_engine_config

To test:
1. Apply this patch
2. Rebuild the API bundle:
   $ yarn api:bundle
3. Restart Plack
4. Run:
   $ prove t/db_dependent/api/v1/config_search_mappings.t
=> SUCCESS: Tests pass
5. Test manually:
   $ curl -u user:pass /api/v1/config/search_mappings
=> SUCCESS: Returns JSON with search field mappings
   $ curl -u user:pass -H 'Accept: application/yaml' \
     /api/v1/config/search_mappings
=> SUCCESS: Returns YAML output
   $ curl -u user:pass /api/v1/config/search_mappings?type=marc21
=> SUCCESS: Only marc21 mappings are returned
6. Sign off :-D

Signed-off-by: Laurence <laurence.rault@biblibre.com>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 11:37:17 -06:00
Robin Sheat 975f0c3508
Bug 36550: allow defaults to be defined for koha-elasticsearch
koha-elasticsearch only allows the parameters to be specified on the
command line, otherwise it'll fall back to values hard-coded in the
script. This allows default parameters to be defined in
/etc/default/koha-common when installed with the Debian packages.

It also copies the current defaults into the defaults file.

Test plan, comprehensive:
1. You will need a package setup with elasticsearch, and some records.
2. Build a package (or copy the files modified in this patch over ones
   you might already have installed)
3. Modify some ES_* values in /etc/default/koha-community to your
   liking.  'ES_VERBOSE' might be a good one.
4. Do an elasticsearch reindex and observe that your parameter defaults
   are respected.

Test plan, simple:
1. With a git checkout:
   * `sudo ln -s .../koha/debian/scripts/koha-functions.sh /usr/share/koha/bin/koha-functions.sh`
   * `sudo ln -s .../koha/debian/koha-common.default /etc/default/koha-common`
2. Modify `.../koha/debian/scripts/koha-elasticsearch` around line 200
   so that it prints out the variables, and see that it properly respects
   modifying the defaults and/or setting the command line arguments.

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 11:37:17 -06:00
Thomas Klausner 45a9cd081d
Bug 39158: (QA follow-up) Fixing POD
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 11:37:16 -06:00
David Gustafsson 37aca2b36c
Bug 39158: Reduce code duplication in marc_records_to_documents
Refactor marc_record_to_documents to avoid code duplicaiton.

To test:
1) Verify tests in t/db_dependant/Koha/SearchEngine/Elasticsearch.t all
   pass
2) Apply patch
3) Veriy tests in t/db_dependant/Koha/SearchEngine/Elasticsearch.t
   still pass

Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 11:37:16 -06:00
Lucas Gass 3f5372717f
Bug 38136: DBRev 25.12.00.043
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 11:37:15 -06:00
Lucas Gass bf2cffdba6
Bug 38136: DBIC
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 11:37:15 -06:00
Katrin Fischer 134497c28e
Bug 38136: Tidy
Feel free to squash.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 11:37:14 -06:00
Julian Maurice e7f483def5
Bug 38136: Refactor database translations (alternative)
This has the same goals of bug 24975 but with a different approach.

Bug 24975 tried the "POT/PO files as database tables" approach but
it appeared that is not what best fits our needs.

Instead of a "source text / translated text" mapping, we need
translations to be attached to a specific "object" (or table row), which
has the added benefit of keeping translations unaffected when the
original string changes. It may or may not be what you want but at least
this avoids the problem where fixing an error in the original string
forces users to re-translate everything.

We also need to be able to translate all translatable properties of a
particular entity.

The solution proposed here is to add a DBIC component that will add
several DBIC relations to the `localization` table:
* a relation named `localizations` that will return all translations for
  all translatable properties for all languages.
* for each translatable property:
  * a relation named `{$property}_localizations` that will return all
    translations for a given property, for all languages
  * a relation named `{$property}_localization` that will return the
    translation for a given property, for the current language

To enable translations for a particular entity, we will need to:
* add two method calls in the "result class" corresponding to the
  localizable object type
* in the admin interface, add a link to the the translation popup.
  Unlike bug 24975 there is not a page where you can translate
  everything. I don't know if it is really useful (probably better to
  translate itemtypes when you are on the itemtype page). It can be
  added later if needed.

To give an example, this is what needs to be added manually in
Koha/Schema/Result/Itemtype.pm:

    __PACKAGE__->load_components('+Koha::DBIx::Class::Localization');
    __PACKAGE__->localization_add_relationships(
        'itemtype', # the PK column
        'description' # a list of translatable columns
    );

(see POD in Koha/Schema/Component/Localization.pm for more information)

Final notes:
* I wanted this patch to have as few changes as possible so I kept
  methods like `search_with_localization`, `children_with_localization`
  even if I believe they can be removed (replaced by search/children)
  Localizations do not need to be prefetched/joined unless you want to
  sort on them.
  For the same reason, $itemtype->unblessed now always return a
  `translated_description` key.
  This can be fixed in followup patches
* There is cache involved (see
  Koha::Schema::Component::Localization::localization).
  Localizations in cache are grouped by object type and language (keys
  look like 'KOHA:localization:Itemtype:en')
* By keeping a single table for all translations of all entities, we
  cannot have data integrity at the RDBMS level, but automatic deletion
  of translations is handled by the DBIC `cascade_delete` feature, so
  integrity should be fine as long as no raw SQL update/delete operation
  is involved.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 11:37:14 -06:00
Nick Clemens 99eb693cd9
Bug 41733: Honor EmailPatronRegistrations in the API
This patch adds new overrides opac_reg_yes and opac_reg_no to the patrons api
and will send a notice to the library when a patron is registered via the API if the pref is
active and the NO override is not sent, or the YES override is sent

To test:
1 - Apply patches
2 - yarn build
3 - restart_all
4 - run unit tests

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 11:37:13 -06:00
Nick Clemens 8f6677be5a
Bug 41733: Unit tests
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 11:37:13 -06:00
Nick Clemens 925d5f50be
Bug 42107: Add search scores to staff results page
This patch ensures the scores from ES are passed through and added to the
search results in the staff side.

Initially hidden, the scores can be shown by entering the line below into the
JS console in developer tools in the browser, or added to IntranetUserJS to
make them always show:
$(".search_score").toggle();

To test:
1 - Have Koha using ES
2 - Do some searches, note results
3 - Apply patch, restart all
4 - Confirm results don't change
5 - Enter code from description into IntranetUserJS
6 - Do more searches
7 - Note the score is visible

To really note scores, you will need to add some weights to the ES config:
Set weights like:
title 32
author 16
subject 8

Signed-off-by: Andrew Auld <andrew.auld@openfifth.co.uk>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 11:37:12 -06:00
Jonathan Druart 6eed79ccf8
Bug 41994: Implement /sysprefs route to list system preferences
This new route will be used in a follow-up bug to auto-complete
sysprefs when using the header to search for sysprefs.

Note that this is based on top of bug 41834 that NULL options,
explanation and type in DB, but a future enhancement will populate the
response to return the values present in the yaml files.

Test plan:
1. Bundle the swagger specs and reload plack:
   yarn api:bundle && koha-plack --reload kohadev
2. Fetch the sysprefs using the new route:
 curl -u koha:koha --request GET 'http://${INSTANCE}-intra.localhost/api/v1/sysprefs' --header "Content-Type: application/json" | jq
3. Confirm that the tests pass
   prove t/db_dependent/api/v1/sysprefs.t

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jan Kissig <bibliothek@th-wildau.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 11:37:05 -06:00
Jonathan Druart f59c396024
Bug 42353: Store the node version in .nvmrc
The context is koha-i18n and the Weblate sync. We need to know which version of node to use before running yarn install.

Prior to the upgrade to Node 20 all our Koha versions were using the same version (18).

Now 22.11 is using 18 and others are using 20.

We need to announce which version is needed for each of our branch.

Test plan:
Apply this patch
Install nvm:
  curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
run `nvm use`
=> It tells you to install 20
nvm install 20
nvm use # will read .nvmrc and use 20
yarn install
=> Success

Checkout Koha's branch 22.11.x (git checkout origin/22.11.x)
Apply the patch for 22.11
nvm use
=> It tells you to install 18
nvm install 18
nvm use # wil read .nvmrc and use 18
yarn install => Success

git checkout bug_42353 (main + 42353's patch for main)
nvm use && yarn install
=> Success

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 09:14:53 -06:00
Lucas Gass 752fe3a04d
Bug 42300: Add title and aria-label to authlink on the OPAC detail page
To test:
1. Go to the OPAC detail page for a record with authority links.
2. Notice the magnifying glass icon is link but there is no text or aria label for screen readers
3. APPLY PAATCH, restart_all, clear browser cache
4. Repeat steps 1 -2.
5. You should see both an aria-label and a title labeled "View authority record"

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 09:14:53 -06:00
Laura_Escamilla 6af5032c3a
Bug 41934: Add label to responsive control column header in OPAC course reserves
The responsive control column in the OPAC course reserves table
contained an empty <th>, which results in an empty header and
accessibility warnings from automated tools.

This patch adds visible text ("Expand") to the header cell to
provide a meaningful label for all users and resolve the issue.

To test:
1. Enable course reserves and add at least one course with items.
2. Visit the OPAC course reserves page.
3. Inspect the table header row.
4. Confirm the responsive control column now contains "Expand".
5. Verify no empty header warnings are reported by accessibility tools.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 09:14:52 -06:00
Baptiste Wojtkowski 6bb400bb9a
Bug 41997: Submit properly default suggester in suggestion.tt
Steps to reproduce, only on main.
1 - Open a form creation suggestion.
2 - With code explorer, notice that there is: <input type="hidden" id="suggestedby" name="suggestedby" value="" /> in the code
3 - Apply patch
4 - With code explorer, notice that there is: <input type="hidden" id="suggestedby" name="suggestedby" value="51" /> in the code
5 - Submit form, notice the suggester is properly written

Signed-off-by: Felicie <felicie.thiery@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 09:14:52 -06:00
Petro Vashchuk b3cddc9994
Bug 41454: Remove unused dbh calls
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Amended-by: Jonathan Druart
Tidy C4/Search.pm

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 09:14:51 -06:00
Pedro Amorim 041fa90a0d
Bug 41861: Update how cost and price_paid show
1) Enabled ILLModule
2) Create a new ILL request, set a title, '42' for cardnumber and any library:
<staff_url>/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=Standard
3) (k-t-d required, cost is not editable in UI, but backends may set it) Run the following query:
koha-mysql kohadev
update illrequests set cost = 1;
4) Notice cost shows, now run the same but set to 0:
update illrequests set cost = 1;
5) Notice it doesn't show.
6) Apply patch. Refresh. Notice is shows '0' now.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Edith Speller <edith.speller@ukhsa.gov.uk>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 09:14:50 -06:00
Eric Phetteplace f7327f6e45
Bug 42222: Use of uninitialized string in string eq in Auth.pm
Testing:
- Follow plack intranet and/or opac error logs, tail -f /var/log/koha/kohadev/plack-*-error.log
- Login using web browser
- Do a POST request on either intranet or OPAC, for instance:
  - Staff: Reports > create a new SQL report "select 'hello'"
  - Public: search, select a book, add to a list
- 'uninitialized string' error appears in respective logs
- Apply patch
- restart_all
- Do another POST request
- No further errors should appear in the logs

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 09:14:50 -06:00
Laura_Escamilla 36d757c952
Bug 41933: Add accessible label to course reserves search input
To test:
1. Apply the patch.
2. Navigate to the OPAC course reserves page:
   http://localhost:8080/cgi-bin/koha/opac-course-reserves.pl
3. Inspect the course reserves search input using browser developer
   tools.
4. Confirm the search input has an associated <label> containing
   accessible text (e.g. "Search courses").
5. Confirm the visual appearance of the search control is unchanged.
6. Sign off

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 09:14:49 -06:00
Lucas Gass 4de3130aec
Bug 41884: Adjust tests
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 09:14:49 -06:00
Lucas Gass 2186fa2798
Bug 41884: Make barcode a link to the item
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 09:14:48 -06:00
Lucas Gass c42f58d196
Bug 41884: Add better reporting when item fails to modify via batch mod
To test:
1. Search for the system preference, PreventWithDrawingItemsStatus
2. Select both in transit and checked out, then save
3. Find an item and put it in transit.
4. Try to batch modify the item, making it withdrawen.
5. View the details of job, you should see 1 item could not be modified.
6. APPLY PATCH, restart_all
7. Try the steps again, this time when you get to the details of the job you should see more information on the item that failed:

    1 item could not be modified.
        39999000001457 : Item is in transit

8. Repeat this steps with a a checkout out item.
9. Also try with multiple items that will fail, ensure the display looks good.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 09:14:48 -06:00
Nick Clemens 42b042b4a4
Bug 42312: Clear vendor address before saving new address lines
This patch clears the vendor address fields before processing the new input
and also adds a space between lines when joining the display

To test:
1 - Create or edit a vendor and enter 'Physical address' as
    Line 1
    Line 2
    Line 3
    Line 4
2 - Edit the vendor, clear physical address and enter:
    New Line 1
3 - Save, search for vendor, and note the address shows as
    New Line 1Line2Line3Line4
4 - Apply patch, yanr build, reload the page and clear cache
5 - Clear physicall address and enter
    Newnew line 1
6 - Search for vendor and confirm display is:
    Newnew line 1 Line 2 Line 3 Line 4

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 09:14:47 -06:00
Owen Leonard 2a1ccd9c4f
Bug 41835: (follow-up) Clean up CSS
There are some aspects of .subfield_line in addbiblio.css which are
incorrect or redundant. This follow-up removes those lines from
addbiblio.css and from the copied CSS in serials-edit.css

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 09:14:47 -06:00
Emmi Takkinen 6122e55a32
Bug 41835: Add CSS file for serial edits page
Add item forms Tag editor buttons on serial edits page were misaligned
with their respective input fields. This happens because there is no
rule for their parent div to display its children elements correctly.
This patch adds this rule for serial edits page in new serial-edits.css
file.

To test:
1. Make sure MARC framework for serials uses plugins in some 952 fields
   (e.g. dateaccessioned.pl plugin in field 952$d).
2. Find an active serial subscription and receive items for it.
3. Open Add item form.
   -> Note that Tag editor buttons aren't displayed inline with input
      fields.
4. Apply this patch, restart services if needed.
5. Refresh page.
   -> Note that Tag editor buttons are now displayed inline with input
      fields.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 09:14:46 -06:00
Jan Kissig bcdd04c08b
Bug 42301: Fix error occuring on updatedatabase when using MySQL
This patch fixes an error when running updatedatabase on an instance using MySQL by defining a key length for an unique key. The unique key in table record_sources was introduced on 35380 but was lacking a key length which works in mariaDB but fails on MySQL.

Test plan:
a) run ktd with mysql f.e.: DB_IMAGE=mysql:8.0 ktd --proxy --name mysql8 up -d
b) enter ktd shell ktd --name mysql8 --shell
c) checkout a Koha version prior to 35380. f.e. "git checkout 67adbce6562fa352b143977747fa290f23c63fde"
d) run 'reset_all'
e) log in and check Koha version in http://mysql8-intra.localhost/cgi-bin/koha/about.pl which should show
25.12.00.036
f) git checkout main
g) restart_all
h) updatedatabase will throw the following error:
Upgrade to 25.12.00.037  [08:29:14]: Bug 35380 - Add new unique name to record sources, add default record sources, add is_system column to default record sources.
        ERROR: {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: BLOB/TEXT column 'name' used in key specification without a key length at /kohadevbox/koha/C4/Installer.pm line 817
i) apply patch
j) 'updatedatabase' should run without errors now

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 09:14:46 -06:00
Jan Kissig d56976e9a6
Bug 42318: Populate record_sources with system defined values on install
This patch adds predefined values to the record_sources table on installation of a new Koha instance. The values are
- batchmod
- intranet
- batchimport
- z3950
- bulkmarcimport
- import_lexile
and were formerly hardcoded in marc-overlay-rules.tt. This was introduced in 35380 which took care of updated instances via a db_revs script but forgot installation scripts.

Testplan
a) start up a fresh ktd
b) login and check go to Administration -> Record sources
c) check that no source exists
d) apply patch
e) go to mysql shell 'koha-mysql kohadev'
f) empty the database to trigger Kohas installer: 'drop database koha_kohadev;' followed by a 'create database koha_kohadev;'
g) restart_all
h) open Koha in browser again, the web installer should appear now. Credentials are 'koha_kohadev' with pasword 'password'.
i) run through the installation and create an admin user,
j) login with that user and repeat b) and c)
k) check that record sources are now set with the values from the descriptioni above.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 09:14:45 -06:00
Lucas Gass 5e44515ec3
Bug 35380: (follow-up) Fix DBRev 251200037.pl
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-15 09:14:39 -06:00
Lucas Gass c9c8ec5693
DBIC changes to Category.pm
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-14 16:11:42 -06:00
Jonathan Druart 6aa49457ed
Bug 41594: Add Cypress tests
* Add Cypress tests to cover the 404 redirect if the pref is disabled
* Add "invoices" as possible embed option for
  /acquisitions/vendors/:vendor_id
Seems relevant as the api def for invoice if expecting for it
api/v1/swagger/definitions/invoice.yaml
* Tell insertObject how to generate an invoice and return it.
Unfortunately we don't have a direct route for that, hence the embed
on /vendors/:vendor_id

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-14 10:49:05 -06:00
David Cook 4951426642
Bug 41594: Disable access to invoice-files.pl if AcqEnableFiles disabled
This patch makes it so that invoice-files.pl returns 404 if
AcqEnableFiles is disabled

Test plan:
0. Apply the patch
1. koha-plack --restart kohadev
2. Go to /cgi-bin/koha/acqui/invoice-files.pl?invoiceid=999
3. Note that you see a 404 page
4. Change "AcqEnableFiles" syspref to "Do"
5. Go to /cgi-bin/koha/acqui/invoice-files.pl?invoiceid=999
6. Note that you now see a "Files for invoice" page

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-14 10:49:05 -06:00
Jonathan Druart 54d710cfae
Bug 42048: Add a Cypress test
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-14 10:49:04 -06:00
David Cook 0c4cb8ce02
Bug 42048: Build patron search description more carefully
This patch builds the patron search description more carefully
to avoid XSS

Test plan:
0. Apply the patch
1. Log into Koha and click on "Patrons"
2. Change the "Category" and "Library" to any option but "Any"
   and click "Search"
3. Type "test" into the data table "Search:" box
4. Note some text should appear on the screen similar to this content
   and format:

   Patrons found for: Anywhere: test
   Library=Centerville, Category=Board

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-14 10:49:04 -06:00
David Cook 32e5c736e7
Bug 41261: Valid inputs to unapi
This change adds data validation to the "unapi" API endpoint.

Test plan:
0. Apply the patch
1. Go to http://localhost:8080/cgi-bin/koha/unapi
2. Note the 400 HTTP response code
3. Go to http://localhost:8080/cgi-bin/koha/unapi?id=bad
4. Note the 400 HTTP response code
5. Go to http://localhost:8080/cgi-bin/koha/unapi?id=koha:biblionumber:1&format=bad
6. Note the XML response listing the available formats for that ID
7. Go to http://localhost:8080//cgi-bin/koha/unapi?id=koha:biblionumber:1
8. Note the XML response listing the available formats for that ID
9. Go to http://localhost:8080//cgi-bin/koha/unapi?format=mods
10. Note the 400 HTTP response code
11. Go to http://localhost:8080//cgi-bin/koha/unapi?id=koha:biblionumber:1&format=mods
12. Note the MODS format returned for biblionumber 1

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-14 10:48:48 -06:00
Martin Renvoize 348846ceb0
Bug 40383: (follow-up) Add css files to gitignore
We need to add these generated files to the gitignore.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-04-13 14:56:34 +01:00
Martin Renvoize a738127ded
Bug 41216: (follow-up) Fix path to sample.tt in xgettext-tt2.t
Bug 41216 moved sample.tt into tt/en/ but the test still referenced
the old path, causing xgettext-tt2.t to fail.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-04-13 09:52:55 +01:00
Martin Renvoize bda5afd49c
Bug 40383: (follow-up) Fix flaky Cypress EDIFACT search tests in CI
Replace cy.wait(N) + bare assertion with assertion-based waits using
{ timeout: 10000 }, and replace .type(term, { delay: 50 }) with
.invoke('val', term).trigger('input') to avoid keyboard simulation
timing races against the 500ms debounce in the search component.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-04-13 09:28:07 +01:00
Janusz Kaczmarek 278aa32c03
Bug 41870: Warning "Use of uninitialized value $borrowernumber" in opac-detail.pl
Under some circumstances (OPACShowHoldQueueDetails set, hold made,
OPAC user not logged in) a warning like:

[WARN] Use of uninitialized value $borrowernumber in numeric eq (==) at /kohadevbox/koha/opac/opac-detail.pl line 598.

is being generated.

Test plan:
==========
1. Set OPACShowHoldQueueDetails to 'Show holds and their priority
   levels'.
2. From staff interface, place a hold on a record for any borrower.
3. Open a fresh browser (private mode or different browser), confirm
   that you are not logged in, go to this record.
4. Check the content of plack-opac-error.log. You should see a
   warning like:
   [WARN] Use of uninitialized value $borrowernumber in numeric eq (==) at /kohadevbox/koha/opac/opac-detail.pl line 598
5. Apply the patch ; restart_all.
6. Repeat p. 3 & 4. There should be no new warning now.

Sponsored-by: Ignatianum University in Cracow
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-10 09:48:13 -06:00
Janusz Kaczmarek 00c4c9a599
Bug 41863: Facets generated from Authorized values sometimes show empty labels
With facets generated from Authorized values, it may happen that the
list of authorized values lacks an entry for a code used in
a record. In this case, an empty entry will appear in the
facet list, with the number of uses but without any label.

It would be desirable to show at least the raw code, rather
than an empty label. This makes it easier to see which code has no
entry in the respective AV and to either add it or correct an
erroneous code.

Test plan:
==========

1. Have a standard KTD installation with Elasticsearch.
2. Add AV COUNTRY_CODES category and add two pairs (Authorized
   value, Description):
   * enk - England
   * xxu - United States

3. In the admin/searchengine/elasticsearch/mappings.yaml file,
   correct the definition of the pl search field as follows:

   pl:
-    label: pl
+    facet_order: 24
+    label: Publication place
     mandatory: ~
+    authorised_value_category: COUNTRY_CODES
     mappings:
-    - facet: ''
+    - facet: 1
       marc_field: 008_/15-17
       marc_type: marc21
       sort: 1

4. Reindex ES with:
   koha-elasticsearch --rebuild -r -d -b kohadev

5. Set the displayFacetCount systempreference to 'Show'
6. Perform a general search in the OPAC or staff interface: *
   View the 'Publication place' facet and notice a dozen empty
   entries, with only the number of occurrences.
7. Apply the patch ; restart_all
8. Repeat p. 6. You will see country codes that you can now add to AV
   or correct.

BTW, note that the tiny correction to Search.pm is analogous to
setting the label for 'special' types (i.e. itype, location, ccode,
holdingbranch, homebranch) two lines above.

Sponsored-by: Ignatianum University in Cracow
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-10 09:48:12 -06:00
Nick Clemens e83f14c5fe
Bug 41843: Gracefully handle XML errors during authority deletion
This patch updates move_to_deleted in Koha::Authorities to attempt to
handle encoding errors and delete a record with invalid marcxml.

If recoverable, the leader of the deletd record will be updated to
reflect deletion, but in the case it cannot the XML will be saved
unaltered.

To test:
1 - Find an authority record that is not used in your Koha
    More->Authorities, search for 'a'
    Record #1541 for example
2 - Make the record have errors:
    sudo koha-mysql kohadev
    UPDATE auth_header SET marcxml = UpdateXML(marcxml, '//datafield[@tag="040"]/subfield[@code="c"]',CONCAT('<subfield code',CHAR(27),'="c">OSt</subfield>')) WHERE auth_header.authid=1541;
3 - In the search results, click Actions->Delete
4 - Error 500!
5 - Apply patch, restart all
6 - Delete the record
7 - Success!

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

Amended-by: Jonathan Druart
tidy

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-10 09:48:12 -06:00
Jonathan Druart ebd8e4f169
Bug 42126: Make 00-strict.t run strict on all Perl files
The current implementation is wrong:
* we list explicitly the directories to process and it's not kept up-to-date (eg. booking and Koha are missing).
* we should process the files that are in the git repository, and use Koha::Devel::Files to list them.

This patch suggests to use git ls-files (through Koha::Devel::Files) and
process them one by one. Also only call strict_ok instead of
all_perl_files_ok.
all_perl_files_ok was doing strict_ok and syntax_ok, but syntax_ok is
doing a `perl -c` that is done in xt/pl_valid.t already

We can ignore xt and t: the tests are... run by the test suite.

On main:
Files=1, Tests=1360, 287 wallclock secs ( 0.05 usr  0.02 sys + 1677.26 cusr 268.46 csys = 1945.79 CPU)
real    4m46.741

all_perl_files_ok with t and xt:
Files=1, Tests=3488, 884 wallclock secs ( 0.10 usr  0.01 sys + 3820.09 cusr 720.63 csys = 4540.83 CPU)
real    14m44.086s

all_perl_files_ok without t and xt:
Files=1, Tests=2666, 586 wallclock secs ( 0.08 usr  0.03 sys + 2261.22 cusr 447.02 csys = 2708.35 CPU)
9m46.519s

With this patch (syntax_ok without t and xt):
Files=1, Tests=2663, 337 wallclock secs ( 0.09 usr  0.01 sys + 76.18 cusr 70.32 csys = 146.60 CPU)
real    5m36.870s

Note that Koha/Account/Credit.pm, Koha/Account/Debit.pm and Koha/Old/Hold.pm are failing strict_ok, we ignore them for now:
Inconsistent hierarchy during C3 merge of class 'Koha::Account::Credit':
        current merge results [
                Koha::Account::Credit,
        ]
        merging failed on 'Koha::Account::Line' at /usr/lib/x86_64-linux-gnu/perl-base/base.pm line 186.
BEGIN failed--compilation aborted at Koha/Account/Credit.pm line 22.

Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-10 09:48:11 -06:00