Commit Graph

8293 Commits

Author SHA1 Message Date
Paul Derscheid 43c06a34ce
Bug 40915: (RMaint follow-up) Backport adaptation to satisfy xt/find-license-problems.t
Should be reverted as soon as Bug 40163 is backported.

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-29 10:02:11 +01:00
Tomás Cohen Arazi 116d3d9f06
Bug 40915: Add comprehensive regression tests for SIP MsgType message parsing and debug logging
These tests verify that C4::SIP::Sip::MsgType correctly parses SIP messages without
creating problematic arrayref field values, and validates enhanced debug logging for
empty critical fields.

Test Coverage:
• Message parsing with correct protocol versions (PATRON_INFO/HOLD/RENEW use v2, CHECKOUT
uses v1)
• Empty patron_id and item_id field detection with debug logging
• Malformed delimiter handling (double delimiters, trailing empty fields)
• Multiple consecutive empty fields in single message
• Confusing delimiter patterns that could break parsing
• Verification that parsed fields are strings, not arrayrefs
• Working siplog mock infrastructure in C4::SIP::Sip::MsgType

Arrayref Prevention Tests:
Tests verify message parsing DOESN'T create empty arrayrefs that would later cause "Odd
number of elements in anonymous hash" errors when passed to Koha::Objects->find()
operations.

Enhanced Debug Logging Tests:
Tests validate that empty critical fields (patron_id, item_id) are detected during
parsing and generate appropriate debug messages to help troubleshoot downstream
constraint errors.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 499b23d63c)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-28 21:29:02 +01:00
Jonathan Druart a9bc9c79ce
Bug 40981: Prevent KohaTable/Holdings_spec.ts to fail randomly
There is a JS warning raised by DT which makes the tests fail:
```
The following error originated from your application code, not from Cypress.

  > DataTables warning detected in log: "DataTables warning: table id=holdings_table - Ajax error. For more information about this error, please see https://datatables.net/tn/7"
```

It is caused by a 404 returned by the API, because DT receives the
response during the afterEach (after the objects have been deleted)

We must wait for the responses when needed.

Test plan:
  cypress run --spec t/cypress/integration/KohaTable/Holdings_spec.ts
should still pass

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit de85f171fd)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-28 21:28:57 +01:00
David Cook 0ec1ea7fc8
Bug 40622: Use OPAC MARCXML for ILS-DI GetRecords
This change makes it so that the ILS-DI GetRecords output for
"marcxml" will contain the OPAC version of the record.

Test plan:
0. Apply the patches
1. prove t/db_dependent/ILSDI_Services.t
2. Go to http://localhost:8081/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=29
3. Click "Settings" to change the framework to Default, and click "Save"
4. Go to http://localhost:8081/cgi-bin/koha/admin/marc_subfields_structure.pl
?op=add_form&tagfield=245&tagsubfield=a&frameworkcode=#subafield
5. Untick the "OPAC" box and click "Save changes"
6. Go to system preferences
7. Change "ILS-DI" to "Enable"
8. Change "ILS-DI:AuthorizedIPs" to 0.0.0.0/0
9. Go to http://localhost:8080/cgi-bin/koha/ilsdi.pl?service=GetRecords&id=29
10. Note that you cannot see the title in the MARCXML.

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 02aba8c0b2)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-23 23:06:53 +02:00
Jonathan Druart 22930bb0f1
Bug 32950: Remove unecessary DELETE
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit e39e568e6a)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-23 23:06:50 +02:00
Martin Renvoize 84839808bb
Bug 32950: Add test for moving subfield in repeatable fields
This test verifies that when moving subfields between repeatable fields,
existing values in fields that don't contain the source subfield are
preserved.

The test creates multiple 020 fields:
- Some with existing $a values
- Some with $z values to be moved to $a

After applying the move template, it verifies:
- Existing $a values are preserved
- $z values are moved to $a only in fields that had $z
- $z subfields are properly removed after the move

Signed-off-by: Bernard Scaife <bernard.scaife@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit daa661f86c)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-23 23:06:49 +02:00
Pedro Amorim ded9e8584d
Bug 40171: Add tests
prove t/db_dependent/Koha/ILL/Requests.t

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 46ffd07b85)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-23 23:06:44 +02:00
Jonathan Druart 77a78121f2
Bug 40320: Use insertSamplePatron
On
  commit 959b7e8f05
  Bug 40345: Add insertSamplePatron

