Commit Graph

8063 Commits

Author SHA1 Message Date
David Cook d835fb1662
Bug 42847: [24.11] Fix unit test 2026-08-06 14:49:59 +00:00
Kyle M Hall 5472968ec6
Bug 42847: [24.11] Prevent previously authenticated user (squashed)
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-07-30 12:39:27 +00:00
Martin Renvoize 86a4896fd1
Bug 30233: (follow-up) Add tests for _apply_substitution and combined modifiers
- t/C4/ClassSplitRoutine/RegEx.t (new): exercises _apply_substitution via
  the public split_callnumber interface — basic substitution, alternate
  delimiters, \n/$n backrefs, /gi combined flag, /e rejection, and malformed
  or uncompilable rules (including the new logger warn path).
- t/Koha/Regex/Replacement.t: extend the subst() helper to handle the ig/gi
  combined modifier and add a subtest that confirms case-insensitive global
  replacement and backref case preservation.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
2026-07-30 12:18:01 +00:00
David Cook b6620915af
Bug 30233: (follow-up) fix some errors reported by QA tools
Note: While the methodology in Koha::Regex::Replacement may seem
bespoke, it's similar to how Python's re.sub(pattern, repl, string)
regex substitution works.

Unit tests:
prove -v t/Koha/Regex/Replacement.t \
    t/SimpleMARC.t \
    t/db_dependent/MarcModificationTemplates.t \
    t/Labels_split_Regex.t

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
2026-07-30 12:17:58 +00:00
Sanjar Tulkinov Anvar o'g'li 4f021a1f1f
Bug 30233: Add Koha::Regex::Replacement to expand replacements as data
Add a small single-pass helper, Koha::Regex::Replacement::expand_template,
that expands a user-supplied regex replacement string as data: numbered
backreferences ($1..$n, ${n}, the legacy \1..\9 form), named captures
($+{name}, ${name}) and the \n \r \t escapes. Every other character is
copied through literally, so \@{...}/${...} interpolation blocks end up as
text rather than being run. This is used to replace the s///ee double-eval.

The routine is fully qualified at the call sites rather than exported, and
case folding is left out to keep it small.

Signed-off-by: Sanjar Tulkinov Anvar o'g'li <sanjarbiy11@gmail.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
2026-07-30 12:15:00 +00:00
Jonathan Druart 1a552017ac
Bug 42866: Prevent SQL injection in Koha::AddtionalContents->search_for_display
Signed-off-by: Sanjar Tulkinov Anvar o'g'li <sanjarbiy11@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit c5968932fc)
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
2026-07-30 10:27:37 +00:00
Jonathan Druart 46eb21993c
Bug 42749: Prevent SQL injection from GetInvoices (order_by)
Signed-off-by: Sanjar Tulkinov Anvar o'g'li <sanjarbiy11@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
(cherry picked from commit cb22264499)
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
2026-07-30 10:11:25 +00:00
Martin Renvoize 305ccb6482
Bug 41510: (RM follow-up) Perltidy a missed file at merge time
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
(cherry picked from commit 7fd796d8f8)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
(cherry picked from commit fd9be777fb)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2026-07-22 11:17:25 +02:00
Paul Derscheid d524290897
Bug 41510: Add test for effective_bookable with missing itemtype
- Add test case for the scenario where an item has no itemtype
  because both items.itype and biblioitems.itemtype are NULL
- Note: We must set biblioitems.itemtype to NULL before creating the
  item because Koha::Item->store() automatically populates itype from
  biblioitems.itemtype when itype is not set

Test plan:
- Apply this patch only
- Run: prove t/db_dependent/Koha/Item.t :: effective_bookable
- Verify test 6 FAILS with "Can't call method 'bookable' on an
  undefined value"
