Commit Graph

371 Commits

Author SHA1 Message Date
Tomás Cohen Arazi 4d23dff433
Bug 42310: (follow-up) Adapt Calendar tests to new schema
Replace all references to the dropped tables (RepeatableHoliday,
SpecialHoliday resultsets and raw DBI inserts) with Koha::Object
classes: Koha::Calendar::WeeklyClosure, RepeatingClosure,
SingleClosure, and Exception.

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: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-09-15 16:13:52 +00:00
Aleisha Amohia b9b80b9471
Bug 31391: Implement UseRecalls choices in tests
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-09-14 14:15:51 +00:00
Martin Renvoize 4eb521ba18
Bug 10190: Migrate MarkIssueReturned test to circulation rules
Sponsored-by: Glasgow Colleges Library Group <https://library.cityofglasgowcollege.ac.uk>
Signed-off-by: George Harkins <George.Harkins@cityofglasgowcollege.ac.uk>
Signed-off-by: Michaela <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-09-10 14:24:28 +00:00
Tomás Cohen Arazi 86d54c2c4a
Bug 42391: (follow-up) Add missing warning assertions for Object::store
The previous follow-up restored warn in Object::store but missed
several test files that trigger DB exceptions via ->store(). These
tests now fail Test::NoWarnings because the warning is emitted but
not expected.

This patch adds warning_like wrappers to 15 additional test files,
asserting that the expected DB exception warning is emitted.

Test plan:
1. Apply patch
2. Run:
   $ ktd --shell
   k$ prove t/db_dependent/api/v1/biblios.t \
       t/db_dependent/Koha/Holds.t \
       t/db_dependent/api/v1/return_claims.t \
       t/db_dependent/api/v1/libraries.t \
       t/db_dependent/Koha/Booking.t \
       t/db_dependent/api/v1/patrons.t \
       t/db_dependent/SIP/Message.t \
       t/db_dependent/Koha/Patron.t \
       t/db_dependent/Koha/Acquisition/Fund.t \
       t/db_dependent/api/v1/acquisitions_orders.t \
       t/db_dependent/Koha/ILL/Requests.t \
       t/db_dependent/Koha/Patron/Relationship.t \
       t/db_dependent/Koha/Hold.t \
       t/db_dependent/Circulation/Returns.t \
       t/db_dependent/api/v1/bookings.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-07-27 12:12:29 +00:00
Tomás Cohen Arazi 4189d42ee6
Bug 42391: (follow-up) Restore DB exception warnings in Object::store
Bug 42391 removed the warn from Koha::Object::store when it moved
exception translation to the exception_action hook. This lost useful
debugging information from the Plack error logs.