We remove the ability to insert a patron using insertObject, we need to
use insertSamplePatron instead.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit be0dd91c41)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-23 23:06:44 +02:00
Jonathan Druart c1bd4858a7
Bug 40320: (bug 40319 follow-up) Add Cypress tests
Test plan:
Make sure the display of city, state and zipcode is the same as before
the patch
Confirm that the new Cypress tests pass

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

Amended-by: Jonathan Druart
Added $raw filter to [% ", " %]

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 67e04b039a)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-23 23:06:43 +02:00
Jonathan Druart 316c59c3e3
Bug 40467: Remove t/00-deprecated.t
it only tests for the presence of "switch"

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit d996664353)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-23 23:06:42 +02:00
Jonathan Druart 8ae89b639b
Bug 40865: Add a cypress test
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 93a78880cb)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-23 23:06:39 +02:00
Jonathan Druart a712b68635
Bug 40265: (try to) prevent OAI/Server.t to fail on slow server
Jenkins failed with:
21:50:07 koha_1       |     #    got : '2025-06-26T19:50:06Z'
21:50:07 koha_1       |     # expect : '2025-06-26T19:50:07Z'

A guess is that we change second between the 2 dt_from_string calls, and
the comparison fails.

One thing however: it seems that we want to deal with timezone correctly
here, but if we change the timezone in koha-conf.xml, the tests fail...

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Change looks good, but does not work for another timezone.
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 73719c417f)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-23 23:06:38 +02:00
Jonathan Druart 66e8f837dd
Bug 40876: Apply 'exact' to all attributes when column filtering
If you select an option in a column filter, the "exact" behaviour will
only apply to the first attribute mapped to this column

eg. on the patron search we have "Libraries" mapped to library.name and
library.library_id. If you select Centerville/CPL, the generated q
parameter will be {name: CPL, id: {like: "%CPL%"}}

This is caused by:
    if (value.match(/^\^(.*)\$$/)) {
        value = value.replace(/^\^/, "").replace(/\$$/, "");
On the second parameter we have lost the ^$ markers

Moving it out of the loop fixes the problem (and does not impact the
other behaviours: we search the same value for all the attributes

Test plan:
Create a library with code=CPLL and use if for a patron
Go to http://localhost:8081/cgi-bin/koha/members/members-home.pl
Click search
Select "Centerville" in the "Libraries" column filter
=> Without this patch you get the patrons from CPL and CPLL
=> With this patch applied only patrons from CPL are listed

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 9e437a4089)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-25 19:32:21 +02:00
Jonathan Druart 8b46adfb96
Bug 40858: Search merge conflict on files part of the git index
Same as bug 34303 and bug 33743, our test suite must parse/process files
that are part of the index, not all the other files.

It's currently failing on kohadev-db-request.txt that is owned by root.
But it's not part of the Koha codebase, this file should not be tested.

There were also node_modules and po files that were processed.

Test plan:
  prove t/00-merge-conflict-markers.t
must now return gren

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit cc72eabc5f)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-25 16:22:57 +02:00
Jonathan Druart 000a40eb4a
Bug 36095: Fix Selenium tests
#                   'Details for opac holds test place hold button › Koha online catalog'
        #     doesn't match '(?^u:Details for: opac holds test place hold button)'

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 0de9601048)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-25 16:22:55 +02:00
Martin Renvoize 6260f6c40d
Bug 40675: Add unit tests for SIP line ending normalization
This patch adds comprehensive unit tests for the add_field function
to verify that all types of line endings (Unix \n, Windows \r\n,
Mac \r, and mixed) are properly normalized to spaces to prevent
SIP message corruption.

Tests cover:
- Unix line endings (\n)
- Windows line endings (\r\n)
- Mac line endings (\r)
- Mixed line ending combinations
- Normal text without line endings
- Empty values

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit b535f20596)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-25 16:22:51 +02:00
Jonathan Druart 0bfefa98ad
Bug 40708: Fix Circulation/Returns.t
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 1091533b91)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-25 16:22:48 +02:00
Nick Clemens ba8d8ea3bc
Bug 31460: Merge item groups when merging records
Test:
1. Have a record (A) with 3 items.
2. Create an item group with 2 of these items.
3. Have a second record (B) with 4 items
4. Create an item group with 2 of these items.
5. Merge the two records together keeping record A
6. Results will show that all items are moved over to record A, but the item group from record B, is not there.
7. Apply patch
8. Create a new record (C) with 3 items.
9. Create an item group with 2 of these items
10. Merge this into record A
11. The item groups are moved!

