6 use C4::Search; # borrdata
7 use C4::Output; # gettemplate
8 use C4::Auth; # checkauth, getborrowernumber.
10 use C4::Circulation::Circ2;
15 my ($loggedinuser, $cookie, $sessionID) = checkauth($query);
17 my $template = gettemplate("opac-user.tmpl", "opac");
19 # get borrower information ....
20 my $borrowernumber = getborrowernumber($loggedinuser);
21 my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
23 $borr->{'dateenrolled'} = slashifyDate($borr->{'dateenrolled'});
24 $borr->{'expiry'} = slashifyDate($borr->{'expiry'});
25 $borr->{'dateofbirth'} = slashifyDate($borr->{'dateofbirth'});
26 $borr->{'ethnicity'} = fixEthnicity($borr->{'ethnicity'});
28 if ($borr->{'amountoutstanding'} > 5) {
29 $borr->{'amountoverfive'} = 1;
31 $borr->{'amountoverfive'} = 0;
34 $borr->{'amountoutstanding'} = sprintf "\$%.02f", $borr->{'amountoutstanding'};
39 $template->param(BORROWER_INFO => \@bordat);
41 #get issued items ....
42 my $issues = getissues($borr);
46 foreach my $key (keys %$issues) {
47 my $issue = $issues->{$key};
48 $issue->{'date_due'} = slashifyDate($issue->{'date_due'});
49 if ($issue->{'overdue'}) {
50 $issue->{'status'} = "OVERDUE";
52 $issue->{'status'} = "Issued";
55 my ($restype, $res) = CheckReserves($issue->{'itemnumber'});
57 $issue->{'status'} .= "Reserved";
59 my ($charges, $itemtype) = calc_charges(undef, undef, $issue->{'itemnumber'}, $borrowernumber);
60 $issue->{'charges'} = $charges;
61 push @issuedat, $issue;
65 $template->param(ISSUES => \@issuedat);
66 $template->param(issues_count => $count);
68 # now the reserved items....
69 my ($rcount, $reserves) = FindReserves(undef, $borrowernumber);
71 $template->param(RESERVES => $reserves);
72 $template->param(reserves_count => $rcount);
74 my $branches = getbranches();
77 foreach my $res (@$reserves) {
78 if ($res->{'itemnumber'}) {
79 $res->{'branch'} = $branches->{$res->{'branchcode'}}->{'branchname'};
85 $template->param(WAITING => \@waiting);
86 $template->param(waiting_count => $wcount);
88 $template->param(loggedinuser => $loggedinuser);
89 print "Content-Type: text/html\n\n", $template->output;