Commit Graph

6861 Commits

Author SHA1 Message Date
Marcel de Rooy 585ea49741
Bug 40608: (QA follow-up) Delete notice in test, adjust about.tt
[1] This prevents a warn 'Violation of unique constraint in Letter'
    from TestBuilder if the notice already exists.
[2] The about warn should no longer say that password changes will
    fail but only warn about a missing notification.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 8d31c2e067)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:42:35 +02:00
Tomas Cohen Arazi ab0fa4fea6
Bug 40608: (follow-up) Some tests rely on existing data
Playing with the about page, I noticed prior tests in the codebase fail
if the letter doesn't exist.

This patch fixes that.

To test:
1. With a fresh KTD run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/Patron.t
=> SUCCESS: Tests pass!
2. Delete the existing notices:
  k$ koha-mysql kohadev
   > DELETE FROM letter WHERE code="PASSWORD_CHANGE"; \q
3. Repeat 1
=> FAIL: Tests fail! Current tests print a warn (Test::NoWarning)
doesn't like this
4. Apply this patch
5. Repeat 1
=> SUCCESS: Tests now pass. The test creates its own notice.
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 93a830b8ca)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:42:35 +02:00
Tomas Cohen Arazi 6ebff3d47f
Bug 40608: Regression tests
When NotifyPasswordChange is enabled and a patron has a valid email address,
but there is no PASSWORD_CHANGE letter template, the set_password method
fails silently and returns undef instead of changing the password.

This adds comprehensive regression tests to demonstrate the bug:

1. Bug condition: Missing PASSWORD_CHANGE letter template causes password
   change to fail and method returns undef
2. Control test: Password change works when NotifyPasswordChange is disabled
3. Control test: Password change works when PASSWORD_CHANGE letter exists

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 0c310ccfc0)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:42:33 +02:00
Jonathan Druart 2b39454874
Bug 22632: Prevent tests to fail randomly
Jenkins was failing on Koha_Master/3350

With this patch we won't rely on the order (timestamp are identical and
may not be sorted as expected)

23:56:28 koha-1      |     #   Failed test 'GetLogs returns results in the log viewer for the merge of 526'
23:56:28 koha-1      |     #   at t/db_dependent/Koha/Patron/Log.t line 67.
23:56:28 koha-1      |     #          got: 'G7X8jre jVr_oz8M (eQXWiW9b4jX16424uC3Chn) has been merged into Mwqx7a zkSkFX7 (y_L7flupzFShb8JWYVCwYGSuv)'
23:56:28 koha-1      |     #     expected: 'exgnQtw lLmxQL9eWY (nHc_VZdFHIXr90p6WrIijDPgFrz8JM38) has been merged into Mwqx7a zkSkFX7 (y_L7flupzFShb8JWYVCwYGSuv)'
23:56:28 koha-1      |
23:56:28 koha-1      |     #   Failed test 'GetLogs returns results in the log viewer for the merge of 527'
23:56:28 koha-1      |     #   at t/db_dependent/Koha/Patron/Log.t line 82.
23:56:28 koha-1      |     #          got: 'exgnQtw lLmxQL9eWY (nHc_VZdFHIXr90p6WrIijDPgFrz8JM38) has been merged into Mwqx7a zkSkFX7 (y_L7flupzFShb8JWYVCwYGSuv)'
23:56:28 koha-1      |     #     expected: 'G7X8jre jVr_oz8M (eQXWiW9b4jX16424uC3Chn) has been merged into Mwqx7a zkSkFX7 (y_L7flupzFShb8JWYVCwYGSuv)'
23:56:28 koha-1      |     # Looks like you failed 2 tests of 4.
23:56:28 koha-1      |
23:56:28 koha-1      | #   Failed test 'Test Koha::Patrons::merge'
23:56:28 koha-1      | #   at t/db_dependent/Koha/Patron/Log.t line 113.
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 3f337c53ee)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-16 14:02:31 +02:00
Nick Clemens 85e5b036f9
Bug 22632: (QA follow-up) Add no warnings test
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 7ef460765d)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-16 14:02:30 +02:00
Owen Leonard 886ff35adf
Bug 22632: (follow-up) QA tool corrections for Log.t
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 8ed44fde97)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-16 14:02:29 +02:00
Owen Leonard 8a09899885
Bug 22632: (follow-up) Use PATRON_MERGE as log action
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 80c656d79e)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-16 14:02:29 +02:00
Axel Amghar f0b80e6c79
Bug 22632: Unit Testing of patch 22632
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit ad7b8607ed)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-16 14:02:29 +02:00
Jonathan Druart 6da4c46de5
Bug 40444: Fix onboarding and installer selenium tests
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit c456dd86b4)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-16 14:02:27 +02:00
Jonathan Druart 8c6d148911
Bug 40444: Add Test::NoWarnings to newly added api/v1/cash_registers.t
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit e4b27be895)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-16 14:02:26 +02:00
Jonathan Druart 319d6f88cd
Bug 40444: Add a test to ensure all Perl test files use Test::NoWarnings
This patch adds a new xt test (xt/use-test-no-warnings.t) to make sure
all our Perl test files will use Test::NoWarnings.