Signed-off-by: Miranda Nero <mnero@oslri.net>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit f7897d7d81)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-25 16:22:45 +02:00
Tomás Cohen Arazi 9e2eafec0e
Bug 40812: Move Theke sample plugin repo to GitHub
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 18ff4d4933)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-25 16:22:44 +02:00
Jonathan Druart a0d12b6077
Bug 39980: Add Test::NoWarnings
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit ad3ca52450)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-25 16:22:44 +02:00
Julian Maurice 32b31e2a27
Bug 39980: Add tests for .../acquisition/vendors* in Mojo context
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 54f84f232a)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-25 16:22:43 +02:00
Jonathan Druart 2ee0a54788
Bug 40765: Fix EDI.t
I have no idea why this is fixing the test!

Without this patch they fail:

t/db_dependent/Koha/EDI.t .. 1/5
    #   Failed test '14 log lines recorded for passed invoice file'
    #   at t/db_dependent/Koha/EDI.t line 725.
    #          got: '12'
    #     expected: '14'

    #   Failed test 'Warn recorded for transferring items'
    #   at t/db_dependent/Koha/EDI.t line 728.
    #                   'Unmatched item at branch:WID'
    #     doesn't match '(?^u:transferring.*)'

    #   Failed test 'Warn recorded for transferring items'
    #   at t/db_dependent/Koha/EDI.t line 728.
    #                   ''
    #     doesn't match '(?^u:transferring.*)'

    #   Failed test 'Warn recorded for unmatched item'
    #   at t/db_dependent/Koha/EDI.t line 728.
    #                   ''
    #     doesn't match '(?^u:Unmatched item at branch:.*)'
    # Looks like you failed 4 tests of 32.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit ec2fbf3a4d)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-25 16:22:38 +02:00
Jonathan Druart ba7b962235
Bug 40765: Prevent acquisition tests to fail if order.quantity = 0
When using TestBuilder to build an order the tests will fail when the object will be saved:

00:09:41 koha-1      |     # Looks like you planned 58 tests but ran 26.
00:09:41 koha-1      |
00:09:41 koha-1      | #   Failed test 'cancel() tests'
00:09:41 koha-1      | #   at t/db_dependent/Koha/Acquisition/Order.t line 1042.
00:09:41 koha-1      | Cannot insert order: Mandatory parameter quantity is missing at t/db_dependent/Koha/Acquisition/Order.t line 868.
00:09:41 koha-1      | # Looks like your test exited with 255 just after 14.
00:09:41 koha-1      | [22:03:54] t/db_dependent/Koha/Acquisition/Order.t

This happened on Koha_Main/3350

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 621b75ddf0)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-25 16:22:38 +02:00
Paul Derscheid f62f0645ae
Revert "Bug 15516: Fix Cypress test"
This reverts commit 11678357bb.

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-25 15:55:58 +02:00
Paul Derscheid 46c4ae220e
Revert "Bug 36135: Fix t/Koha/Auth/Permissions.t"
This reverts commit cf7e5338d7.

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-25 15:55:53 +02:00
Paul Derscheid 29f7415bfd
Revert "Bug 36135: Fix Cypress test"
This reverts commit 4a4541826a.

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-25 15:55:48 +02:00
Pedro Amorim 8ac94d1226
Bug 39345: (QA follow-up): Fix erm_custom_reports.t
prove t/db_dependent/api/v1/erm_custom_reports.t

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 7491053be6)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:43:56 +02:00
Pedro Amorim d3aa5ec2d7
Bug 39345: (QA follow-up): Add exception handling for unsupported counter release
To test this on the UI, you can add the following line of code at the beginning on 'new' in SushiCounter.pm:
->{response}->{Report_Header}->{Release} = 6;

This will force the release to be '6'. Then you can perform a harvest using the UI. The background job will fail with the error message saying that counter release 6 is not supported

prove t/db_dependent/Koha/BackgroundJobs/ErmSushiHarvester.t

Signed-off-by: Eric Phetteplace <phette23@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 9482590909)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:43:55 +02:00
Pedro Amorim 0f7cd550a0
Bug 39345: (QA follow-up): Fix QA complaints
QA script still fails but I believe these are false positives caused by the tests files being moved

Signed-off-by: Eric Phetteplace <phette23@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit dcf28e5b8a)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:43:55 +02:00
Pedro Amorim faa32f6f7f
Bug 39345: (QA follow-up): Fix data provider tests
Update original tests to consider COUNTER 5 specifically.
Add new test for COUNTER 5.1.

