3 # script to do a borrower enquiry/bring up borrower details etc
4 # Displays all the details about a borrower
5 # written 20/12/99 by chris@katipo.co.nz
6 # last modified 21/1/2000 by chris@katipo.co.nz
7 # modified 31/1/2001 by chris@katipo.co.nz
8 # to not allow items on request to be renewed
10 # needs html removed and to use the C4::Output more, but its tricky
19 use C4::Circulation::Renewals2;
20 use C4::Circulation::Circ2;
26 $flagsrequired->{borrowers}=1;
27 my ($loggedinuser, $cookie, $sessionID) = checkauth($input, 0, $flagsrequired);
28 my $bornum=$input->param('bornum');
33 #start the page and read in includes
35 print startmenu('member');
36 my $data=borrdata('',$bornum);
39 $data->{'dateenrolled'} = slashifyDate($data->{'dateenrolled'});
40 $data->{'expiry'} = slashifyDate($data->{'expiry'});
41 $data->{'dateofbirth'} = slashifyDate($data->{'dateofbirth'});
43 $data->{'ethnicity'} = fixEthnicity($data->{'ethnicity'});
46 <FONT SIZE=6><em>$data->{'firstname'} $data->{'surname'}</em></FONT><P>
48 <form action=/cgi-bin/koha/jmemberentry.pl method=post>
49 <TABLE CELLSPACING=0 CELLPADDING=5 border=1 align=left width=270>
51 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>MEMBERSHIP RECORD</TD></TR>
54 <p align=right><INPUT TYPE="image" name="submit" VALUE="add-child" height=42 WIDTH=120 BORDER=0 src="/images/add-child.gif">
55 <input type=hidden name=type value=Add>
56 <input type=hidden name=bornum value=$data->{'borrowernumber'}>
59 <FONT SIZE=2 face="arial, helvetica">$data->{'title'} $data->{'othernames'} $data->{'surname'} ($data->{'firstname'}, $data->{'initials'})<p>
61 Card Number: $data->{'cardnumber'}<BR>
64 if ($data->{'categorycode'} eq 'C'){
65 my $data2=borrdata('',$data->{'guarantor'});
66 $data->{'streetaddress'}=$data2->{'streetaddress'};
67 $data->{'city'}=$data2->{'city'};
68 $data->{'physstreet'}=$data2->{'phystreet'};
69 $data->{'streetcity'}=$data2->{'streetcity'};
70 $data->{'phone'}=$data2->{'phone'};
71 $data->{'phoneday'}=$data2->{'phoneday'};
74 if ($data->{'ethnicity'} || $data->{'ethnotes'}) {
75 $ethnicityline="Ethnicity: $data->{'ethnicity'}, $data->{'ethnotes'}<br>";
78 Postal Address: $data->{'streetaddress'}, $data->{'city'}<BR>
79 Home Address: $data->{'physstreet'}, $data->{'streetcity'}<BR>
80 Phone (Home): $data->{'phone'}<BR>
81 Phone (Daytime): $data->{'phoneday'}<BR>
82 Fax: $data->{'faxnumber'}<BR>
83 E-mail: <a href="mailto:$data->{'emailaddress'}">$data->{'emailaddress'}</a><br>
84 Textmessaging:$data->{'textmessaging'}<p>
85 Membership Number: $data->{'borrowernumber'}<BR>
86 Membership: $data->{'categorycode'}<BR>
87 Area: $data->{'area'}<BR>
88 Fee:$30/year, Paid<BR>
89 Joined: $data->{'dateenrolled'}, Expires: $data->{'expiry'} <BR>
90 Joining Branch: $data->{'homebranch'}<P>
92 DoB: $data->{'dateofbirth'}<BR>
93 Sex: $data->{'sex'}<P>
95 Alternative Contact:$data->{'contactname'}<BR>
96 Phone: $data->{'altphone'}<BR>
97 Relationship: $data->{'altrelationship'}<BR>
98 Notes: $data->{'altnotes'}<P>
102 if ($data->{'categorycode'} ne 'C'){
103 print " Guarantees:";
105 # It looks like the $i is only being returned to handle walking through
106 # the array, which is probably better done as a foreach loop.
108 my ($count,$guarantees)=findguarantees($data->{'borrowernumber'});
109 for (my $i=0;$i<$count;$i++){
110 print "<A HREF=\"/cgi-bin/koha/moremember.pl?bornum=$guarantees->[$i]->{'borrowernumber'}\">$guarantees->[$i]->{'cardnumber'}</a><br>";
114 my ($guarantor)=findguarantor($data->{'borrowernumber'});
115 if ($guarantor->{'borrowernumber'} == 0){
116 print "no guarantor<br>";
118 print "<A HREF=\"/cgi-bin/koha/moremember.pl?bornum=$guarantor->{'borrowernumber'}\">$guarantor->{'cardnumber'}</a><br>";
126 General Notes: <!--<A HREF="popbox.html" onclick="messenger(200,250,'Form that lets you add to and delete notes.'); return false">-->
127 $data->{'borrowernotes'}<!--</a>-->
129 <form action=/cgi-bin/koha/memberentry.pl method=post>
130 <input type=hidden name=bornum value=$bornum>
131 <INPUT TYPE="image" name="modify" VALUE="modify" height=42 WIDTH=93 BORDER=0 src="/images/modify-mem.gif">
133 <INPUT TYPE="image" name="delete" VALUE="delete" height=42 WIDTH=93 BORDER=0 src="/images/delete-mem.gif">
136 <INPUT TYPE="image" name="password" VALUE="password" height=42 WIDTH=154 BORDER=0 src="/images/password-mem.gif">
138 <a href=member-flags.pl?member=$bornum>Modify User Flags</a>
144 <img src="/images/holder.gif" width=16 height=800 align=left>
145 <TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
147 <td bgcolor="99cc33" background="/images/background-mem.gif" colspan=4><B>FINES & CHARGES</TD></TR>
151 $bor{'borrowernumber'}=$bornum;
154 # it looks like $numaccts is a temp variable and that the
155 # for (my $i;$i<$numaccts;$i+++)
156 # can be turned into a foreach loop instead
158 my ($numaccts,$accts,$total)=getboracctrecord('',\%bor);
159 #if ($numaccts > 10){
162 for (my$i=0;$i<$numaccts;$i++){
163 #if ($accts->[$i]{'accounttype'} ne 'Pay'){
164 my $amount= $accts->[$i]{'amount'} + 0.00;
165 my $amount2= $accts->[$i]{'amountoutstanding'} + 0.00;
167 print "<tr VALIGN=TOP >";
170 $accts->[$i]{'date'} = slashifyDate($accts->[$i]{'date'});
172 if ($accts->[$i]{'accounttype'} ne 'Res'){
176 print "<td>$accts->[$i]{'date'}</td>";
177 # print "<TD>$accts->[$i]{'accounttype'}</td>";
181 # why set this variable if it's not going to be used?
184 if ($accts->[$i]{'accounttype'} ne 'Res'){
185 my $iteminfo=C4::Circulation::Circ2::getiteminformation($env,$accts->[$i]->{'itemnumber'},'');
186 print "<a href=/cgi-bin/koha/moredetail.pl?itemnumber=$accts->[$i]->{'itemnumber'}&bib=$iteminfo->{'biblionumber'}&bi=$iteminfo->{'biblioitemnumber'}>$accts->[$i]->{'description'} $accts->[$i]{'title'}</a>";
189 <TD>$amount</td><td>$amount2</td>
196 <TD colspan=3 align=right>
198 <a href=/cgi-bin/koha/boraccount.pl?bornum=$bornum><img height=42 WIDTH=187 BORDER=0 src="/images/view-account.gif"></a>
199 <a href=/cgi-bin/koha/pay.pl?bornum=$bornum><img height=42 WIDTH=187 BORDER=0 src="/images/pay-fines.gif"></a></nobr>
208 <form action="renewscript.pl" method=post>
209 <input type=hidden name=bornum value=$bornum>
210 <TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
214 <td bgcolor="99cc33" background="/images/background-mem.gif" colspan=6><B>ITEMS CURRENTLY ON ISSUE</b></TD>
218 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Title</b></TD>
219 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Due</b></TD>
220 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Itemtype</b></TD>
221 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Charge</b></TD>
222 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Renew</b></TD>
226 my ($count,$issue)=borrissues($bornum);
227 my $today=ParseDate('today');
228 for (my $i=0;$i<$count;$i++){
229 print "<tr VALIGN=TOP >
231 my $datedue=ParseDate($issue->[$i]{'date_due'});
233 $issue->[$i]{'date_due'} = slashifyDate($issue->[$i]{'date_due'});
235 if ($datedue < $today){
236 print "<font color=red>";
238 print "$issue->[$i]{'title'}
239 <a href=/cgi-bin/koha/moredetail.pl?item=$issue->[$i]->{'itemnumber'}&bib=$issue->[$i]->{'biblionumber'}&bi=$issue->[$i]->{'biblioitemnumber'}>
240 $issue->[$i]{'barcode'}</a></td>
241 <TD>$issue->[$i]{'date_due'}</td>";
242 #find the charge for an item
243 warn "calling calc_charges\n";
244 my ($charge,$itemtype)=calc_charges(undef,undef,$issue->[$i]{'itemnumber'},$bornum);
245 print "<TD>$itemtype</td>";
246 print "<TD>$charge</td>";
248 # if ($datedue < $today){
249 # print "<td>Overdue</td>";
251 # print "<td> </td>";
253 #check item is not reserved
254 my ($rescount,$reserves)=CheckReserves($issue->[$i]{'itemnumber'});
256 print "<TD><a href=/cgi-bin/koha/request.pl?bib=$issue->[$i]{'biblionumber'}>On Request - no renewals</a></td></tr>";
257 # } elsif ($issue->[$i]->{'renewals'} > 0) {
258 # print "<TD>Previously Renewed - no renewals</td></tr>";
262 print "<input type=radio name=\"renew_item_$issue->[$i]{'itemnumber'}\" value=y>Y
263 <input type=radio name=\"renew_item_$issue->[$i]{'itemnumber'}\" value=n>N</td>
271 <TD colspan=5 align=right>
272 <INPUT TYPE="image" name="submit" VALUE="update" height=42 WIDTH=187 BORDER=0 src="/images/update-renewals.gif">
283 <TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
287 <td bgcolor="99cc33" background="/images/background-mem.gif" colspan=5><B>ITEMS REQUESTED</b></TD>
292 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Title</b></TD>
293 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Requested</b></TD>
296 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Charge</b></TD>
298 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Remove</b></TD>
300 <form action=/cgi-bin/koha/modrequest.pl method=post>
301 <input type=hidden name=from value=borrower>
305 my ($rescount,$reserves)=FindReserves('',$bornum); #From C4::Reserves2
308 # does it make sense to turn this into a foreach my $i (0..$rescount)
311 for (my $i=0;$i<$rescount;$i++){
312 $reserves->[$i]{'reservedate'} = slashifyDate($reserves->[$i]{'reservedate'});
314 print "<tr VALIGN=TOP >
315 <TD><a href=\"/cgi-bin/koha/request.pl?bib=$reserves->[$i]{'biblionumber'}\">$reserves->[$i]{'btitle'}</a></td>
316 <TD>$reserves->[$i]{'reservedate'}</td>
317 <input type=hidden name=biblio value=$reserves->[$i]{'biblionumber'}>
318 <input type=hidden name=borrower value=$bornum>
320 <TD><select name=\"rank-request\">
322 <option value=del>Yes
330 <TD colspan=5 align=right>
331 <INPUT TYPE="image" name="submit" VALUE="update" height=42 WIDTH=187 BORDER=0 src="/images/cancel-requests.gif"></td>
336 <a href=/cgi-bin/koha/readingrec.pl?bornum=$bornum><img height=42 WIDTH=187 BORDER=0 src="/images/reading-record.gif"></a>
342 print endmenu('member');