It also adds Test::NoWarnings to some files that were missing it and
that didn't need any other changes.

However we still have 7 non-trivial tests that we will consider
exception for now, until they are fixed.

Test plan:
  prove xt/use-test-no-warnings.t
should return green.
And all other tests modified by this patch (the qa script will do that
for you)

You can also test the 2 selenium tests:
1. DROP and CREATE the DB
  DROP DATABASE koha_kohadev;
  CREATE DATABASE koha_kohadev;
  restart_all
2. KOHA_TESTING=1 prove t/db_dependent/selenium/00-onboarding.t
3. Repeat 1
2. KOHA_TESTING=1 prove t/db_dependent/selenium/01-installation.t

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 63eb2e1f4a)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-16 14:02:25 +02:00
David Cook d096290426
Bug 36561: Make /auth/password/validation use new permission
This patch updates the /auth/password/validation endpoint to use the new
api_validate_password permission instead of the generic borrowers
permission.

This provides more granular control over who can use the password
validation API endpoint.

To test:
1. Apply this patches
2. Rebuild the API spec
   $ ktd --shell
  k$ yarn api:bundle
3. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/password_validation.t
=> SUCCESS: Tests pass!
4. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 812b38d02c)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-16 14:02:23 +02:00
Lucas Gass c7420800a4
Bug 37883: (follow-up) Add a test
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 02aa7d08f2)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-16 14:02:21 +02:00
Lucas Gass f58bb7823c
Bug 23010: Adjust tests
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 9fefdd5674)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-16 14:02:07 +02:00
Lucas Gass 5965abb919
Bug 23010: More unit tests
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 7a299a8114)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-16 14:02:07 +02:00
Lucas Gass 0dea596fbb
Bug 23010: Add tests for AutomaticItemModificationByAge
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 7bc9a02bd2)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-16 14:02:06 +02:00
Lucas Gass af9615f3d9
Bug 23010: Update pref name to PreventWithdrawingItemsStatus
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit c4acafe29b)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-16 14:02:04 +02:00
Lucas Gass 5aef212975
Bug 23010: Add unit tests
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit b035515d1a)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-16 14:02:04 +02:00
Lucas Gass 2cb92275a1
Bug 40296: Fix failing Returns.t test
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit eab5aa774c)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-26 20:37:27 +02:00
Paul Derscheid 6ec782810f
Bug 40296: (QA follow-up) Increment test count to include Test::NoWarnings
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit fdd089a3ba)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-26 20:37:26 +02:00
Martin Renvoize cdb4e0dd30
Bug 40296: Add unit tests for booking status handling
This patch adds test coverage for the new booking status management
in AddIssue:

Test scenarios covered:
- Patron checking out their own booked item (marks as completed)
- Different patron checking out booked item during actual booking period
  (cancels booking)