Signed-off-by: Eric Phetteplace <phette23@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit cb97c60d16)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:43:54 +02:00
Pedro Amorim 85464856d8
Bug 39345: Add COUNTER 5.1 Tests
JSON data files extracted from sample responses at:
https://counter5.cambridge.org/r51/sushi-docs/#/

Additional docs referenced:
https://cop5.projectcounter.org/en/5.1/appendices/g-sample-counter-reports-and-standard-views.html

Run:
prove t/db_dependent/Koha/ERM/EUsage/*

Signed-off-by: Eric Phetteplace <phette23@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit db5f51e4ce)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:43:53 +02:00
Pedro Amorim 0255a0e174
Bug 39345: Preparation: Move original test files
We are now considering more than one COUNTER release. Move test files accordingly.

prove t/db_dependent/Koha/ERM/EUsage/*

Signed-off-by: Eric Phetteplace <phette23@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 1f94070e60)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:43:52 +02:00
Tomas Cohen Arazi 5e5aba4e57
Bug 40636: Regression tests
This patch adds regression tests that demonstrate the bug in
CancelExpiredReserves where the holiday logic checks if today is a
holiday instead of checking if the hold's expiration date was a holiday.

The bug causes:
1. Holds that expired on non-holidays to remain active if the cleanup
   script runs on a holiday
2. Holds that expired on holidays to be cancelled if the cleanup script
   runs on a non-holiday

Test scenarios added:
- Hold expired on Monday (non-holiday), script runs on Tuesday (holiday)
- Hold expired on Wednesday (holiday), script runs on Thursday (non-holiday)
- Hold expired on Friday (non-holiday), script runs on Sunday (holiday)
- Hold expired on Saturday (holiday), script runs on Sunday (holiday)

These tests currently fail, demonstrating the bug exists. When the bug
is fixed, all tests should pass.

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 828bf1917d)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:43:49 +02:00
Tomas Cohen Arazi 790e92ffb9
Bug 40636: Add `Koha::Calendar->has_business_days_between()` method
This patch adds a new method to Koha::Calendar that returns a boolean indicating
whether there are any business days between two given dates (exclusive).

Implementation details:
* Returns 1 if any business days exist between start and end dates
* Returns 0 for consecutive days, same dates, or only holidays between
* Uses exclusive range (does not include start or end dates)
* Handles date comparison and timezone normalization
* Efficient early return when first business day is found

This is designed specifically for use cases like detecting missed
business days due to server downtime or scheduling issues.

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

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 2bfb86afb5)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:43:48 +02:00
Pedro Amorim b3a9ed2262
Bug 40644: Add tests
If you apply this patch before the other one:

prove t/db_dependent/Koha/Biblio.t

Will fail. Apply both patches. The above now passes.

This highlighted something. Following the test plan I can't reproduce
this anymore. In order to reproduce, the check-outs need to happen
before the bookings, otherwise when the check-outs happen on an existing
booking it'll 'complete' or 'cancel' the booking thus not causing the
error.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 1617927b99)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:43:48 +02:00
Lucas Gass 54728d4f68
Bug 39820: Add cancellation reason and clean up cancellation request
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit f2adf0ad82)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:43:47 +02:00
Martin Renvoize bb8da54478
Bug 39820: (QA follow-up) Unit tests
This patch adds unit tests.. but it also adds some FIXME and QUESTION
statements to those tests

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 888ec190ef)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:43:46 +02:00
David Cook 11678357bb
Bug 15516: Fix Cypress test
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 890d9069eb)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:43:43 +02:00
David Cook 4a4541826a
Bug 36135: Fix Cypress test
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 04c6afaff8)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:43:42 +02:00
Jonathan Druart cf7e5338d7
Bug 36135: Fix t/Koha/Auth/Permissions.t
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit b04e71d4ba)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:43:42 +02:00
Tomas Cohen Arazi 1d0ba36aec
Bug 40275: Unit tests
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>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 666223d61e)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:43:36 +02:00
Lucas Gass 93d2e29507
Bug 9762: (follow-up) Mock the user branch in NoIssuesChargeGuarantees.t and dateexpiry.t tests
Without the patch:

t/db_dependent/Circulation/NoIssuesChargeGuarantees.t fails
t/db_dependent/Circulation/dateexpiry.t fails

With the patch:

t/db_dependent/Circulation/NoIssuesChargeGuarantees.t passes
t/db_dependent/Circulation/dateexpiry.t passes

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 1ea765d3bd)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:43:31 +02:00
Lucas Gass 3bc4add338
Bug 9762: Adjust number of tests in CanBookBeIssued.t
Without this patch:

t/db_dependent/Circulation/CanBookBeIssued.t failes

With this patch:

t/db_dependent/Circulation/CanBookBeIssued.t passes

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit a12b523113)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:43:30 +02:00
Lucas Gass 9f7222f44c
Bug 9762: (follow-up) Add Test::NoWarnings to CanBookBeIssued.t
Without this patch:

prove -v /kohadevbox/koha/xt/use-test-no-warnings.t fails

With this patch:

prove -v /kohadevbox/koha/xt/use-test-no-warnings.t passes

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 942df980da)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:43:28 +02:00
Martin Renvoize 3334d14cae
Bug 9762: (follow-up) Add integration tests and improve AddRenewal logging consistency
This commit adds two key improvements to the Bug 9762 circulation override logging:

1. **Consistent JSON Logging**: Updated AddRenewal to always log in JSON format,
   matching AddIssue behavior. Previously AddRenewal only logged JSON when
   confirmations/forced were present, otherwise logged just the item number.

2. **Integration Tests**: Added comprehensive tests for both AddIssue and AddRenewal
   JSON logging functionality:
   - Test normal operations (empty confirmations/forced arrays)
   - Test override operations (populated confirmations/forced arrays)
   - Verify JSON structure and content accuracy

The AddRenewal function now consistently logs:
```json
{
  "issue": 123,
  "itemnumber": 456,
  "confirmations": [...],
  "forced": [...]
}
```

This ensures uniform action log format across all circulation operations and
provides better integration test coverage for the override logging functionality.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit b31f8c566d)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:43:28 +02:00
Martin Renvoize df6a9ab122
Bug 9762: (follow-up) Fix failing Circulation.t test
The test was failing with RegisterRequired exception because payin_amount()
requires a cash register when UseCashRegisters preference is enabled.

Fixed by setting UseCashRegisters to 0 in the lost item return policies test
to allow payments without requiring a cash register.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 4bcbbd8722)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:43:27 +02:00
Martin Renvoize 71e462f7ef
Bug 9762: (follow-up) Fix failing CanBookBeIssued test
The test was failing because:
1. IssuingInProcess preference was not explicitly set, affecting the code path for message logging
2. The patron category had a random noissuescharge value that overrode the system preference

Fixed by:
- Setting IssuingInProcess to 0 to ensure correct code path
- Setting patron category noissuescharge to undef to use system preference

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 1660f68690)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:43:27 +02:00
Martin Renvoize ec2fbaf888
Bug 9762: (QA follow-up) Fix executable bit
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit e51399c332)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:43:23 +02:00
Matthias Le Gac ed145d5a37
Bug 9762: Test CanBookBeIssued.pm
To test:

1) Apply the patch
2) run prove t/db_dependent/Circulation/CanBookBeIssued.t

--After each step, a message will be displayed in the action_logs table and in Tools > Log viewer --

Circulation -- Checking out

1) Check out an item that is age-restricted (AgeRestrictionOverride syspref)
2) Check out an item that has a “not for loan” status (AllowNotForLoanOverride syspref)
3) Check out an item that has a “lost” status (IssueLostItem syspref)
4) Check out an item to a patron who has reached the checkout limit (AllowTooManyOverride syspref)
5) Check out an item to a patron who is not allowed to borrow this item type
6) Check out an item to a patron who has unpaid fines (AllFinesNeedOverride and/or AllowFineOverride + noissuescharge sysprefs)
7) Check out an item on hold for someone else
8) Check out an item on hold ready for pickup by someone else
9) Check out an item already checked out to someone else (AutoReturnCheckedOutItems syspref)
10) Check out to a patron who has restrictions

Circulation -- Checking in

11) Ignore a hold upon check in
12) Ignore a hold and transfer upon check in

Circulation – Renewing

13) Renew an item on hold for someone else (AllowRenewalOnHoldOverride syspref)
14) Renew an item that has reached the maximum number of renewals (AllowRenewalLimitOverride syspref)

Holds

15) Place a hold for a patron who is not allowed to place this item type on hold (AllowHoldPolicyOverride syspref)
16) Place a hold for a patron who has reached the maximum number of holds
17) Place an item-level hold when rules dictate that this is not allowed (In circulation rules put "On shelf holds allowed" to "If any unavailable")

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 3a084d020e)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:43:22 +02:00
Nick Clemens db39dc1607
Bug 40331: (follow-up) Adjust t/db_dependent/Circulation/transfers.t
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit e327039ba1)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:43:21 +02:00