use C4::Branch; # GetBranchName
#use Smart::Comments;
+#use Data::Dumper;
use vars qw($debug);
my $dbh = C4::Context->dbh;
my $input = new CGI;
+$debug or $debug = $input->param('debug') || 0;
my $print = $input->param('print');
my @failedrenews = $input->param('failedrenew');
+my @failedreturns = $input->param('failedreturn');
my $error = $input->param('error');
my @renew_failed;
-for (@failedrenews) { $renew_failed[$_] = 1; }
+for my $renew (@failedrenews) { $renew_failed[$renew] = 1; }
+my @return_failed;
+for my $failedret (@failedreturns) { $return_failed[$failedret] = 1; }
my $template_name;
if ( not defined $data ) {
$template->param (unknowuser => 1);
+ output_html_with_http_headers $input, $cookie, $template->output;
exit;
}
# in template <TMPL_IF name="I"> => instutitional (A for Adult& C for children)
$template->param( $data->{'categorycode'} => 1 );
+$debug and printf STDERR "dates (enrolled,expiry,birthdate) raw: (%s, %s, %s)\n", map {$data->{$_}} qw(dateenrolled dateexpiry dateofbirth);
foreach (qw(dateenrolled dateexpiry dateofbirth)) {
my $userdate = $data->{$_};
unless ($userdate) {
$data->{$_} = '';
next;
}
- my $tempdate = C4::Dates->new($userdate,'iso')->output('syspref')
- or warn ("Invalid $_ = '$userdate'");
- $data->{$_} = $tempdate || '';
+ $userdate = C4::Dates->new($userdate,'iso')->output('syspref');
+ $data->{$_} = $userdate || '';
+ $template->param( $_ => $userdate );
}
$data->{'IS_ADULT'} = ( $data->{'categorycode'} ne 'I' );
}
$data->{'ethnicity'} = fixEthnicity( $data->{'ethnicity'} );
-
$data->{ "sex_".$data->{'sex'}."_p" } = 1;
+my $catcode;
if ( $category_type eq 'C' and $data->{'guarantorid'} ne '0' ) {
-
my $data2 = GetMember( $data->{'guarantorid'} ,'borrowernumber');
- foreach (qw(address city B_address B_city phone mobilezipcode)) {
+ foreach (qw(address city B_address B_city phone mobile zipcode)) {
$data->{$_} = $data2->{$_};
}
my ( $catcodes, $labels ) =
GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
my $cnt = scalar(@$catcodes);
- $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1;
- $template->param( 'IS_CHILD' => 1 );
+
+# $cnt = 1;
+ $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1;
+
+ $template->param( 'catcode' => $catcodes->[0]) if $cnt == 1;
}
+
if ( $data->{'ethnicity'} || $data->{'ethnotes'} ) {
$template->param( printethnicityline => 1 );
}
$template->param("guarantor$_" => $guarantor->{$_});
}
}
+ if ($category_type eq 'C'){
+ $template->param('C' => 1);
+ }
}
#Independant branches management
for ( my $i = 0 ; $i < $count ; $i++ ) {
my $datedue = $issue->[$i]{'date_due'};
$issue->[$i]{'date_due'} = C4::Dates->new($issue->[$i]{'date_due'},'iso')->output('syspref');
+ $issue->[$i]{'issuedate'} = C4::Dates->new($issue->[$i]{'issuedate'},'iso')->output('syspref');
my %row = %{ $issue->[$i] };
$totalprice += $issue->[$i]{'replacementprice'};
$row{'replacementprice'} = $issue->[$i]{'replacementprice'};
$row{'charge'} = sprintf( "%.2f", $charge );
- #check item is not reserved
- my ( $restype, $reserves ) = CheckReserves( $issue->[$i]{'itemnumber'} );
- $row{'norenew'} = ($restype) ? 1 : 0;
+ my ( $renewokay,$renewerror ) = CanBookBeRenewed( $borrowernumber, $issue->[$i]{'itemnumber'});
+ $row{'norenew'} = !$renewokay;
+ $row{'norenew_reason'} = $renewerror;
$row{'renew_failed'} = $renew_failed[$issue->[$i]{'itemnumber'}];
+ $row{'return_failed'} = $return_failed[$issue->[$i]{'barcode'}];
push( @issuedata, \%row );
}
-##################################################################################
+### ###############################################################################
# BUILD HTML
# show all reserves of this borrower, and the position of the reservation ....
if ($borrowernumber) {
$_->{ $_->{type} } = 1;
$_->{relatedto} = findrelatedto( $_->{type}, $_->{externalid} );
}
-my $picture;
-my $htdocs = C4::Context->config('intrahtdocs');
-$picture = "/borrowerimages/" . $borrowernumber . ".jpg";
-if ( -e $htdocs . "$picture" ) {
- $template->param( picture => $picture );
-}
+
+# grab patron's image if available
+my $picture = GetPatronImage($data->{'cardnumber'});
+$template->param( picture => $picture );
+
+
my $branch=C4::Context->userenv->{'branch'};
$template->param($data);
$template->param(
detailview => 1,
+ DHTMLcalendar_dateformat=>C4::Dates->DHTMLcalendar(),
roaddetails => $roaddetails,
borrowernumber => $borrowernumber,
reregistration => $reregistration,
error => $error,
$error => 1,
StaffMember => ($category_type eq 'S'),
+ is_child => ($category_type eq 'C'),
# reserveloop => \@reservedata,
);