- Checkout conflicts only during lead period (preserves booking, respects
  librarian decision)
- Checkout period encompassing entire booking period (cancels booking)
- No booking present (normal operation)

Tests ensure proper booking lifecycle management and validate that
librarian override scenarios work as intended.

To test:
1. Apply all patches
2. Run: prove t/db_dependent/Circulation.t
3. Verify all booking status handling scenarios pass

The test plans now provide:
- Step-by-step instructions for manual testing
- Multiple scenarios covering different use cases
- Clear expectations for what should happen in each case
- Practical workflow that staff would actually follow
- Edge cases like lead period conflicts and overrides

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 0a2b541321)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-26 20:37:26 +02:00
Matt Blenkinsop 6af70de8ec
Bug 37115: Add unit tests
prove t/db_dependent/Koha/Item.t
prove t/db_dependent/Koha/BackgroundJobs/BatchDeleteItem.t

Signed-off-by: Boubacar OUATTARA <boubacar.ouattara@biblibre.com>
Signed-off-by: Nathalie <nathalie.savarit@univ-amu.fr>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 66d10246a3)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-22 09:48:39 +02:00
Nick Clemens b13602054f
Bug 39917: (QA follow-up) Correct spelling and remove <p> tag around form
QA tools complained

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit d2f007320a)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-22 09:48:38 +02:00
Pedro Amorim 7d01add921
Bug 39917: Add tests
prove t/db_dependent/Koha/ILL/Requests.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 10fdcf23ee)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-22 09:48:36 +02:00
David Flater 567902f42d
Bug 39427: (follow-up) Adjust number of tests
Signed-off-by: David Flater <flaterdavid@gmail.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 08525887ca)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-22 09:48:26 +02:00
Laura_Escamilla 3bcfcfbe0a
Bug 39427: Searching lists table by owner can only enter firstname or surname
To test:
1. Ensure that the virtual shelves system preference is enabled
2. Create one or two lists using a patron that has both a first and last name. You don’t have to add items to the list, the list itself is enough.
3. Under the Owner column in the Lists table, search using the patron’s first name. Note that the name is properly filtered.
4. Next, try to search by the last name. It is also properly filtered.
5. Now search using both the first name and the last name together. Note that the results come up empty.
6. Apply the patch.
7. Repeat steps 3–5. Note that the patron shows in the results with just the first name, the last name, and the full name.
7.1. Additionally, try searching with extra spaces (e.g., ' Firstname Surname ' or 'Firstname Surname'). Confirm that results are still correctly shown.
8. Run t/db_dependent/Virtualshelves.t
9. Sign off and have a great day! :D

Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 9d5d88b0eb)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-22 09:48:26 +02:00
Tomas Cohen Arazi e991fc4057
Bug 40542: Add cancellation_reason to Koha::Hold->strings_map
This patch adds the mentioned AV to the returned strings structure.

It also adds tests for the method.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/Hold.t
=> SUCCESS: Tests pass!
3. Sign off :-D

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 0f533c1ceb)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-22 09:48:20 +02:00
Tomás Cohen Arazi b4631d5133
Bug 39632: Make plugin install and upgrade errors more useful
This patch makes the install and upgrade process for plugins to add the
newly added extra parameters to the thrown exceptions.

This is covered by the tests

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove -r t/Koha/Exceptions.t \
           t/db_dependent/Koha/Plugins
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 5c95c02476)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-22 09:48:14 +02:00
Nick Clemens 995e4c0177
Bug 39180: Unit tests
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 117acffacc)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-22 09:48:02 +02:00
Jonathan Druart ddf1b9dfe3
Bug 40490: Remove warnings from GD::Barcode::QRcode - U24
01:18:38 koha_1       | #   Failed test 'no warnings'
01:18:38 koha_1       | #   at /usr/share/perl/5.38/Test/Builder.pm line 193.
01:18:38 koha_1       | # There were 6 warning(s)
01:18:38 koha_1       | #     Previous test 4 '401 Unauthorized'
01:18:38 koha_1       | #     Use of uninitialized value $aMask[1079] in bitwise xor (^) at /usr/share/perl5/GD/Barcode/QRcode.pm line 217.
01:18:38 koha_1       | #  at /usr/share/perl5/GD/Barcode/QRcode.pm line 217.