This patch restores the warning by adding a try/catch in store() that
stringifies and warns the exception before rethrowing. The warning now
contains the translated Koha exception message (e.g. 'Broken FK
constraint') rather than the raw DBI error, since translation happens
before the exception reaches store().

Note: delete() does not warn. Ideally the logging would live in the
ExceptionMapper itself (via an injected logger), covering all code paths
uniformly. That is a larger refactor tracked separately.

Tests that assert on these warnings are updated to match the new
message format.

Test plan:
1. Apply patch
2. Run:
   $ ktd --shell
   k$ prove t/db_dependent/Koha/Object.t \
       t/db_dependent/Koha/Objects.t \
       t/db_dependent/Koha/Schema/ExceptionMapper.t \
       t/db_dependent/Koha/Item.t \
       t/db_dependent/Koha/Suggestions.t \
       t/db_dependent/Koha/Account.t \
       t/db_dependent/Koha/ApiKey.t \
       t/db_dependent/Koha/Checkouts/ReturnClaim.t \
       t/db_dependent/Circulation/MarkIssueReturned.t \
       t/db_dependent/Suggestions.t \
       t/db_dependent/Biblio.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-07-21 15:40:23 +00:00
Kyle M Hall 54fc07f408
Bug 42391: (QA follow-up): Fix unit tests
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-07-20 12:44:58 +00:00
Martin Renvoize 04809de849
Bug 42764: Fix spelling errors across the codebase
Correct genuine spelling errors identified by the codespell 2.4.x
full scan after the KTD container OS upgrade. Changes are in
comments, POD, strings, and template text across 55 files.

"SAN Ouest Provence" (the French library co-operative and Koha
sponsor) is preserved as a proper noun. Perl copyright lines
receive an inline # codespell:ignore annotation; about.tt files
(contributor attribution pages) are added to the Koha::Devel::Files
codespell exception list so that future uses of "Provence" as a
typo for "Province" are still caught in all other files.

Notable user-visible fixes:
- "submiting" -> "submitting" in authority and bibliographic merge screens
- "deleteable" -> "deletable" in patron exception messages
- "Acquistions" -> "Acquisitions" in reports dictionary

Test plan:
1. Apply patches
2. In the staff interface, go to Cataloguing > Merge records and
   confirm the submit button reads "Submitting" (not "Submiting")
3. In the staff interface, go to Authorities > Merge and confirm
   the same correction
4. Attempt to delete a patron with outstanding issues and confirm
   the error message reads "deletable" (not "deleteable")
5. prove xt/author/codespell.t
=> All tests pass

Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-06-03 16:09:04 +00:00
Martin Renvoize 14de13d3ad
Bug 37966: (follow-up) Make empty string handling more explicit in Circulation.pm
This commit improves upon the original fix by making the intent more
explicit when handling empty string date parameters in AddRenewal and
AddIssue functions.

WHY THIS IS BETTER:

The original fix (changing `defined $datedue` to just `$datedue`)
works correctly but relies on Perl's implicit truthy/falsy semantics:

  if ( $datedue && ref $datedue ne 'DateTime' )

This is subtle because:
- Empty string "" is falsy, so parsing is skipped ✓
- But it's not immediately obvious that empty strings are being
  handled specially
- The code doesn't explicitly show its intent

THIS APPROACH:

  if ( defined $datedue && $datedue ne '' && ref $datedue ne 'DateTime' )

Benefits:
1. EXPLICIT: Clearly states "only parse if defined AND not empty
   AND not already a DateTime"
2. SELF-DOCUMENTING: Intent is obvious to future developers
3. NO RELIANCE on truthy/falsy semantics
4. CONSISTENT: Same pattern applied across all date parameter handling

COMPREHENSIVE CHANGES:

1. AddRenewal (C4/Circulation.pm:3449)
   - Made datedue empty string check explicit

2. AddIssue (C4/Circulation.pm:1611)
   - Made datedue empty string check explicit
   - Also updated issuedate handling (line 1616) to explicitly handle
     empty strings

3. Test Coverage (t/db_dependent/Circulation/issue.t)
   - Added test for AddIssue with empty string datedue
   - Added test for AddIssue with empty string issuedate
   - Ensures both functions properly calculate dates from circulation
     rules instead of using "now"

The existing test for AddRenewal already covered empty string datedue
(added in the original Bug 37966 commit). These new tests ensure the
same correct behavior for AddIssue.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-29 09:09:10 -06:00
Michael Hafen 7dbaa5d77c
Bug 37966: Add test coverage for AddRenewal with empty due date
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-29 09:09:10 -06:00
Tomás Cohen Arazi c4c21afa6c
Bug 40136: (follow-up) Fix IsItemIssued.t mock_userenv
mock_userenv was called before the test patron was created and
used the default borrowernumber (51), which doesn't necessarily
exist in the test database. This caused safe_to_delete to crash
on the not_same_branch check when Koha::Patrons->find returned
undef.

Move mock_userenv after patron creation and pass the actual
borrowernumber.

Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
2026-03-25 12:30:38 +01:00
Lucas Gass b2e1993597
Bug 28530: Fix tests
Signed-off-by: Kris Becker <kbecker@jcls.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-10 10:51:38 -07:00
Kyle M Hall 83e6aecd07
Bug 28530: Add unit tests
Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Kris Becker <kbecker@jcls.org>
Signed-off-by: Kris Becker <kbecker@jcls.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-10 10:51:35 -07:00
Martin Renvoize 1c893cc019
Bug 3492: (follow-up) Remove last reservefee references
Sponsored-by: OpenFifth <https://openfifth.co.uk>
Signed-off-by: Jackie Usher <jackie.usher@westsussex.gov.uk>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-09 12:57:57 -07:00
Jonathan Druart 849f67988f
Bug 41076: Adjust our perl tidiness for v20250105
Generated using
  `perl misc/devel/tidy.pl --perl`

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-05 09:03:51 -07:00
Lucas Gass 9d4b4efffd
Bug 26993: (follow-up) Rename last_returned_by_all as last_borrowers
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-22 14:16:04 -07:00
Lucas Gass cf018a0bf4
Bug 26993: (follow-up) Return Koha::Patron resultset from last_returned_by_all
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-22 14:16:03 -07:00
Lucas Gass e25ecf6757
Bug 26993: last_returned_by_all should return an array ref
Signed-off-by: Trevor Diamond <trevor.diamond@mainlib.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-22 14:16:02 -07:00
Lucas Gass c0f1b747c4
Bug 26993: Unit tests
Signed-off-by: Trevor Diamond <trevor.diamond@mainlib.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-22 14:16:01 -07:00
Jonathan Druart d3577b9277
Bug 40680: Fix t tests
Amended patch
@ t/db_dependent/Realtime_holdsqueue.t:26 @ use Test::MockModule;
-use C4::SIP::ILS::Transaction::Checkin qw( do_checkin );
+use C4::SIP::ILS::Transaction::Checkin;

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-12-01 08:34:01 -07:00
Jonathan Druart 41341ecccc
Bug 40680: Fix C4::Calendar imports
Attempt to call undefined import method with arguments (new ...) via package C4::Calendar (Perhaps you forgot to load the package?) at t/db_dependent/Hold.t line 25.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-12-01 08:34:00 -07:00
Martin Renvoize 2bd44c51f0
Bug 40866: (follow-up) Remove obsolete CanBookBeIssued.t test file
This test file was specifically testing the message_log return value
from CanBookBeIssued, which was removed as part of the bug 40866
patchset. The circulation message functionality has been reimplemented
elsewhere with proper test coverage, making this test file redundant.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-10 06:20:09 -06:00
Tomás Cohen Arazi 6b478e0da9
Bug 40163: (follow-up) Fix wrong GNU links and update test
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-24 09:25:04 -06:00
Jonathan Druart 1091533b91
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>
2025-09-19 08:42:44 -06:00
Lucas Gass 1ea765d3bd
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>
2025-09-04 10:27:43 -06:00
Lucas Gass a12b523113
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>
2025-09-04 10:27:42 -06:00
Lucas Gass 942df980da
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>
2025-09-04 10:27:41 -06:00
Martin Renvoize 1660f68690
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>
2025-09-03 11:42:12 -06:00
Martin Renvoize e51399c332
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>
2025-09-03 11:42:08 -06:00
Matthias Le Gac 3a084d020e
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>
2025-09-03 11:42:08 -06:00
Nick Clemens e327039ba1
Bug 40331: (follow-up) Adjust t/db_dependent/Circulation/transfers.t
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-03 11:41:59 -06:00
Lucas Gass eab5aa774c
Bug 40296: Fix failing Returns.t test
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-08-15 09:52:30 -06:00
Martin Renvoize 04ab86f1f7
Bug 32934: Unit tests
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-07-11 15:26:49 -06:00
Jonathan Druart 69b8341a8c
Bug 39325: Manual fixes
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-04-28 18:51:23 +02:00
Jonathan Druart 1d844a7d2f
Bug 39325: Automatic fix
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-04-28 18:51:22 +02:00
Jonathan Druart 3839794d31
Bug 38944: Correctly catch warnings raised by DBI
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-03-13 17:25:05 +01:00
Jonathan Druart 5b69e6df98
Bug 38944: Add Test::NoWarnings to tests no producing warnings
This has been generated.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-03-13 17:25:03 +01:00
Koha Development Team d659526b5a
Bug 38664: Tidy the whole codebase
This commit is generated using:
  % perl misc/devel/tidy.pl
*within* ktd, to get the same version of perltidy than what will be used
by our CI (currently v20230309).

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:24 +01:00
Matt Blenkinsop 16d04b16b7
Bug 33641: (follow-up) Fix unit tests
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-15 14:02:20 +01:00
Nick Clemens b2d02523b2
Bug 33641: (follow-up) Change return_branch to checkin_library
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-14 14:19:41 +01:00
Eric Garcia 51206a1f4a
Bug 33641: Unit Tests
Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-14 14:19:40 +01:00
Matt Blenkinsop 4b37f32c87
Bug 33292: Add unit tests
Test plan:
1) In KTD, set ClaimReturnedLostValue to any value
2) Checkout an item to a patron
3) Add a manual invoice to that patron's account against that item barcode
4) In the patron's checkouts table, click the Claim returned button
5) The checkbox will have the option to "Refund previous lost fee"
6) Tick this box and submit
7) Have a look at the patron's transactions. There will now be a new line refunding the lost fee from step 3
8) Run the unit tests
prove t/db_dependent/Circulation/ReturnClaims.t
prove t/db_dependent/api/v1/return_claims.t

