Browse Source

Bug 23293: Apply OPACFineNoRenewalsIncludeCredit preference

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
remotes/origin/19.11.x
Martin Renvoize 5 years ago
parent
commit
d9cd7ff1fd
Signed by: martin.renvoize GPG Key ID: 422B469130441A0F
  1. 5
      C4/Circulation.pm
  2. 8
      opac/opac-user.pl

5
C4/Circulation.pm

@ -2788,7 +2788,10 @@ sub CanBookBeRenewed {
if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) {
my $fine_no_renewals = C4::Context->preference("OPACFineNoRenewals");
my $amountoutstanding = $patron->account->balance;
my $amountoutstanding =
C4::Context->preference("OPACFineNoRenewalsIncludeCredit")
? $patron->account->balance
: $patron->account->outstanding_debits->total_outstanding;
if ( $amountoutstanding and $amountoutstanding > $fine_no_renewals ) {
return ( 0, "auto_too_much_oweing" );
}

8
opac/opac-user.pl

@ -124,16 +124,20 @@ if ( $userdebarred || $borr->{'gonenoaddress'} || $borr->{'lost'} ) {
my $amountoutstanding = $patron->account->balance;
my $no_renewal_amt = C4::Context->preference( 'OPACFineNoRenewals' );
$no_renewal_amt = undef unless looks_like_number( $no_renewal_amt );
my $amountoutstandingfornewal =
C4::Context->preference("OPACFineNoRenewalsIncludeCredit")
? $amountoutstanding
: $patron->account->outstanding_debits->total_outstanding;
if ( C4::Context->preference('OpacRenewalAllowed')
&& defined($no_renewal_amt)
&& $amountoutstanding > $no_renewal_amt )
&& $amountoutstandingfornewal > $no_renewal_amt )
{
$borr->{'flagged'} = 1;
$canrenew = 0;
$template->param(
renewal_blocked_fines => $no_renewal_amt,
renewal_blocked_fines_amountoutstanding => $amountoutstanding,
renewal_blocked_fines_amountoutstanding => $amountoutstandingfornewal,
);
}

Loading…
Cancel
Save