jammy (22.04LTS) (perl): 1.15-7
noble (24.04LTS) (perl): 2.00-1

I guess it's fixed by
85e7911e65

But it is not released yet: version 2 is from September 2023 and commit from March 2024.

Test plan:
Install version 2 of GD::Barcode:
  `cpanm GD::Barcode@2.0.0`
Run the tests
Without this patch the "no warnings" test fails
With this patch applied the tests pass

Signed-off-by: David Cook <dcook@prosentient.com.au>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit fd6ceb6b24)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-22 09:48:00 +02:00
Pedro Amorim 3aa6bda853
Bug 39091: Add tests
Test plan:
prove t/db_dependent/api/v1/cash_registers.t

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 1a32644618)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-22 09:47:56 +02:00
Matt Blenkinsop 78968f9436
Bug 40417: Regression test
prove t/db_dependent/Koha/REST/Plugin/Objects.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit f45dd34d6e)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-22 09:47:55 +02:00
Tomas Cohen Arazi c7251cf7f5
Bug 40424: Add missing tests for search in body
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 5c82766985)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-22 09:47:54 +02:00
Martin Renvoize b4a580b9e0
Bug 40387: Comment some of the superflous diag
The test output was a little verbose in places, however the diag's can
be helpful when debugging failures. I've opted to comment rather than
completely remove them.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit a1bfc15cbf)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-22 09:47:52 +02:00
Martin Renvoize 3aae77e667
Bug 40387: Add tests for create_edi_order logger calls
Tests for the logger calls introduced in the create_edi_order
in the last commit.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 4c69085376)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-22 09:47:52 +02:00
Martin Renvoize e1e604f1c1
Bug 40387: Add Test::NoWarnings and replace carp with Koha::Logger
This patch adds Test::NoWarnings to our EDI unit tests. In doing so, it
reminded me that we still had some old carp style error handling in the
process_quote section and that we shoudl replace those with calls to
Koha::Logger instead.

Changes made:
1. Added Test::NoWarnings import to catch any warnings
2. Replace 'carp "Message"' appropriately with
   '$logger->warn("Message")'

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit ac3eced5d3)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-22 09:47:51 +02:00
Martin Renvoize 5c450b74a0
Bug 40387: Add test for undefined tax rate handling in EDI processing
This adds a test to verify that EDI invoice processing correctly handles
invoices without TAX segments (undefined tax rates).

The test covers:
1. Processing invoices without TAX segments
2. Verifying no warnings about uninitialized values in multiplication
3. Confirming tax rates are set to 0 when no tax information is present
4. Ensuring invoice processing completes successfully

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit dda29248ba)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-22 09:47:51 +02:00
Jonathan Druart e5eba4f13f
Bug 40371: Remove warnings from Budgets.t output
t/db_dependent/Budgets.t .. 153/156 Use of uninitialized value in multiplication (*) at /kohadevbox/koha/Koha/Acquisition/Order.pm line 543.
Use of uninitialized value in numeric eq (==) at /kohadevbox/koha/Koha/Acquisition/Order.pm line 554.
t/db_dependent/Budgets.t .. 154/156 Use of uninitialized value in multiplication (*) at /kohadevbox/koha/Koha/Acquisition/Order.pm line 543.
Use of uninitialized value in numeric eq (==) at /kohadevbox/koha/Koha/Acquisition/Order.pm line 554.
t/db_dependent/Budgets.t .. 155/156 Use of uninitialized value in addition (+) at /kohadevbox/koha/Koha/Acquisition/Order.pm line 510.