Signed-off-by: Kristi Krueger <kkrueger@cuyahogalibrary.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-10-24 13:38:16 +02:00
Matt Blenkinsop 0dd072437e
Bug 27919: (QA follow-up): Add unit tests
prove t/db_dependent/Circulation/ReturnClaims.t

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-10-22 12:06:52 +02:00
Pedro Amorim 4a4469fd6a
Bug 35539: Remove 'issuelimit' column/field from categories table
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-07-25 11:11:16 +01:00
Pedro Amorim 581903289d
Bug 35539: Remove 'finetype' column/field from categories table
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-07-25 11:11:14 +01:00
Pedro Amorim 6d4b201823
Bug 35539: Remove 'bulk' column/field from categories table
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-07-25 11:11:08 +01:00
Matt Blenkinsop e147f7b60c
Bug 28924: (QA follow-up): Fix unit tests
Sponsored-by: Cuyahoga County Public Library <https://cuyahogalibrary.org/>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-07-18 18:25:57 +02:00
Matt Blenkinsop c76dc7fb08
Bug 28924: Add unit tests for new methods and update existing tests
This commit adds unit tests for the two new methods introduced and also updates all unit tests that use the noissuecharge sysprefs

Test plan:
1. Choose a patron and note their patron category
2. Create a manual invoice on that patron for 6.00
3. Try to check an item out to the patron and it will show a message saying that checkout is blocked because the fine balance is over the limit.
4. This is because the default global value for the ‘noissuescharge’ is 5.00 and we are now over that limit
5. Navigate to Administration > Patron categories and click to edit the category relevant to your patron
6. At the bottom of the form will be fields called No Issues Charge, No Issues Charge Guarantees and No Issues Charge Guarantors With Guarantees. Set those fields to 7
7. Now try and checkout again - this time you will be allowed to checkout as the category level limit is higher than the fine we set.
8. Choose a different patron (patron 2) with a category that is different to the first patron (patron 1).
9. Repeat steps 2 and 3. This time checkout will be blocked again because the limit for this patron category is still the global value of 5.00
10. Choose a third patron with a category of child or similar (patron 3)
11. Make patron 1 a guarantor for patron 3
12. Edit patron 3’s patron category and set the limit for No Issues Charge, No Issues Charge Guarantees and No Issues Charge Guarantors With Guarantees to 5.
13. Try to check out to patron 3 and it will be blocked due to the fines on patron 1’s account
14. Try to checkout to patron 1 - it should still be possible
15. Add a fine to patron 3’s account for 2.00
16. Try to check out to patron 1 - the checkout will be blocked due to the total of 8 now owed by the patron and its guarantees

