use C4::Biblio;
use C4::Items;
use C4::Letters;
-use C4::Branch; # GetBranches
use Koha::DateUtils;
use Koha::Holds;
use Koha::Database;
use Koha::Patron::Messages;
+use Koha::Patron::Discharge;
+use Koha::Patrons;
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
}
# get borrower information ....
-my ( $borr ) = GetMemberDetails( $borrowernumber );
+my ( $borr ) = GetMember( borrowernumber => $borrowernumber );
my ( $today_year, $today_month, $today_day) = Today();
my ($warning_year, $warning_month, $warning_day) = split /-/, $borr->{'dateexpiry'};
if ( $debar ne "9999-12-31" ) {
$borr->{'userdebarreddate'} = $debar;
}
+ # FIXME looks like $available is not needed
+ # If a patron is discharged he has a validated discharge available
+ my $available = Koha::Patron::Discharge::count({
+ borrowernumber => $borrowernumber,
+ validated => 1,
+ });
+ $template->param( 'discharge_available' => $available && Koha::Patron::Discharge::is_discharged({borrowernumber => $borrowernumber}) );
}
if ( $userdebarred || $borr->{'gonenoaddress'} || $borr->{'lost'} ) {
$canrenew = 0;
}
-if ( $borr->{'amountoutstanding'} > 5 ) {
+my ( $amountoutstanding ) = GetMemberAccountRecords($borrowernumber);
+if ( $amountoutstanding > 5 ) {
$borr->{'amountoverfive'} = 1;
}
-if ( 5 >= $borr->{'amountoutstanding'} && $borr->{'amountoutstanding'} > 0 ) {
+if ( 5 >= $amountoutstanding && $amountoutstanding > 0 ) {
$borr->{'amountoverzero'} = 1;
}
my $no_renewal_amt = C4::Context->preference( 'OPACFineNoRenewals' );
if ( C4::Context->preference('OpacRenewalAllowed')
&& defined($no_renewal_amt)
- && $borr->{amountoutstanding} > $no_renewal_amt )
+ && $amountoutstanding > $no_renewal_amt )
{
$borr->{'flagged'} = 1;
$canrenew = 0;
$template->param(
renewal_blocked_fines => $no_renewal_amt,
- renewal_blocked_fines_amountoutstanding => $borr->{amountoutstanding},
+ renewal_blocked_fines_amountoutstanding => $amountoutstanding,
);
}
-if ( $borr->{'amountoutstanding'} < 0 ) {
+if ( $amountoutstanding < 0 ) {
$borr->{'amountlessthanzero'} = 1;
- $borr->{'amountoutstanding'} = -1 * ( $borr->{'amountoutstanding'} );
+ $amountoutstanding = -1 * ( $amountoutstanding );
}
# Warningdate is the date that the warning starts appearing
my $renew_error = $query->param('renew_error');
$template->param( BORROWER_INFO => $borr,
+ amountoutstanding => $amountoutstanding,
borrowernumber => $borrowernumber,
patron_flagged => $borr->{flagged},
OPACMySummaryHTML => (C4::Context->preference("OPACMySummaryHTML")) ? 1 : 0,
$issue->{'norenew_overdue'} = 1 if $renewerror eq 'overdue';
$issue->{'auto_renew'} = 1 if $renewerror eq 'auto_renew';
$issue->{'auto_too_soon'} = 1 if $renewerror eq 'auto_too_soon';
+ $issue->{'auto_too_late'} = 1 if $renewerror eq 'auto_too_late';
if ( $renewerror eq 'too_soon' ) {
$issue->{'too_soon'} = 1;
}
$template->param( show_barcode => 1 ) if $show_barcode;
-# load the branches
-my $branches = GetBranches();
-my @branch_loop;
-for my $branch_hash ( sort keys %{$branches} ) {
- my $selected;
- if ( C4::Context->preference('SearchMyLibraryFirst') ) {
- $selected =
- ( C4::Context->userenv
- && ( $branch_hash eq C4::Context->userenv->{branch} ) );
- }
- push @branch_loop,
- { value => "branch: $branch_hash",
- branchname => $branches->{$branch_hash}->{'branchname'},
- selected => $selected,
- };
-}
-$template->param( branchloop => \@branch_loop );
-
# now the reserved items....
my $reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } );
message_type => 'B',
}
);
-if ( $patron_messages->count ) {
- $template->param( bor_messages => 1 );
-}
-
-if ( $borr->{'opacnote'} ) {
- $template->param(
- bor_messages => 1,
- opacnote => $borr->{'opacnote'},
- );
-}
if ( C4::Context->preference('AllowPatronToSetCheckoutsVisibilityForGuarantor')
|| C4::Context->preference('AllowStaffToSetCheckoutsVisibilityForGuarantor') )
}
$template->param(
- borrower => $borr,
+ borrower => Koha::Patrons->find($borrowernumber),
patron_messages => $patron_messages,
+ opacnote => $borr->{opacnote},
patronupdate => $patronupdate,
OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"),
userview => 1,