Bugzilla – Attachment 190322 Details for
Bug 41404
No need to check related guarantor/guarantee charges when the limits are not set
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41404: Use looks_like_a_number to verify if prefs are set
Bug-41404-Use-lookslikeanumber-to-verify-if-prefs-.patch (text/plain), 1.99 KB, created by
David Nind
on 2025-12-09 00:54:02 UTC
(
hide
)
Description:
Bug 41404: Use looks_like_a_number to verify if prefs are set
Filename:
MIME Type:
Creator:
David Nind
Created:
2025-12-09 00:54:02 UTC
Size:
1.99 KB
patch
obsolete
>From 3d3019674ceb1b74bd3b763f2c3774c4ce0fe065 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 8 Dec 2025 18:34:36 +0000 >Subject: [PATCH] Bug 41404: Use looks_like_a_number to verify if prefs are set > >This check adds a check to ensure we have number, not just defined > >To test: >1 - Apply only unit tests patch >2 - Run the tests > prove -v t/db_dependent/Koha/Patron.t >3 - Apply this patch >4 - Run the tests >5 - They pass! > >Signed-off-by: David Nind <david@davidnind.com> >--- > Koha/Patron.pm | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 03276ff6a5..8da13cecfc 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -22,6 +22,7 @@ use Modern::Perl; > > use List::MoreUtils qw( any none uniq notall zip6); > use JSON qw( to_json ); >+use Scalar::Util qw(looks_like_number); > use Unicode::Normalize qw( NFKD ); > use Try::Tiny; > use DateTime (); >@@ -3519,7 +3520,7 @@ sub is_patron_inside_charge_limits { > my $guarantors_non_issues_charges = 0; > > # Check the debt of this patrons guarantees >- if ( defined $no_issues_charge_guarantees ) { >+ if ( defined $no_issues_charge_guarantees && looks_like_number($no_issues_charge_guarantees) ) { > my @guarantees = map { $_->guarantee } $patron->guarantee_relationships->as_list; > foreach my $g (@guarantees) { > $guarantees_non_issues_charges += $g->account->non_issues_charges; >@@ -3527,7 +3528,9 @@ sub is_patron_inside_charge_limits { > } > > # Check the debt of this patrons guarantors *and* the guarantees of those guarantors >- if ( defined $no_issues_charge_guarantors_with_guarantees ) { >+ if ( defined $no_issues_charge_guarantors_with_guarantees >+ && looks_like_number($no_issues_charge_guarantors_with_guarantees) ) >+ { > $guarantors_non_issues_charges = $patron->relationships_debt( > { include_guarantors => 1, only_this_guarantor => 0, include_this_patron => 1 } ); > } >-- >2.39.5
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 41404
:
190307
|
190313
| 190322