- Apply the follow-up patch
- Run the test again
- Verify all tests PASS

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
(cherry picked from commit 26ffc16c38)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
(cherry picked from commit 00457f7e73)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2026-07-22 11:17:23 +02:00
Hammat Wele f970d0b7f3
Bug 41690: (follow-up) Add test
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 a0b92c0bb6)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
(cherry picked from commit 9b394ddb7a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2026-07-17 14:12:38 +02:00
Eric Phetteplace 379794d548
Bug 42723: Purchase suggestion 500 when EmailPurchaseSuggestions is set to BranchEmailAddress
Testing plan:
- Set EmailPurchaseSuggestions to BranchEmailAddress
- Go to create suggestion on the staff side /suggestion/suggestion.pl?op=add_form
- Create a suggestion with Library: Any
- 500 error: inbound_email_address is not a method of undef
- Apply patch & repeat
- Suggestion created

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 33a8dc5d6f)
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
(cherry picked from commit f699bb4c50)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2026-07-08 07:39:33 +02:00
Jonathan Druart bfe9cfa6f4
Bug 42360: [24.11] Move separator validation to C4::Context::csv_delimiter
So we protect other calls

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2026-06-18 15:50:38 +02:00
Martin Renvoize c58d465cfc
Bug 29923: Prevent overpayment credit when written-off accruing fine is adjusted on check-in
When a staff member writes off an accruing fine and the item is
subsequently checked in (backdated or in fine-free mode), the fine
amount is recalculated downward via adjust(). The previous code
unconditionally created an OVERPAYMENT credit whenever the adjusted
outstanding went negative, regardless of whether the existing credits
were reversible payments or non-reversible writeoffs/discounts.

This caused patrons to receive an erroneous credit equal to the
written-off amount, since writeoffs should simply be absorbed when
the underlying fine shrinks - no refund is due.

The fix calculates the total non-reversible credits (writeoffs,
discounts, cancellations) applied to the debit using the existing
filter_by_non_reversible method, and only generates an OVERPAYMENT
credit for the portion attributable to reversible cash payments that
exceed the recalculated fine amount.

Test plan:
1. Write off an accruing fine in full
2. Check the item in (backdated or fine-free)
3. Confirm no overpayment credit is generated for the patron

Signed-off-by: Benjamin Daeuber <BDaeuber@fargolibrary.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
(cherry picked from commit 44483cab32)
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
2026-05-27 15:03:29 +00:00
Kyle M Hall 41ca027f44
Bug 41818: Add unit tests
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
(cherry picked from commit 3df6e51d72)
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
2026-05-27 12:54:33 +00:00
Paul Derscheid 7d8d1da5a0
Bug 41886: Filter checkouts to bookable items in check_booking
- Biblio::check_booking counts current checkouts toward the
  unavailable pool to detect booking clashes
- It counts checkouts on ALL items for the biblio, including
  non-bookable ones (e.g. items with an excluded item type)
- When only a subset of items are bookable, checkouts on
  non-bookable siblings incorrectly reduce the available pool,
  producing false clashes
- Restrict the checkout query to only count items whose
  itemnumber is in the bookable items set

To test:
1. Have a biblio with at least two items, where one item is
   bookable and the other is not (bookable = 0).
2. Check out the non-bookable item to a patron.
3. Attempt to create a booking for the bookable item.
4. Without the patch: a clash is detected even though the
   bookable item is available.
5. Apply the patch.
6. Repeat steps 2-3.
7. Verify the booking succeeds without a false clash.
8. Run: prove t/db_dependent/Koha/Biblio.t
   and confirm the new subtest
   "checkouts on non-bookable items do not cause false clashes"
   passes.

Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
(cherry picked from commit e4be46c2c5)
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
2026-05-27 12:32:54 +00:00
Martin Renvoize c620f8f134
Bug 42098: (follow-up) Enable plugin in ImportBatch.t test
The Handler::run change to skip disabled plugins broke the
RecordsFromMarcPlugin subtest in ImportBatch.t. The MarcFieldValues
plugin was installed but never enabled, so Handler::run returned
early. Add $plugin->enable() before calling RecordsFromMarcPlugin.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
(cherry picked from commit 645ace7353)
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
2026-05-27 12:07:10 +00:00
Kyle M Hall 12519e7acd
Bug 42098: EDIFACT edi_cron.pl runs disabled plugins due to bug in Koha::Plugins::Handler::run
It appears that edi_cron.pl will run disabled EDI plugins. It uses Koha::Plugins::Handler::run that does not check if the plugins is gets are disabled.

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

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

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
(cherry picked from commit 435cf5cba1)
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
2026-05-27 12:07:00 +00:00
Fridolin Somers d8dcedc7ea
Bug 42136: (RMaint follow-up) Fix number of tests 2026-04-27 09:24:16 +02:00
Fridolin Somers 13fe0cbf0e
Merge branch '24.11.x-security' into 24.11.x 2026-04-27 09:23:57 +02:00
Jacob O'Mara f3d67d9d9c
RMaint: amend bug_34000 tests as we haven't backported bug_39014
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-22 20:18:27 +01:00
Martin Renvoize 4c69cbe88c
Bug 34000: Unit tests
Adds a new subtest to t/db_dependent/Koha/Patron.t covering
fixup_cardnumber and the autoMemberNumValue counter:

- Normal increment bumps the counter
- Renaming a patron's cardnumber does not free it for reuse
- Deleting a patron does not free their cardnumber for reuse
- Counter wins when ahead of db_max
- db_max wins when ahead of counter
- Legacy fallback when the syspref row is absent

Also adds autoMemberNumValue to the exceptions list in
t/db_dependent/check_sysprefs.t. The preference is managed internally
by Koha::Patron::fixup_cardnumber -- it is not user-configurable and
has no entry in the admin preference YAML files.

Test plan:
1. prove t/db_dependent/Koha/Patron.t
2. prove t/db_dependent/check_sysprefs.t
3. prove t/db_dependent/Koha/Plugins/Barcode_transform_hooks.t
   (confirm the patron_barcode_transform hook is still called twice
   during store when autoMemberNum is enabled).

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-22 20:18:27 +01:00
Jonathan Druart 63097f365a
Bug 42136: Add tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-22 20:18:26 +01:00
Martin Renvoize 0af06dc5f3
Bug 41368: Fix ManageMarcImport Cypress test timing issue
Replace the no-op `#job_callback` existence check with a recursive
`cy.wait('@jobPoll')` that loops through each `/api/v1/jobs/*` poll
response (arriving every ~1s) until it sees `status: finished`. This
avoids any fixed timeout — the test proceeds as soon as the API signals
completion, however long that takes on a given machine.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit c513dee502)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-22 20:18:26 +01:00
Lucas Gass fb1fcea011
Bug 41368: Fix View batch click
To test:
1. APPLY PATCH
2. yarn build
3. cypress run --spec t/cypress/integration/Tools/ManageMarcImport_spec.ts
4. It should now pass

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit b190813020)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-22 20:18:26 +01:00
Jonathan Druart e1c88f74ca
Bug 42090: Fix KohaTable/Holdings_spec.ts
I think there has been a mix in the different fixes, and 24.11 diverged
from main

My suggestion here is to use a different column as "Status" is a
specific one

Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
2026-04-20 13:36:03 +00:00
Jonathan Druart 4dae95ad7d
Bug 42090: Fix ERM/Dialog_spec.ts
I am not sure why we need that, but it fixes the test!

Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
2026-04-20 13:35:13 +00:00
Marcel de Rooy d096afc25e
Bug 41449: Reserves.t - fix description and assumption for onshelfholds
Test plan:
prove t/db_dependent/Reserves.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
(cherry picked from commit 2d9c05c4c0)
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
2026-04-17 13:33:31 +00:00
Baptiste 782a5a7ca5
Bug 40960: Fix unit tests
Two unit tests have been moved/replaced to fit the desired behaviour

- "patron notified when item set to waiting" -> does not fit the desired behaviour.
  The desired behaviour for mails/sms is already tested
  The desired behaviour for prints is changed to "patron not notified if
  no messaging preference is specified"
- "patron not notified a second time (bug 11445)" -> Moved into
  _koha_notify_reserve tests

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
(cherry picked from commit 24b7f4eacb)
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
2026-04-17 13:33:28 +00:00
Pedro Amorim 646beb5801
Bug 41237: (QA follow-up): Utilize available logged in user object
Instead of re-fetching the patron object.

This also adjusts tests:
prove t/db_dependent/Koha/ILL/Requests.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
(cherry picked from commit a19a6cf1ef)
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
2026-03-06 15:00:24 +00:00
Pedro Amorim e0206a0d9e
Bug 41237: Add tests
Test plan, k-t-d:
1) Apply tests patch, run:
prove t/db_dependent/Koha/ILL/Requests.t
2) Notice it fails. Apply the second patch. Repeat. Notice it passes.