This change seems correct, but I am not 100% sure it won't introduce a
regression. What about 0 vs undef?

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 15a8f0444d)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-22 09:47:50 +02:00
Martin Renvoize 97ffd090b8
Bug 40401: (follow-up) Fix grammar and rollback in tests
- Fixed grammar: "Returns true if the patron is the anonymous patron"
- Fixed test cleanup: use txn_rollback instead of txn_begin
- Fixed test subroutine closure syntax

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 097ffd0af9)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-07-24 21:04:38 +02:00
Jonathan Druart 885c2c5662
Bug 40401: Implement Koha::Patron->is_anonymous
The first motivation of this patch is to remove the following warnings
from t/db_dependent/Auth.t:
Use of uninitialized value $anonymous_patron in string eq at /kohadevbox/koha/C4/Auth.pm line 1497

Actually a correct fix seems to add a new `is_anonymous` method to
Koha::Patron in order to remove the warnings from everywhere else.

Test plan:
Confirm that you cannot log in using the anonymous patron and that the 2
tests are passing
  prove t/db_dependent/Auth.t t/db_dependent/Koha/Patron.t

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>
(cherry picked from commit e49602a87e)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-07-24 21:04:38 +02:00
Jonathan Druart 20de12b601
Bug 40379: Remove warnings from t/db_dependent/www
XMLin complains because there are several nodes with the same name
attribute. Not sure what is correct or not, but we actually cannot use
the admin/DBMS user to login to the Koha interface.

We use KOHA_USER env var or default to 'koha'.

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 298884805a)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-07-24 21:04:33 +02:00
Martin Renvoize 3945404059
Bug 36947: (QA follow-up) Add FacetSortingLocale to Search.t mock preferences
The test was failing because the new FacetSortingLocale system preference
added was not included in the mock preference handler in t/db_dependent/Search.t.
This caused warnings about the unknown preference when the _sort_facets_zebra
function was called.

This commit adds the FacetSortingLocale preference to the mock, returning
'default' as the value, which matches the expected fallback behavior of
the new unicode collation sorting feature.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 21a217d5bf)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-07-24 10:23:44 +02:00
David Cook 53ea1c9a0b
Bug 36947: (QA follow-up) Add skippable unit test for fi_FI locale
This patch adds a skippable unit test for the fi_FI locale to prove
that the patches work well for other locales that don't use
the default Unicode collation. It will run on koha-testing-docker,
but will be skipped on systems lacking it.

This patch also fleshes out the existing unit tests a bit more
to prove that the patches also improves the sorting of names
with diacritics generally. That is, the default Unicode sort
is better than the existing stringwise/bytewise sort even for
English and French locales.

Test plan:
0. prove -v t/Koha/SearchEngine/Elasticsearch/Search.t \
    t/db_dependent/Search_FacetSorting.t

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 8c66e830b3)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-07-24 10:23:44 +02:00
Martin Renvoize 53488ff01c
Bug 36947: Add system preference for configurable locale-based facet sorting
This follow-up adds two major enhancements to the locale-based facet sorting
implementation:

1. **System Preference Integration**
   - Adds FacetSortingLocale system preference for configurable locale selection
   - Dynamically detects available system locales using Koha::I18N
   - Provides user-friendly dropdown with locale descriptions
   - Supports both Elasticsearch and Zebra search engines

2. **Zebra Search Engine Support**
   - Extends locale-based sorting to Zebra (in addition to existing Elasticsearch)
   - Implements _sort_facets_zebra() function in C4::Search
   - Maintains consistent Unicode-aware sorting behavior across search engines

Key Features:
- Dynamic locale detection via Koha::I18N::available_locales()
- Proper module architecture with comprehensive unit tests
- Clean fallback chain: preference → system LC_COLLATE → default
- Admin UI integration in System Preferences → I18N/L10N
- Universal facet sorting for international library systems

