From 08328a5d3a0300dd2c103dc610ac2b305af38a38 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Fri, 14 Jun 2024 14:46:09 +0000 Subject: [PATCH] Bug 28924: (QA follow-up): Don't define charge values as 0 Sponsored-by: Cuyahoga County Public Library Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer --- C4/Circulation.pm | 2 -- Koha/Patron.pm | 14 ++++++-------- circ/circulation.pl | 2 -- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index cddd35fd79..44f48b2e11 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -870,7 +870,6 @@ sub CanBookBeIssued { # Check the debt of this patrons guarantees my $no_issues_charge_guarantees = $patron_borrowing_status->{NoIssuesChargeGuarantees}->{limit}; - $no_issues_charge_guarantees = undef unless looks_like_number($no_issues_charge_guarantees); if ( defined $no_issues_charge_guarantees ) { if ( $patron_borrowing_status->{NoIssuesChargeGuarantees}->{overlimit} && !$inprocess && !$allowfineoverride ) { $issuingimpossible{DEBT_GUARANTEES} = $patron_borrowing_status->{NoIssuesChargeGuarantees}->{charge}; @@ -889,7 +888,6 @@ sub CanBookBeIssued { # Check the debt of this patrons guarantors *and* the guarantees of those guarantors my $no_issues_charge_guarantors = $patron_borrowing_status->{NoIssuesChargeGuarantorsWithGuarantees}->{limit}; - $no_issues_charge_guarantors = undef unless looks_like_number($no_issues_charge_guarantors); if ( defined $no_issues_charge_guarantors ) { if ( $patron_borrowing_status->{NoIssuesChargeGuarantorsWithGuarantees}->{overlimit} && !$inprocess diff --git a/Koha/Patron.pm b/Koha/Patron.pm index bb450d56f1..0dc98dc4c9 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -2916,7 +2916,7 @@ If any blockers are found, these are returned in a hash =cut sub can_borrow { - my ( $self ) = @_; + my ($self) = @_; my $status = { can_borrow => 1 }; @@ -2948,17 +2948,15 @@ sub is_patron_inside_charge_limits { my ( $self, $args ) = @_; my $borrowernumber = $args->{borrowernumber}; - my $patron = $args->{patron} || Koha::Patrons->find( { borrowernumber => $borrowernumber } ); + my $patron = $self || Koha::Patrons->find( { borrowernumber => $borrowernumber } ); my $patron_category = $patron->category; my $patron_charge_limits = {}; - my $no_issues_charge = $patron_category->noissuescharge || C4::Context->preference('noissuescharge') || 0; + my $no_issues_charge = $patron_category->noissuescharge || C4::Context->preference('noissuescharge'); my $no_issues_charge_guarantees = - $patron_category->noissueschargeguarantees || C4::Context->preference('NoIssuesChargeGuarantees') || 0; - my $no_issues_charge_guarantors_with_guarantees = - $patron_category->noissueschargeguarantorswithguarantees - || C4::Context->preference('NoIssuesChargeGuarantorsWithGuarantees') - || 0; + $patron_category->noissueschargeguarantees || C4::Context->preference('NoIssuesChargeGuarantees'); + my $no_issues_charge_guarantors_with_guarantees = $patron_category->noissueschargeguarantorswithguarantees + || C4::Context->preference('NoIssuesChargeGuarantorsWithGuarantees'); my $non_issues_charges = $patron->account->non_issues_charges; my $guarantees_non_issues_charges = 0; diff --git a/circ/circulation.pl b/circ/circulation.pl index 74d21beaca..acabfa4d1d 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -614,7 +614,6 @@ if ( $patron ) { if ($no_issues_charge_guarantors) { if ( $patron_charge_limits->{NoIssuesChargeGuarantorsWithGuarantees}->{overlimit} ) { $template->param( - noissues => 1, charges_guarantors_guarantees => $patron_charge_limits->{NoIssuesChargeGuarantorsWithGuarantees}->{charge} ); $noissues = 1 unless C4::Context->preference("allowfineoverride"); @@ -622,7 +621,6 @@ if ( $patron ) { } my $no_issues_charge_guarantees = $patron_charge_limits->{NoIssuesChargeGuarantees}->{limit}; - $no_issues_charge_guarantees = undef unless looks_like_number( $no_issues_charge_guarantees ); if ( defined $no_issues_charge_guarantees ) { if ( $patron_charge_limits->{NoIssuesChargeGuarantees}->{overlimit} ) { $template->param( -- 2.39.5