Test failure explanation (before fix patch):
    #   Failed test 'Cardnumber not supplied and couldnt find additional_contents for all libraries. Dont show copyrightclearance'
    #   at t/db_dependent/Koha/ILL/Requests.t line 1067.
    #          got: 'copyrightclearance'
    #     expected: 'commit'

Its searching the copyrightclearance additional_contents for the provided branchcode param (illrq->patron->branchcode) (and finding one) when it shouldn't. That parameter is only to be utilized for the newly created ILL request's library. The branchcode filter of the additional_contents must the be logged in user's cardnumber, not params->{branchcode}. If no logged in user exists and this stage is reached (ILLOpacUnauthenticatedRequest), then only 'All libraries' ILLModuleCopyrightClearance are to be fetched, as expected.

Human test plan, before applying patches:
1) Enable ILLModule
2) Logged in as koha:koha, create an OPAC request, visit:
<opac_url>/cgi-bin/koha/opac-illrequests.pl?op=add_form&backend=Standard
3) Pick any library not Centerville (the default library of the 'koha' user)
4) Notice the created request's library is CPL (Centerville). It ignored the library selection from the form.
5) Apply patches. Repeat. Notice the request's library is now the one that was selected on the form.

Signed-off-by: Stephen Graham <s.graham4@herts.ac.uk>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
(cherry picked from commit d6ce5833b7)
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
2026-03-06 15:00:23 +00:00
Pedro Amorim 10a00918f7
Bug 41001: (QA follow-up): Add 'Confirmation messages with inputs' specific tests
cypress run --spec t/cypress/integration/ERM/Dialog_spec.ts

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
(cherry picked from commit e813eeeaff)
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
2026-02-20 14:04:50 +00:00
Pedro Amorim d7381e4851
Bug 41001: Add cypress test
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
(cherry picked from commit ff87a2a6a5)
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
2026-02-20 14:04:48 +00:00
Martin Renvoize 9440c4adfe
Bug 40219: Add unit test to verify welcome email is not sent on validation failure
This test ensures that when extended attribute validation fails during
patron creation via the API, no welcome email is sent. This validates
the fix where extended_attributes() validation was moved before the
welcome email is enqueued.

Test plan:
1. Apply this patch
2. Run: prove t/db_dependent/api/v1/patrons.t
3. Verify all tests pass, including the new test that confirms no welcome
   email is sent when extended attribute validation fails

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
(cherry picked from commit 4d2f80925d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2026-02-18 14:54:56 +01:00
Victor Grousset/tuxayo a1bd3e632c
Bug 38770: Remove @vue/cli-service and babel
And the webpack related dead config.

Test plan:
1. Do not apply
2. Switch to node 22
     sudo sed 's/18.x/22.x/g' -i /etc/apt/sources.list.d/nodesource.list
     sudo apt update ; sudo apt install nodejs
3. Try to install node deps
     sudo yarn install --modules-folder /kohadevbox/node_modules
4. It fails
     error @achrinza/node-ipc@9.2.5: The engine "node" is incompatible with this module.
     Expected version "8 || 9 || 10 || 11 || 12 || 13 || 14 || 15 || 16 || 17 || 18". Got "22.12.0"
5. Apply patches
6. Try to install node deps
     sudo yarn install --modules-folder /kohadevbox/node_modules
7. It works! :)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2026-01-20 14:57:40 +01:00
David Cook 822dee608e
Bug 34164: Redirect to referring URL when doing OIDC/OAuth SSO
This patch makes it so that a successful SSO will return you to
the place where you initiated the SSO. This is especially useful
when doing searches, placing holds, etc.

Test plan:
0. Apply patch and koha-plack --restart kohadev
1. Set up OIDC SSO using
https://wiki.koha-community.org/wiki/Testing_SSO
2. Go to http://localhost:8081/cgi-bin/koha/circ/circulation-home.pl
3. Do a staff login using SSO
4. Note that you're redirected to
http://localhost:8081/cgi-bin/koha/circ/circulation-home.pl
after the successful login

5. Go to http://localhost:8080/cgi-bin/koha/opac-search.pl?idx=&q=test&weight_search=1
6. Do a OPAC SSO login
7. Note that you're returned to
http://localhost:8080/cgi-bin/koha/opac-search.pl?idx=&q=test&weight_search=1
after the successful login

