use strict;
#use warnings; FIXME - Bug 2505
use CGI qw ( -utf8 );
+use HTML::Entities;
use C4::Context;
use C4::Auth;
use C4::Output;
}
);
my $borrowernumber = $input->param('borrowernumber');
+$borrowernumber = HTML::Entities::encode($borrowernumber);
my $error = $input->param('error');
$template->param( error => $error ) if ( $error );
my $patron = Koha::Patrons->find($borrowernumber);
+unless ( $patron ) {
+ $template->param (unknowuser => 1);
+ output_html_with_http_headers $input, $cookie, $template->output;
+ exit;
+}
+
my $issues = $patron->checkouts;
my $balance = $patron->account->balance;
$template->param(
fines => $balance,
);
-
-my $data = GetMember( 'borrowernumber' => $borrowernumber );
-
-if ( not defined $data ) {
- $template->param (unknowuser => 1);
- output_html_with_http_headers $input, $cookie, $template->output;
- exit;
-}
-
-my $category_type = $data->{'category_type'};
+my $category_type = $patron->category->category_type;
+my $data = $patron->unblessed;
$debug and printf STDERR "dates (enrolled,expiry,birthdate) raw: (%s, %s, %s)\n", map {$data->{$_}} qw(dateenrolled dateexpiry dateofbirth);
foreach (qw(dateenrolled dateexpiry dateofbirth)) {
# check to see if patron's image exists in the database
# basically this gives us a template var to condition the display of
# patronimage related interface on
-my $patron_image = Koha::Patron::Images->find($data->{borrowernumber});
-$template->param( picture => 1 ) if $patron_image;
+$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({ session_id => $input->cookie('CGISESSID'),}),
$template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]);
}
-# in template <TMPL_IF name="I"> => institutional (A for Adult, C for children)
-$template->param( $data->{'categorycode'} => 1 );
-
# Display the language description instead of the code
# Note that this is certainly wrong
my ( $subtag, $region ) = split '-', $patron->lang;
detailview => 1,
borrowernumber => $borrowernumber,
othernames => $data->{'othernames'},
- categoryname => $data->{'description'},
+ categoryname => $patron->category->description,
was_renewed => scalar $input->param('was_renewed') ? 1 : 0,
todaysdate => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }),
totalprice => sprintf("%.2f", $totalprice),
overdues_exist => $overdues_exist,
StaffMember => $category_type eq 'S',
is_child => $category_type eq 'C',
+ $category_type => 1, # [% IF ( I ) %] = institutional/organisation
samebranch => $samebranch,
quickslip => $quickslip,
housebound_role => scalar $patron->housebound_role,
privacy_guarantor_checkouts => $data->{'privacy_guarantor_checkouts'},
- AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
- SuspendHoldsIntranet => C4::Context->preference('SuspendHoldsIntranet'),
RoutingSerials => C4::Context->preference('RoutingSerials'),
PatronsPerPage => C4::Context->preference("PatronsPerPage") || 20,
relatives_issues_count => $relatives_issues_count,