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;
24 my $bornum=$input->param('bornum');
29 #start the page and read in includes
31 print startmenu('member');
32 my $data=borrdata('',$bornum);
35 $data->{'dateenrolled'} = slashifyDate($data->{'dateenrolled'});
36 $data->{'expiry'} = slashifyDate($data->{'expiry'});
37 $data->{'dateofbirth'} = slashifyDate($data->{'dateofbirth'});
39 $data->{'ethnicity'} = fixEthnicity($data->{'ethnicity'});
42 <FONT SIZE=6><em>$data->{'firstname'} $data->{'surname'}</em></FONT><P>
44 <form action=/cgi-bin/koha/jmemberentry.pl method=post>
45 <TABLE CELLSPACING=0 CELLPADDING=5 border=1 align=left width=270>
47 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>MEMBERSHIP RECORD</TD></TR>
50 <p align=right><INPUT TYPE="image" name="submit" VALUE="add-child" height=42 WIDTH=120 BORDER=0 src="/images/add-child.gif">
51 <input type=hidden name=type value=Add>
52 <input type=hidden name=bornum value=$data->{'borrowernumber'}>
55 <FONT SIZE=2 face="arial, helvetica">$data->{'title'} $data->{'othernames'} $data->{'surname'} ($data->{'firstname'}, $data->{'initials'})<p>
57 Card Number: $data->{'cardnumber'}<BR>
60 if ($data->{'categorycode'} eq 'C'){
61 my $data2=borrdata('',$data->{'guarantor'});
62 $data->{'streetaddress'}=$data2->{'streetaddress'};
63 $data->{'city'}=$data2->{'city'};
64 $data->{'physstreet'}=$data2->{'phystreet'};
65 $data->{'streetcity'}=$data2->{'streetcity'};
66 $data->{'phone'}=$data2->{'phone'};
67 $data->{'phoneday'}=$data2->{'phoneday'};
70 if ($data->{'ethnicity'} || $data->{'ethnotes'}) {
71 $ethnicityline="Ethnicity: $data->{'ethnicity'}, $data->{'ethnotes'}<br>";
74 Postal Address: $data->{'streetaddress'}, $data->{'city'}<BR>
75 Home Address: $data->{'physstreet'}, $data->{'streetcity'}<BR>
76 Phone (Home): $data->{'phone'}<BR>
77 Phone (Daytime): $data->{'phoneday'}<BR>
78 Fax: $data->{'faxnumber'}<BR>
79 E-mail: <a href="mailto:$data->{'emailaddress'}">$data->{'emailaddress'}</a><br>
80 Textmessaging:$data->{'textmessaging'}<p>
81 Membership Number: $data->{'borrowernumber'}<BR>
82 Membership: $data->{'categorycode'}<BR>
83 Area: $data->{'area'}<BR>
84 Fee:$30/year, Paid<BR>
85 Joined: $data->{'dateenrolled'}, Expires: $data->{'expiry'} <BR>
86 Joining Branch: $data->{'homebranch'}<P>
88 DoB: $data->{'dateofbirth'}<BR>
89 Sex: $data->{'sex'}<P>
91 Alternative Contact:$data->{'contactname'}<BR>
92 Phone: $data->{'altphone'}<BR>
93 Relationship: $data->{'altrelationship'}<BR>
94 Notes: $data->{'altnotes'}<P>
98 if ($data->{'categorycode'} ne 'C'){
101 # It looks like the $i is only being returned to handle walking through
102 # the array, which is probably better done as a foreach loop.
104 my ($count,$guarantees)=findguarantees($data->{'borrowernumber'});
105 for (my $i=0;$i<$count;$i++){
106 print "<A HREF=\"/cgi-bin/koha/moremember.pl?bornum=$guarantees->[$i]->{'borrowernumber'}\">$guarantees->[$i]->{'cardnumber'}</a><br>";
110 my ($guarantor)=findguarantor($data->{'borrowernumber'});
111 if ($guarantor->{'borrowernumber'} == 0){
112 print "no guarantor<br>";
114 print "<A HREF=\"/cgi-bin/koha/moremember.pl?bornum=$guarantor->{'borrowernumber'}\">$guarantor->{'cardnumber'}</a><br>";
122 General Notes: <!--<A HREF="popbox.html" onclick="messenger(200,250,'Form that lets you add to and delete notes.'); return false">-->
123 $data->{'borrowernotes'}<!--</a>-->
125 <form action=/cgi-bin/koha/memberentry.pl method=post>
126 <input type=hidden name=bornum value=$bornum>
127 <INPUT TYPE="image" name="modify" VALUE="modify" height=42 WIDTH=93 BORDER=0 src="/images/modify-mem.gif">
129 <INPUT TYPE="image" name="delete" VALUE="delete" height=42 WIDTH=93 BORDER=0 src="/images/delete-mem.gif">
136 <img src="/images/holder.gif" width=16 height=800 align=left>
137 <TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
139 <td bgcolor="99cc33" background="/images/background-mem.gif" colspan=4><B>FINES & CHARGES</TD></TR>
143 $bor{'borrowernumber'}=$bornum;
146 # it looks like $numaccts is a temp variable and that the
147 # for (my $i;$i<$numaccts;$i+++)
148 # can be turned into a foreach loop instead
150 my ($numaccts,$accts,$total)=getboracctrecord('',\%bor);
151 #if ($numaccts > 10){
154 for (my$i=0;$i<$numaccts;$i++){
155 #if ($accts->[$i]{'accounttype'} ne 'Pay'){
156 my $amount= $accts->[$i]{'amount'} + 0.00;
157 my $amount2= $accts->[$i]{'amountoutstanding'} + 0.00;
159 print "<tr VALIGN=TOP >";
162 $accts->[$i]{'date'} = slashifyDate($accts->[$i]{'date'});
164 if ($accts->[$i]{'accounttype'} ne 'Res'){
168 print "<td>$accts->[$i]{'date'}</td>";
169 # print "<TD>$accts->[$i]{'accounttype'}</td>";
173 # why set this variable if it's not going to be used?
176 if ($accts->[$i]{'accounttype'} ne 'Res'){
177 my $iteminfo=C4::Circulation::Circ2::getiteminformation($env,$accts->[$i]->{'itemnumber'},'');
178 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>";
181 <TD>$amount</td><td>$amount2</td>
188 <TD colspan=3 align=right>
190 <a href=/cgi-bin/koha/boraccount.pl?bornum=$bornum><img height=42 WIDTH=187 BORDER=0 src="/images/view-account.gif"></a>
191 <a href=/cgi-bin/koha/pay.pl?bornum=$bornum><img height=42 WIDTH=187 BORDER=0 src="/images/pay-fines.gif"></a></nobr>
200 <form action="renewscript.pl" method=post>
201 <input type=hidden name=bornum value=$bornum>
202 <TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
206 <td bgcolor="99cc33" background="/images/background-mem.gif" colspan=6><B>ITEMS CURRENTLY ON ISSUE</b></TD>
210 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Title</b></TD>
211 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Due</b></TD>
212 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Itemtype</b></TD>
213 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Charge</b></TD>
214 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Renew</b></TD>
218 my ($count,$issue)=borrissues($bornum);
219 my $today=ParseDate('today');
220 for (my $i=0;$i<$count;$i++){
221 print "<tr VALIGN=TOP >
223 my $datedue=ParseDate($issue->[$i]{'date_due'});
225 $issue->[$i]{'date_due'} = slashifyDate($issue->[$i]{'date_due'});
227 if ($datedue < $today){
228 print "<font color=red>";
230 print "$issue->[$i]{'title'}
231 <a href=/cgi-bin/koha/moredetail.pl?item=$issue->[$i]->{'itemnumber'}&bib=$issue->[$i]->{'biblionumber'}&bi=$issue->[$i]->{'biblioitemnumber'}>
232 $issue->[$i]{'barcode'}</a></td>
233 <TD>$issue->[$i]{'date_due'}</td>";
234 #find the charge for an item
235 my ($charge,$itemtype)=calc_charges(undef,$issue->[$i]{'itemnumber'},$bornum);
236 print "<TD>$itemtype</td>";
237 print "<TD>$charge</td>";
239 # if ($datedue < $today){
240 # print "<td>Overdue</td>";
242 # print "<td> </td>";
244 #check item is not reserved
245 my ($rescount,$reserves)=Findgroupreserve($issue->[$i]{'biblioitemnumber'},$issue->[$i]{'biblionumber'});
247 print "<TD><a href=/cgi-bin/koha/request.pl?bib=$issue->[$i]{'biblionumber'}>On Request - no renewals</a></td></tr>";
248 # } elsif ($issue->[$i]->{'renewals'} > 0) {
249 # print "<TD>Previously Renewed - no renewals</td></tr>";
253 print "<input type=radio name=\"renew_item_$issue->[$i]{'itemnumber'}\" value=y>Y
254 <input type=radio name=\"renew_item_$issue->[$i]{'itemnumber'}\" value=n>N</td>
262 <TD colspan=5 align=right>
263 <INPUT TYPE="image" name="submit" VALUE="update" height=42 WIDTH=187 BORDER=0 src="/images/update-renewals.gif">
274 <TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
278 <td bgcolor="99cc33" background="/images/background-mem.gif" colspan=5><B>ITEMS REQUESTED</b></TD>
283 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Title</b></TD>
284 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Requested</b></TD>
287 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Charge</b></TD>
289 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Remove</b></TD>
291 <form action=/cgi-bin/koha/modrequest.pl method=post>
292 <input type=hidden name=from value=borrower>
296 my ($rescount,$reserves)=FindReserves('',$bornum); #From C4::Reserves2
299 # does it make sense to turn this into a foreach my $i (0..$rescount)
302 for (my $i=0;$i<$rescount;$i++){
303 $reserves->[$i]{'reservedate'} = slashifyDate($reserves->[$i]{'reservedate'});
305 print "<tr VALIGN=TOP >
306 <TD><a href=\"/cgi-bin/koha/request.pl?bib=$reserves->[$i]{'biblionumber'}\">$reserves->[$i]{'btitle'}</a></td>
307 <TD>$reserves->[$i]{'reservedate'}</td>
308 <input type=hidden name=biblio value=$reserves->[$i]{'biblionumber'}>
309 <input type=hidden name=borrower value=$bornum>
311 <TD><select name=\"rank-request\">
313 <option value=del>Yes
321 <TD colspan=5 align=right>
322 <INPUT TYPE="image" name="submit" VALUE="update" height=42 WIDTH=187 BORDER=0 src="/images/cancel-requests.gif"></td>
327 <a href=/cgi-bin/koha/readingrec.pl?bornum=$bornum><img height=42 WIDTH=187 BORDER=0 src="/images/reading-record.gif"></a>
333 print endmenu('member');