8. Logout of the staff admin and OPAC
9. Note your URL ends in ?logout.x=1
10. Try logging back into them using SSO
11a. Note that you're logged in and not automatically logged out
11b. Note that if you're on the OPAC, you should be redirected
to opac-user.pl instead of opac-main.pl or the root path

12. If you change the domain for the SSO users to something
that your user does not match, try logging in again, and note
that the error message should display on mainpage.pl or opac-main.pl/opac-user.pl
for the OPAC. (This is because these are the pages that show SSO errors.)

Signed-off-by: Lukas Koszyk <lukasz.koszyk@kit.edu>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
(cherry picked from commit dbadb00d7b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2026-01-09 09:42:39 +01:00
Lucas Gass b0e5551603
Bug 40527: Add SECURITY.md to ignored list in MakeFile.t
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
(cherry picked from commit ea3fb6af6d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2026-01-09 09:41:06 +01:00
Aleisha Amohia 3f9187478e
Bug 39985: Set items.onloan when recall adjusts checkout due date
This enhancement ensures the due date stored in items.onloan is changed when a recall causes a checkout due date to change.

To test:

1. Enable UseRecalls syspref and set corresponding circulation rules:
    - Recalls allowed
    - Recalls per record
    - On shelf recalls allowed - set to "If any unavailable"
    - Recall due date interval - set to 1
    - Recall pickup period
2. Check out an item to a patron (Patron A)
  2a. Make sure this patron has a primary email address set
  2b. Check the patron's messaging preferences - make sure this patron has the 'Email' checkbox checked for the 'Return recalled item' notice
3. Go to Tools -> Notices & slips and find the RETURN_RECALLED_ITEM notice. In the Email notice, change "[% checkout.date_due | $KohaDates %]" to "[% item.onloan | $KohaDates %]" and Save.
4. Log into the OPAC as another patron
5. Search for the item checked out in step 2, and place a recall on that item
6. Search for that item in the staff interface
=> Note that the item status says, "Checked out to <patron>: due <tomorrow>"
7. Create the following SQL report in the reports module, using the barcode of the item that was recalled:
SELECT onloan FROM items WHERE barcode='xxxxxxxxx'
8. Run the report
=> The onloan value is still set to the item's original due date, not the updated due date of tomorrow
9. Go to Patron A's account again and view their Notices tab. Click on the 'Notification to return a recalled item'
=> The original due date is used in the notice.
10. Apply the patch and restart services
11. Reset to run the tests again:
    - Check in the item, but do not confirm the recall in the pop-up
    - Go to the biblio detail page and cancel the recall
12. Repeat steps 2 to 5.
13. Run your report again (step 8)
=> The onloan value should now show the updated due date of tomorrow
14. View Patron A's latest 'Notification to return a recalled item' notice (step 9)
=> The updated due date should be used in the notice.
15. Confirm tests pass
    - t/db_dependent/Koha/Recalls.t

Sponsored-by: Auckland University of Technology
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 95f2639d64)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
(cherry picked from commit 7c8dbf75ec)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2025-12-04 15:15:09 +01:00
Jonathan Druart 0a92eb8542
Bug 41298: Fix filtering items by in transit
The filtering condition was not correct, the presence of a line in
the transfer table is not enough to now if the item is in transit.
Here we filter reusing the same conditions as
Koha::Item::Transfer->in_transit

Test plan:
Have at least 2 items for a given bibliographic record
Transfer item 1
Transfer item 2
Receive/Fullfill the transfer for item 1

Item 1 is now available and item 2 is in transit

Go to items record and filter holdings table with status "In transit"
=> Only item 2 is displayed

Filter holdings table with status "Available"
=> Only item 1 is displayed

Signed-off-by: Anneli Österman <anneli.osterman@koha-suomi.fi>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 0485296221)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
(cherry picked from commit 01d8c0f1ed)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2025-12-04 15:08:47 +01:00
Tomás Cohen Arazi b3a050fb20
Bug 41032: Fix Open Fifth missing in plugin repos config
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
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 cee02bbf3b)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
(cherry picked from commit 420fb7148a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2025-12-04 14:35:24 +01:00
Marcel de Rooy 56cd6fd0f0
Bug 41094: Improve test of search_anonymize_candidates/account_locked
Test plan:
Run the test without applying the follow-up patch.
The test should fail. This shows that we need the fix and will help
avoid future regressions.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
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 f4ff248b5c)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
(cherry picked from commit 9a2e2c3101)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2025-12-04 11:37:46 +01:00
John Doe 2b724766f8
Bug 41039: Add cypress tests
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 3f59557d2a)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
(cherry picked from commit d572b6f422)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2025-12-04 11:07:09 +01:00
Jonathan Druart c7d51c9423
Bug 38475: Skip some tests in InfiniteScrollSelect_spec
They are failing randomly for too long.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit ef51ce1bd4)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
(cherry picked from commit 6733943bd3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2025-12-04 10:53:09 +01:00
Brendan Lawlor 4376e369b2
Bug 35830: Add merge_borrowers subpermission
Merging patrons only required edit_borrowers permission
but would result in a patron deletion.

This patch requires a new merge_borrowers subpermission

To test:
1. Give a patron the following permissions
    catalogue, edit_borrowers, list_borrowers
2. Log into the staff interface as the patron
3. Do a patron search and select 2 patrons
4. Click merge patron - success - a patron got deleted
5. Apply patch, updatedatabase and restart_all
6. Repeat steps 3 and 4 - you can't
7. Add the new permission for merge_borrowers
8. Repeat steps 3 and 4 - now you can
9. prove t/Koha/Auth/Patrons.t

Sponsored-by: CLAMS
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 5ce9d5af4e)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
(cherry picked from commit 576b80bb1d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2025-12-04 10:34:54 +01:00
Lari Taskula 99a51b428d
Bug 41044: Add a failing test
To test:
1. prove t/db_dependent/Koha/Item.t
2. Observe failing test

Subtest: test empty string warning
        1..1
        not ok 1 - No warnings were produced
           Failed test 'No warnings were produced'
           at t/db_dependent/Koha/Item.t line 3656.
         found warning: Argument "" isn't numeric in addition (+) at /usr/local/lib/x86_64-linux-gnu/perl/5.34.0/DateTime/Duration.pm line 70.
         didn't expect to find a warning
         Looks like you failed 1 test of 1.
    not ok 9 - test empty string warning
       Failed test 'test empty string warning'
       at t/db_dependent/Koha/Item.t line 3657.
     Looks like you failed 1 test of 9.
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 120ef099fc)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
(cherry picked from commit 17b379984b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2025-12-02 11:27:49 +01:00
Marcel de Rooy 0df2d94dfa
Bug 41024: Unify spelling of BorrowersLog, keep plural form
The singular form is wrong and only exists in textual context.
This is a result of git grep | xargs sed.

Test plan:
Read the patch.
git grep BorrowerLog

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Aleisha Amohia <aleisha@catalyst.net.nz>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 4a267d0e9b)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
(cherry picked from commit f59d8c46e3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2025-12-02 10:28:33 +01:00
Jonathan Druart bc7df6e6f1
Bug 40845: Remove hardcoded Koha version from t/Koha/Manual.t
Test plan:
Update the version in DB:
> update systempreferences set value="25.1100000" where variable="version";
restart_all
prove t/Koha/Manual.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Aleisha Amohia <aleisha@catalyst.net.nz>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 8358957f57)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
(cherry picked from commit f298d75280)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2025-12-02 10:20:07 +01:00
Jonathan Druart f711c48bcd
Bug 39712: Add tests
Signed-off-by: Aude Charillon <aude.charillon@openfifth.co.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 5beaaf171d)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
(cherry picked from commit fc8e8ad055)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2025-12-02 10:20:01 +01:00
Lucas Gass 7650698667
Bug 40969: Mock the RenewalPeriodBase preference correctly
Signed-off-by: Trevor Diamond <trevor.diamond@mainlib.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 412879a418)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
(cherry picked from commit fb29ac4205)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2025-11-10 16:21:25 +01:00
Jonathan Druart 5f2b48dc54
Bug 40907: Add a Cypress test
Signed-off-by: Mathieu <mathsabypro@gmail.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 7c4c013645)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
(cherry picked from commit 000ba6efdd)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2025-11-10 16:18:06 +01:00
Martin Renvoize d191e33740
Bug 39408: (QA follow-up) Add unit tests
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit ef5ba9a42d)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
(cherry picked from commit 754820b8ef)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2025-11-10 15:23:54 +01:00