use C4::Letters;
use C4::Branch; # GetBranches
use Koha::DateUtils;
-use Koha::Borrower::Debarments qw(IsDebarred);
+use Koha::Patron::Debarments qw(IsDebarred);
use Koha::Holds;
use Koha::Database;
+use Koha::Patron::Messages;
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
+use Scalar::Util qw(looks_like_number);
use Date::Calc qw(
Today
Add_Delta_Days
$borr->{'amountoverzero'} = 1;
}
my $no_renewal_amt = C4::Context->preference( 'OPACFineNoRenewals' );
-$no_renewal_amt ||= 0;
+$no_renewal_amt = undef unless looks_like_number( $no_renewal_amt );
-if ( C4::Context->preference( 'OpacRenewalAllowed' ) && $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} ),
);
}
$template->param(JacketImages=>1);
}
-if ( GetMessagesCount( $borrowernumber, 'B' ) ) {
+my $patron_messages = Koha::Patron::Messages->search(
+ {
+ borrowernumber => $borrowernumber,
+ message_type => 'B',
+ }
+);
+if ( $patron_messages->count ) {
$template->param( bor_messages => 1 );
}
$template->param(
borrower => $borr,
- bor_messages_loop => GetMessages( $borrowernumber, 'B', 'NONE' ),
+ patron_messages => $patron_messages,
patronupdate => $patronupdate,
OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"),
userview => 1,
SuspendHoldsOpac => C4::Context->preference('SuspendHoldsOpac'),
AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
OpacHoldNotes => C4::Context->preference('OpacHoldNotes'),
- failed_holds => $query->param('failed_holds'),
+ failed_holds => scalar $query->param('failed_holds'),
);
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };