Bugzilla – Attachment 190387 Details for
Bug 41386
Adding 0.00 as value for "Expired hold charge" in circulation rules can lead to exception Koha::Exceptions::Account::AmountNotPositive
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41386: Do not allow 0.00 values to be passed from Koha::Hold->cancel
0001-Bug-41386-Do-not-allow-0.00-values-to-be-passed-from.patch (text/plain), 2.17 KB, created by
Emmi Takkinen
on 2025-12-10 07:39:05 UTC
(
hide
)
Description:
Bug 41386: Do not allow 0.00 values to be passed from Koha::Hold->cancel
Filename:
MIME Type:
Creator:
Emmi Takkinen
Created:
2025-12-10 07:39:05 UTC
Size:
2.17 KB
patch
obsolete
>From edc57a8e13ddd9f508d08f20f9b09c2e0f59a2f5 Mon Sep 17 00:00:00 2001 >From: Emmi Takkinen <emmi.takkinen@koha-suomi.fi> >Date: Tue, 9 Dec 2025 14:56:09 +0200 >Subject: [PATCH] Bug 41386: Do not allow 0.00 values to be passed from > Koha::Hold->cancel > >In method Koha::Hold->cancel in the section where we charge a cancel >fee there is a if statement "if $charge" after calling sub add_debit. >This allows value "0.00" to be passed to the add_debit and it then >gets caught in statement "unless ( $amount > 0 )" which calls exception >AmountNotPositive. This happens at least when syspref >ExpireReservesMaxPickUpDelayCharge or circulation rule "Expired hold charge" >has value 0.00 and cronscript cancel_expired_holds.pl is run. This patch >fixes the if statement in Koha::Hold->cancel. > >To test: >1. Enable syspref ExpireReservesMaxPickUpDelay. >2. Set syspref ReservesMaxPickUpDelay value as 1. >3. Set syspref ExpireReservesMaxPickUpDelayCharge value as 0.00. >4. Make sure you have a waiting hold which has expiration date further >in the past than ReservesMaxPickUpDelay value in your database. If not, >create one. >5. Run cronscript cancel_expired_holds.pl. >=> Exception 'Koha::Exceptions::Account::AmountNotPositive' thrown >'Debit amount passed is not positive' is raised. >6. Set syspref ExpireReservesMaxPickUpDelayCharge value as 0 and run >cronscript again. >=> No exception is raised. >7. Apply this patch and restart services if needed. >8. Create a new waiting hold with expiration date in the past. >9. Run cronscript again. >=> No exception is raised. >=> Confirm that no cancel fee was added for patron. > >Also prove t/db_dependent/Koha/Holds.t. > >Sponsored-by: Koha-Suomi Oy >--- > Koha/Hold.pm | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/Koha/Hold.pm b/Koha/Hold.pm >index 66a236a853..e8f3326ade 100644 >--- a/Koha/Hold.pm >+++ b/Koha/Hold.pm >@@ -940,7 +940,7 @@ sub cancel { > type => 'RESERVE_EXPIRED', > item_id => $self->itemnumber > } >- ) if $charge; >+ ) if $charge > 0; > } > > C4::Log::logaction( 'HOLDS', 'CANCEL', $self->reserve_id, $self, undef, $original ) >-- >2.34.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 41386
: 190387