Test plan:
1. Apply patch and restart services
2. Install/run database update
3. Navigate to Administration → System Preferences → I18N/L10N
4. Verify "Sort facet names using" dropdown shows available system locales
5. Test facet sorting with different locales and both search engines
6. Run: prove t/Koha/I18N.t t/Koha/SearchEngine/Elasticsearch/Search.t t/db_dependent/Search_FacetSorting.t

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 146aca25f5)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-07-24 10:23:42 +02:00
Jonathan Druart 98b97ea075
Bug 40372: Remove warning from api/v1/holds.t
t/db_dependent/api/v1/holds.t .. 1/16 No reserves HOLD_CANCELLATION letter transported by email at /kohadevbox/koha/C4/Letters.pm line 602.

We do not test the notification here, we can simply ignore the letters
code

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>
(cherry picked from commit c14e72e782)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-07-24 10:23:41 +02:00
Jonathan Druart 7566ed0d99
Bug 40374: Remove warnings from Koha/Booking.t
t/db_dependent/Koha/Booking.t .. 1/2 DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Duplicate entry '7' for key 'PRIMARY' at /kohadevbox/koha/Koha/Object.pm line 174
DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Data truncated for column 'status' at row 1 at /kohadevbox/koha/Koha/Object.pm line 174

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>
(cherry picked from commit da423a717e)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-07-24 10:23:41 +02:00
Jonathan Druart 4091d99c0c
Bug 40376: Remove warning from AuthorisedValues.t
t/db_dependent/AuthorisedValues.t .. 1/17 DBIx::Class::Storage::DBI::insert(): Missing value for primary key column 'tagsubfield' on MarcSubfieldStructure - perhaps you forgot to set its 'is_auto_increment' attrib
ute during add_columns()? Treating 'tagsubfield' implicitly as an autoinc, and attempting value retrieval at /kohadevbox/koha/Koha/Object.pm line 174

It is a bit scary but it's only that we forgot to pass a value for
tagsubfield (that is NOT NULL and part of the PK)

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>
(cherry picked from commit 50b9abfe4f)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-07-24 10:23:40 +02:00
Jonathan Druart 66c969e037
Bug 40377: Remove warnings from HoldsQueue/TransportCostOptimizations.t
UseTransportCostMatrix set to yes, but matrix not populated at /kohadevbox/koha/C4/HoldsQueue.pm line 188.
UseTransportCostMatrix set to yes, but matrix not populated at /kohadevbox/koha/C4/HoldsQueue.pm line 188.

It seems that they are expected, we simply need to catch them.

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>
(cherry picked from commit 364b78e653)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-07-24 10:23:40 +02:00
Jonathan Druart c19ce68db1
Bug 40381: Remove warning from Koha/SearchEngine/Elasticsearch/ExportConfig.t
DBIx::Class::Storage::DBI::insert(): Missing value for primary key column 'filter' on SearchMarcToField - perhaps you forgot to set its 'is_auto_increment' attribute during add_columns()? Treating 'filter' implicitly as an autoinc, and attempting value retrieval at /kohadevbox/koha/Koha/SearchField.pm line 42
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>
(cherry picked from commit c2df4af991)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-07-24 10:23:40 +02:00
Jonathan Druart c4f54429a7
Bug 40406: Remove warnings from selenium/basic_workflow.t
t/db_dependent/selenium/basic_workflow.t .. 1/22 CP main = 1.93
t/db_dependent/selenium/basic_workflow.t .. 3/22 CP add patron category = 3.56
t/db_dependent/selenium/basic_workflow.t .. 5/22 CP add patron = 4.31
CP add biblio = 0.29
t/db_dependent/selenium/basic_workflow.t .. 11/22 CP add items = 9.81
t/db_dependent/selenium/basic_workflow.t .. 16/22 CP checkout = 5.97
t/db_dependent/selenium/basic_workflow.t .. 20/22 CP checkin = 4.04
t/db_dependent/selenium/basic_workflow.t .. 22/22 CP holds = 5.60
t/db_dependent/selenium/basic_workflow.t .. ok

This has been used in the past for benchmarking Koha.

I suggest to keep the warn but comment it.

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>
(cherry picked from commit 0e12c572e8)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-07-24 10:23:39 +02:00