use strict;
#use warnings; FIXME - Bug 2505
use CGI qw ( -utf8 );
-use Digest::MD5 qw(md5_base64);
use C4::Context;
use C4::Auth;
use C4::Output;
my $error = $input->param('error');
$template->param( error => $error ) if ( $error );
-my ( $od, $issue, $fines ) = GetMemberIssuesAndFines($borrowernumber);
-$template->param( issuecount => $issue, fines => $fines );
+my $patron = Koha::Patrons->find($borrowernumber);
+my $issues = $patron->checkouts;
+my $balance = $patron->account->balance;
+$template->param(
+ issuecount => $issues->count,
+ fines => $balance,
+);
+
my $data = GetMember( 'borrowernumber' => $borrowernumber );
$data->{$_} = '';
next;
}
- $template->param( $_ => dt_from_string( $userdate ) );
+ $data->{$_} = dt_from_string( $userdate );
}
$data->{'IS_ADULT'} = ( $data->{'categorycode'} ne 'I' );
$data->{$_} and $template->param(flagged => 1) and last;
}
-if ( Koha::Patrons->find( $borrowernumber )->is_debarred ) {
+if ( $patron->is_debarred ) {
$template->param( 'userdebarred' => 1, 'flagged' => 1 );
my $debar = $data->{'debarred'};
if ( $debar ne "9999-12-31" ) {
$template->param( 'catcode' => $patron_categories->next ) if $patron_categories->count == 1;
}
-my $patron = Koha::Patrons->find($data->{borrowernumber});
my @relatives;
if ( my $guarantor = $patron->guarantor ) {
$template->param( guarantor => $guarantor );
my $totalprice = 0;
# Calculate and display patron's age
-my $dateofbirth = $data->{ 'dateofbirth' };
-my $age = GetAge($dateofbirth);
-$template->param( age => $age );
+if ( $data->{dateofbirth} ) {
+ $template->param( age => Koha::Patron->new({ dateofbirth => $data->{dateofbirth} })->get_age );
+}
### ###############################################################################
# BUILD HTML
$template->param( picture => 1 ) if $patron_image;
# Generate CSRF token for upload and delete image buttons
$template->param(
- csrf_token => Koha::Token->new->generate_csrf({
- id => C4::Context->userenv->{id},
- secret => md5_base64( C4::Context->config('pass') ),
- }),
+ csrf_token => Koha::Token->new->generate_csrf({ session_id => $input->cookie('CGISESSID'),}),
);
$template->param(TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification"));
}
-# in template <TMPL_IF name="I"> => instutitional (A for Adult, C for children)
+# in template <TMPL_IF name="I"> => instutitional (A for Adult, C for children)
$template->param( $data->{'categorycode'} => 1 );
$template->param(
patron => $patron,