3 #script to do a borrower enquiery/brin up borrower details etc
4 #written 20/12/99 by chris@katipo.co.nz
5 #Displays all the detailas about a borrower
6 #needs html removed and to use the C4::Output more, but its tricky
7 #last modified 21/1/2000 by chris@katipo.co.nz
8 #modifiecd 31/1/2001 by chris@katipo.co.nz to not allow items on request
16 use C4::Circulation::Renewals2;
17 use C4::Circulation::Circ2;
19 my $bornum=$input->param('bornum');
23 #start the page and read in includes
25 print startmenu('member');
26 my $data=borrdata('',$bornum);
27 my @temp=split('-',$data->{'dateenrolled'});
28 $data->{'dateenrolled'}="$temp[2]/$temp[1]/$temp[0]";
29 @temp=split('-',$data->{'expiry'});
30 $data->{'expiry'}="$temp[2]/$temp[1]/$temp[0]";
31 @temp=split('-',$data->{'dateofbirth'});
32 $data->{'dateofbirth'}="$temp[2]/$temp[1]/$temp[0]";
33 if ($data->{'ethnicity'} eq 'maori'){
34 $data->{'ethnicity'} = 'Maori';
36 if ($data->{'ethnicity'}eq 'european'){
37 $data->{'ethnicity'} = 'European/Pakeha';
39 if ($data->{'ethnicity'}eq 'pi'){
40 $data->{'ethnicity'} = 'Pacific Islander';
42 if ($data->{'ethnicity'}eq 'asian'){
43 $data->{'ethnicity'} = 'Asian';
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 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>
87 Ethnicity: $data->{'ethnicity'}, $data->{'ethnotes'}<BR>
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'){
100 my ($count,$guarantees)=findguarantees($data->{'borrowernumber'});
101 for (my $i=0;$i<$count;$i++){
102 print "<A HREF=\"/cgi-bin/koha/moremember.pl?bornum=$guarantees->[$i]->{'borrowernumber'}\">$guarantees->[$i]->{'cardnumber'}</a><br>";
106 my ($guarantor)=findguarantor($data->{'borrowernumber'});
107 if ($guarantor->{'borrowernumber'} == 0){
108 print "no guarantor<br>";
110 print "<A HREF=\"/cgi-bin/koha/moremember.pl?bornum=$guarantor->{'borrowernumber'}\">$guarantor->{'cardnumber'}</a><br>";
118 General Notes: <!--<A HREF="popbox.html" onclick="messenger(200,250,'Form that lets you add to and delete notes.'); return false">-->
119 $data->{'borrowernotes'}<!--</a>-->
121 <form action=/cgi-bin/koha/memberentry.pl method=post>
122 <input type=hidden name=bornum value=$bornum>
123 <INPUT TYPE="image" name="modify" VALUE="modify" height=42 WIDTH=93 BORDER=0 src="/images/modify-mem.gif">
125 <INPUT TYPE="image" name="delete" VALUE="delete" height=42 WIDTH=93 BORDER=0 src="/images/delete-mem.gif">
132 <img src="/images/holder.gif" width=16 height=800 align=left>
133 <TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
135 <td bgcolor="99cc33" background="/images/background-mem.gif" colspan=4><B>FINES & CHARGES</TD></TR>
139 $bor{'borrowernumber'}=$bornum;
140 my ($numaccts,$accts,$total)=getboracctrecord('',\%bor);
141 #if ($numaccts > 10){
144 for (my$i=0;$i<$numaccts;$i++){
145 #if ($accts->[$i]{'accounttype'} ne 'Pay'){
146 my $amount= $accts->[$i]{'amount'} + 0.00;
147 my $amount2= $accts->[$i]{'amountoutstanding'} + 0.00;
149 print "<tr VALIGN=TOP >";
151 @temp=split('-',$accts->[$i]{'date'});
152 $accts->[$i]{'date'}="$temp[2]/$temp[1]/$temp[0]";
153 if ($accts->[$i]{'accounttype'} ne 'Res'){
157 print "<td>$accts->[$i]{'date'}</td>";
158 # print "<TD>$accts->[$i]{'accounttype'}</td>";
161 if ($accts->[$i]{'accounttype'} ne 'Res'){
162 my $iteminfo=C4::Circulation::Circ2::getiteminformation($env,$accts->[$i]->{'itemnumber'},'');
163 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>";
166 <TD>$amount</td><td>$amount2</td>
173 <TD colspan=3 align=right>
175 <a href=/cgi-bin/koha/boraccount.pl?bornum=$bornum><img height=42 WIDTH=187 BORDER=0 src="/images/view-account.gif"></a>
176 <a href=/cgi-bin/koha/pay.pl?bornum=$bornum><img height=42 WIDTH=187 BORDER=0 src="/images/pay-fines.gif"></a></nobr>
185 <form action="renewscript.pl" method=post>
186 <input type=hidden name=bornum value=$bornum>
187 <TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
191 <td bgcolor="99cc33" background="/images/background-mem.gif" colspan=6><B>ITEMS CURRENTLY ON ISSUE</b></TD>
195 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Title</b></TD>
196 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Due</b></TD>
197 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Itemtype</b></TD>
198 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Charge</b></TD>
199 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Renew</b></TD>
203 my ($count,$issue)=borrissues($bornum);
204 my $today=ParseDate('today');
205 for (my $i=0;$i<$count;$i++){
206 print "<tr VALIGN=TOP >
208 my $datedue=ParseDate($issue->[$i]{'date_due'});
209 @temp=split('-',$issue->[$i]{'date_due'});
210 $issue->[$i]{'date_due'}="$temp[2]/$temp[1]/$temp[0]";
211 if ($datedue < $today){
212 print "<font color=red>";
214 print "$issue->[$i]{'title'}
215 <a href=/cgi-bin/koha/moredetail.pl?item=$issue->[$i]->{'itemnumber'}&bib=$issue->[$i]->{'biblionumber'}&bi=$issue->[$i]->{'biblioitemnumber'}>
216 $issue->[$i]{'barcode'}</a></td>
217 <TD>$issue->[$i]{'date_due'}</td>";
218 #find the charge for an item
219 my ($charge,$itemtype)=calc_charges(\%env,$issue->[$i]{'itemnumber'},$bornum);
220 print "<TD>$itemtype</td>";
221 print "<TD>$charge</td>";
223 # if ($datedue < $today){
224 # print "<td>Overdue</td>";
226 # print "<td> </td>";
228 #check item is not reserved
229 my ($rescount,$reserves)=Findgroupreserve($issue->[$i]{'biblionumber'},'');
231 print "<TD><a href=/cgi-bin/koha/request.pl?bib=$issue->[$i]{'biblionumber'}>On Request - no renewals</a></td></tr>";
232 # } elsif ($issue->[$i]->{'renewals'} > 0) {
233 # print "<TD>Previously Renewed - no renewals</td></tr>";
237 print "<input type=radio name=\"renew_item_$issue->[$i]{'itemnumber'}\" value=y>Y
238 <input type=radio name=\"renew_item_$issue->[$i]{'itemnumber'}\" value=n>N</td>
246 <TD colspan=5 align=right>
247 <INPUT TYPE="image" name="submit" VALUE="update" height=42 WIDTH=187 BORDER=0 src="/images/update-renewals.gif">
258 <TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
262 <td bgcolor="99cc33" background="/images/background-mem.gif" colspan=5><B>ITEMS REQUESTED</b></TD>
267 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Title</b></TD>
268 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Requested</b></TD>
271 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Charge</b></TD>
273 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Remove</b></TD>
275 <form action=/cgi-bin/koha/modrequest.pl method=post>
276 <input type=hidden name=from value=borrower>
279 my ($rescount,$reserves)=FindReserves('',$bornum); #From C4::Reserves2
280 for (my $i=0;$i<$rescount;$i++){
281 @temp=split('-',$reserves->[$i]{'reservedate'});
282 $reserves->[$i]{'reservedate'}="$temp[2]/$temp[1]/$temp[0]";
283 print "<tr VALIGN=TOP >
284 <TD><a href=\"/cgi-bin/koha/request.pl?bib=$reserves->[$i]{'biblionumber'}\">$reserves->[$i]{'btitle'}</a></td>
285 <TD>$reserves->[$i]{'reservedate'}</td>
286 <input type=hidden name=biblio value=$reserves->[$i]{'biblionumber'}>
287 <input type=hidden name=borrower value=$bornum>
289 <TD><select name=\"rank-request\">
291 <option value=del>Yes
299 <TD colspan=5 align=right>
300 <INPUT TYPE="image" name="submit" VALUE="update" height=42 WIDTH=187 BORDER=0 src="/images/cancel-requests.gif"></td>
305 <a href=/cgi-bin/koha/readingrec.pl?bornum=$bornum><img height=42 WIDTH=187 BORDER=0 src="/images/reading-record.gif"></a>
311 print endmenu('member');