Bug 14930 [QA Followup] - Allow OpacFineNoRenewals to be 0

Works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
(cherry picked from commit 655e35649c)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
This commit is contained in:
Kyle M Hall 2016-01-28 23:09:43 +00:00 committed by Julian Maurice
parent f02054cfcd
commit 46d7a7d2c6
1 changed files with 8 additions and 3 deletions

View File

@ -39,6 +39,7 @@ use Koha::Borrower::Debarments qw(IsDebarred);
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
use Scalar::Util qw(looks_like_number);
use Date::Calc qw(
Today
Add_Delta_Days
@ -105,14 +106,18 @@ if ( 5 >= $borr->{'amountoutstanding'} && $borr->{'amountoutstanding'} > 0 ) {
$borr->{'amountoverzero'} = 1;
}
my $no_renewal_amt = C4::Context->preference( 'OPACFineNoRenewals' );
$no_renewal_amt ||= undef;
$no_renewal_amt = undef unless looks_like_number( $no_renewal_amt );
if ( C4::Context->preference( 'OpacRenewalAllowed' ) && $no_renewal_amt && $borr->{amountoutstanding} > $no_renewal_amt ) {
if ( C4::Context->preference('OpacRenewalAllowed')
&& defined($no_renewal_amt)
&& $borr->{amountoutstanding} > $no_renewal_amt )
{
$borr->{'flagged'} = 1;
$canrenew = 0;
$template->param(
renewal_blocked_fines => sprintf( '%.02f', $no_renewal_amt ),
renewal_blocked_fines_amountoutstanding => sprintf( '%.02f', $borr->{amountoutstanding} ),
renewal_blocked_fines_amountoutstanding =>
sprintf( '%.02f', $borr->{amountoutstanding} ),
);
}