Test plan:
prove t/db_dependent/SIP/Transaction.t
prove t/db_dependent/SIP/Patron.t
prove t/db_dependent/Circulation/NoIssuesChargeGuarantees.t
prove t/db_dependent/Koha/Patron.t

Sponsored-by: Cuyahoga County Public Library <https://cuyahogalibrary.org/>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-07-18 18:25:54 +02:00
Martin Renvoize fba56f0178
Bug 36687: (RM follow-up) Fix unit tests
Set notforloan to '0' as apposed to 'undef' for tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-05-09 09:22:00 +01:00
Emmi Takkinen f5e9f9634f
Bug 36567: Get rid of Datetime warning in Circulation.t and dateexpiry.t
Running either t/db_dependent/Circulation.t or t/db_dependent/Circulation/dateexpiry.t
cause following error to be dispalyed:

You are creating a DateTime object with a far future year (9999) and a time
zone (Europe/Helsinki). If the time zone you specified has future DST changes
this will be very slow.

Smallest allowed value is 4999, so we need to use that rather than 9999 in tests.

To test prove t/db_dependent/Circulation.t and t/db_dependent/Circulation/dateexpiry.t.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-05-03 16:02:45 +02:00
Nick Clemens b4e36c1bcd
Bug 30324: (follow-up) Remove stray comments
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-04-29 09:35:32 +02:00