8 use C4::Circulation::Circ2;
9 use C4::Circulation::Renewals2;
15 my ($template, $borrowernumber, $cookie)
16 = get_template_and_user({template_name => "opac-user.tmpl",
20 flagsrequired => {borrow => 1},
24 # get borrower information ....
25 my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
27 $borr->{'dateenrolled'} = slashifyDate($borr->{'dateenrolled'});
28 $borr->{'expiry'} = slashifyDate($borr->{'expiry'});
29 $borr->{'dateofbirth'} = slashifyDate($borr->{'dateofbirth'});
30 $borr->{'ethnicity'} = fixEthnicity($borr->{'ethnicity'});
32 if ($borr->{'amountoutstanding'} > 5) {
33 $borr->{'amountoverfive'} = 1;
35 if (5 >= $borr->{'amountoutstanding'} && $borr->{'amountoutstanding'} > 0 ) {
36 $borr->{'amountoverzero'} = 1;
38 if ($borr->{'amountoutstanding'} < 0) {
39 $borr->{'amountlessthanzero'} = 1;
40 $borr->{'amountoutstanding'} = -1*($borr->{'amountoutstanding'});
43 $borr->{'amountoutstanding'} = sprintf "\$%.02f", $borr->{'amountoutstanding'};
48 $template->param(BORROWER_INFO => \@bordat);
49 $template->param(borrowernumber => $borrowernumber);
51 #get issued items ....
52 my $issues = getissues($borr);
55 my $overdues_count = 0;
58 foreach my $key (keys %$issues) {
59 my $issue = $issues->{$key};
60 $issue->{'date_due'} = slashifyDate($issue->{'date_due'});
63 my ($restype, $res) = CheckReserves($issue->{'itemnumber'});
65 $issue->{'reserved'} = 1;
68 my ($numaccts,$accts,$total) = getboracctrecord(undef,$borr);
70 foreach my $ac (@$accts) {
71 if ($ac->{'itemnumber'} == $issue->{'itemnumber'}) {
72 $charges += $ac->{'amountoutstanding'} if $ac->{'accounttype'} eq 'F';
73 $charges += $ac->{'amountoutstanding'} if $ac->{'accounttype'} eq 'L';
76 $issue->{'charges'} = $charges;
78 # get publictype for icon
80 my $publictype = $issue->{'publictype'};
81 $issue->{$publictype} = 1;
83 # check if item is renewable
85 my $status = renewstatus(\%env,$borrowernumber, $issue->{'itemnumber'});
87 $issue->{'renewable'} = $status;
89 if ($issue->{'overdue'}) {
90 push @overdues, $issue;
92 $issue->{'overdue'} = 1;
94 $issue->{'issued'} = 1;
96 push @issuedat, $issue;
100 $template->param(ISSUES => \@issuedat);
101 $template->param(issues_count => $count);
103 $template->param(OVERDUES => \@overdues);
104 $template->param(overdues_count => $overdues_count);
106 my $branches = getbranches();
108 # now the reserved items....
109 my ($rcount, $reserves) = FindReserves(undef, $borrowernumber);
110 foreach my $res (@$reserves) {
111 $res->{'reservedate'} = slashifyDate($res->{'reservedate'});
112 my $publictype = $res->{'publictype'};
113 $res->{$publictype} = 1;
114 $res->{'waiting'} = 1 if $res->{'found'} eq 'W';
115 $res->{'branch'} = $branches->{$res->{'branchcode'}}->{'branchname'};
118 $template->param(RESERVES => $reserves);
119 $template->param(reserves_count => $rcount);
123 foreach my $res (@$reserves) {
124 if ($res->{'itemnumber'}) {
125 $res->{'branch'} = $branches->{$res->{'branchcode'}}->{'branchname'};
131 # $template->param(WAITING => \@waiting);
132 $template->param(waiting_count => $wcount);
134 print $query->header(-cookie => $cookie), $template->output;