Skip to content
Newer
Older
100755 361 lines (306 sloc) 10.9 KB
d0374d0 Initial revision
rangi authored
1 #!/usr/bin/perl
2
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
58a8ef5 Changed it so you cant renew a book that is on request, made a link from
rangi authored
8 #modifiecd 31/1/2001 by chris@katipo.co.nz to not allow items on request
9 #to be renewed
d0374d0 Initial revision
rangi authored
10 use strict;
11 use C4::Output;
12 use CGI;
13 use C4::Search;
14 use Date::Manip;
15 use C4::Reserves2;
16 use C4::Circulation::Renewals2;
60debf9 Changing the form so it passes through a modify value to tell the scr…
rangi authored
17 use C4::Circulation::Circ2;
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
18 use C4::Koha;
19
d0374d0 Initial revision
rangi authored
20 my $input = new CGI;
21 my $bornum=$input->param('bornum');
22
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
23
24 # FIXME
25 # this hash is never assigned, though it is used (as a placeholder?)
26 #
d0374d0 Initial revision
rangi authored
27 my %env;
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
28
d0374d0 Initial revision
rangi authored
29 print $input->header;
30 #start the page and read in includes
31 print startpage();
32 print startmenu('member');
33 my $data=borrdata('',$bornum);
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
34
35
36 $data->{'dateenrolled'} = slashifyDate($data->{'dateenrolled'});
37 $data->{'expiry'} = slashifyDate($data->{'expiry'});
38 $data->{'dateofbirth'} = slashifyDate($data->{'dateofbirth'});
39
40 # FIXME
41 # turn the ethnicity into a function and make it generalizable
42 # check these files to see if one convention or the other makes sense
43 # boraccount.pl
44 # imemberentry.pl
45 # jmemberentry.pl
46 # mancredit.pl
47 # maninvoice.pl
48 # member.pl
49 # memberentry.pl
50 # moremember.pl
51 # moremember.pl
52 # pay.pl
53 # placerequest.pl
54 # readingrec.pl
55 #
d0374d0 Initial revision
rangi authored
56 if ($data->{'ethnicity'} eq 'maori'){
57 $data->{'ethnicity'} = 'Maori';
58 }
59 if ($data->{'ethnicity'}eq 'european'){
60 $data->{'ethnicity'} = 'European/Pakeha';
61 }
62 if ($data->{'ethnicity'}eq 'pi'){
63 $data->{'ethnicity'} = 'Pacific Islander';
64 }
65 if ($data->{'ethnicity'}eq 'asian'){
66 $data->{'ethnicity'} = 'Asian';
67 }
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
68
d0374d0 Initial revision
rangi authored
69 print <<printend
70 <FONT SIZE=6><em>$data->{'firstname'} $data->{'surname'}</em></FONT><P>
71 <p>
72 <form action=/cgi-bin/koha/jmemberentry.pl method=post>
73 <TABLE CELLSPACING=0 CELLPADDING=5 border=1 align=left width=270>
74 <TR VALIGN=TOP>
75 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>MEMBERSHIP RECORD</TD></TR>
76 <tr VALIGN=TOP >
77 <TD>
78 <p align=right><INPUT TYPE="image" name="submit" VALUE="add-child" height=42 WIDTH=120 BORDER=0 src="/images/add-child.gif">
79 <input type=hidden name=type value=Add>
80 <input type=hidden name=bornum value=$data->{'borrowernumber'}>
81 </form>
82 </P><br>
83 <FONT SIZE=2 face="arial, helvetica">$data->{'title'} $data->{'othernames'} $data->{'surname'} ($data->{'firstname'}, $data->{'initials'})<p>
84
85 Card Number: $data->{'cardnumber'}<BR>
5849a03 Fix so that reserves are only showing for the biblioitem not the bibl…
rangi authored
86 printend
87 ;
88 if ($data->{'categorycode'} eq 'C'){
89 my $data2=borrdata('',$data->{'guarantor'});
90 $data->{'streetaddress'}=$data2->{'streetaddress'};
91 $data->{'city'}=$data2->{'city'};
92 $data->{'physstreet'}=$data2->{'phystreet'};
93 $data->{'streetcity'}=$data2->{'streetcity'};
94 $data->{'phone'}=$data2->{'phone'};
95 $data->{'phoneday'}=$data2->{'phoneday'};
96 }
97 print <<printend
d0374d0 Initial revision
rangi authored
98 Postal Address: $data->{'streetaddress'}, $data->{'city'}<BR>
99 Home Address: $data->{'physstreet'}, $data->{'streetcity'}<BR>
100 Phone (Home): $data->{'phone'}<BR>
101 Phone (Daytime): $data->{'phoneday'}<BR>
102 Fax: $data->{'faxnumber'}<BR>
5849a03 Fix so that reserves are only showing for the biblioitem not the bibl…
rangi authored
103 E-mail: <a href="mailto:$data->{'emailaddress'}">$data->{'emailaddress'}</a><br>
104 Textmessaging:$data->{'textmessaging'}<p>
d0374d0 Initial revision
rangi authored
105 Membership Number: $data->{'borrowernumber'}<BR>
106 Membership: $data->{'categorycode'}<BR>
107 Area: $data->{'area'}<BR>
108 Fee:$30/year, Paid<BR>
109 Joined: $data->{'dateenrolled'}, Expires: $data->{'expiry'} <BR>
110 Joining Branch: $data->{'homebranch'}<P>
111 Ethnicity: $data->{'ethnicity'}, $data->{'ethnotes'}<BR>
112 DoB: $data->{'dateofbirth'}<BR>
113 Sex: $data->{'sex'}<P>
114
115 Alternative Contact:$data->{'contactname'}<BR>
116 Phone: $data->{'altphone'}<BR>
117 Relationship: $data->{'altrelationship'}<BR>
118 Notes: $data->{'altnotes'}<P>
119 printend
120 ;
5849a03 Fix so that reserves are only showing for the biblioitem not the bibl…
rangi authored
121
122 if ($data->{'categorycode'} ne 'C'){
123 print " Guarantees:";
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
124 # FIXME
125 # It looks like the $i is only being returned to handle walking through
126 # the array, which is probably better done as a foreach loop.
127 #
5849a03 Fix so that reserves are only showing for the biblioitem not the bibl…
rangi authored
128 my ($count,$guarantees)=findguarantees($data->{'borrowernumber'});
129 for (my $i=0;$i<$count;$i++){
130 print "<A HREF=\"/cgi-bin/koha/moremember.pl?bornum=$guarantees->[$i]->{'borrowernumber'}\">$guarantees->[$i]->{'cardnumber'}</a><br>";
131 }
132 } else {
133 print "Guarantor:";
134 my ($guarantor)=findguarantor($data->{'borrowernumber'});
135 if ($guarantor->{'borrowernumber'} == 0){
136 print "no guarantor<br>";
137 } else {
138 print "<A HREF=\"/cgi-bin/koha/moremember.pl?bornum=$guarantor->{'borrowernumber'}\">$guarantor->{'cardnumber'}</a><br>";
139 }
d0374d0 Initial revision
rangi authored
140 }
141 print <<printend
142
143
144 <P>
145
d413475 Got a link from items on issue thru to item details (like in the circ…
rangi authored
146 General Notes: <!--<A HREF="popbox.html" onclick="messenger(200,250,'Form that lets you add to and delete notes.'); return false">-->
147 $data->{'borrowernotes'}<!--</a>-->
d0374d0 Initial revision
rangi authored
148 <p align=right>
149 <form action=/cgi-bin/koha/memberentry.pl method=post>
150 <input type=hidden name=bornum value=$bornum>
60debf9 Changing the form so it passes through a modify value to tell the scr…
rangi authored
151 <INPUT TYPE="image" name="modify" VALUE="modify" height=42 WIDTH=93 BORDER=0 src="/images/modify-mem.gif">
d0374d0 Initial revision
rangi authored
152
60debf9 Changing the form so it passes through a modify value to tell the scr…
rangi authored
153 <INPUT TYPE="image" name="delete" VALUE="delete" height=42 WIDTH=93 BORDER=0 src="/images/delete-mem.gif">
d0374d0 Initial revision
rangi authored
154 </p>
155
156 </TD>
157 </TR>
158 </TABLE>
159 </FORM>
160 <img src="/images/holder.gif" width=16 height=800 align=left>
161 <TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
162 <TR VALIGN=TOP>
163 <td bgcolor="99cc33" background="/images/background-mem.gif" colspan=4><B>FINES & CHARGES</TD></TR>
164 printend
165 ;
166 my %bor;
167 $bor{'borrowernumber'}=$bornum;
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
168
169 # FIXME
170 # it looks like $numaccts is a temp variable and that the
171 # for (my $i;$i<$numaccts;$i+++)
172 # can be turned into a foreach loop instead
173 #
d0374d0 Initial revision
rangi authored
174 my ($numaccts,$accts,$total)=getboracctrecord('',\%bor);
175 #if ($numaccts > 10){
176 # $numaccts=10;
177 #}
178 for (my$i=0;$i<$numaccts;$i++){
179 #if ($accts->[$i]{'accounttype'} ne 'Pay'){
180 my $amount= $accts->[$i]{'amount'} + 0.00;
181 my $amount2= $accts->[$i]{'amountoutstanding'} + 0.00;
ce15a83 Turned off the tidy accounts feature in the view accounts screen
rangi authored
182 if ($amount2 != 0){
d0374d0 Initial revision
rangi authored
183 print "<tr VALIGN=TOP >";
184 my $item=" &nbsp; ";
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
185
186 $accts->[$i]{'date'} = slashifyDate($accts->[$i]{'date'});
187
d0374d0 Initial revision
rangi authored
188 if ($accts->[$i]{'accounttype'} ne 'Res'){
189 #get item data
190 #$item=
191 }
192 print "<td>$accts->[$i]{'date'}</td>";
193 # print "<TD>$accts->[$i]{'accounttype'}</td>";
60debf9 Changing the form so it passes through a modify value to tell the scr…
rangi authored
194 print "<TD>";
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
195
196 # FIXME
197 # why set this variable if it's not going to be used?
198 #
60debf9 Changing the form so it passes through a modify value to tell the scr…
rangi authored
199 my $env;
200 if ($accts->[$i]{'accounttype'} ne 'Res'){
201 my $iteminfo=C4::Circulation::Circ2::getiteminformation($env,$accts->[$i]->{'itemnumber'},'');
202 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>";
203 }
204 print "</td>
d0374d0 Initial revision
rangi authored
205 <TD>$amount</td><td>$amount2</td>
206 </tr>";
207 }
208 }
209 print <<printend
210
211 <tr VALIGN=TOP >
212 <TD colspan=3 align=right>
213 <nobr>
214 <a href=/cgi-bin/koha/boraccount.pl?bornum=$bornum><img height=42 WIDTH=187 BORDER=0 src="/images/view-account.gif"></a>
215 <a href=/cgi-bin/koha/pay.pl?bornum=$bornum><img height=42 WIDTH=187 BORDER=0 src="/images/pay-fines.gif"></a></nobr>
216 </td>
217
218 </tr>
219
220
221 </table>
222
223 <p>
224 <form action="renewscript.pl" method=post>
225 <input type=hidden name=bornum value=$bornum>
226 <TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
227
228 <TR VALIGN=TOP>
229
230 <td bgcolor="99cc33" background="/images/background-mem.gif" colspan=6><B>ITEMS CURRENTLY ON ISSUE</b></TD>
231 </TR>
232
233 <TR VALIGN=TOP>
234 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Title</b></TD>
235 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Due</b></TD>
236 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Itemtype</b></TD>
237 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Charge</b></TD>
238 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Renew</b></TD>
239 </TR>
240 printend
241 ;
242 my ($count,$issue)=borrissues($bornum);
243 my $today=ParseDate('today');
244 for (my $i=0;$i<$count;$i++){
245 print "<tr VALIGN=TOP >
246 <TD>";
247 my $datedue=ParseDate($issue->[$i]{'date_due'});
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
248
249 $issue->[$i]{'date_due'} = slashifyDate($issue->[$i]{'date_due'});
250
d0374d0 Initial revision
rangi authored
251 if ($datedue < $today){
252 print "<font color=red>";
253 }
d413475 Got a link from items on issue thru to item details (like in the circ…
rangi authored
254 print "$issue->[$i]{'title'}
255 <a href=/cgi-bin/koha/moredetail.pl?item=$issue->[$i]->{'itemnumber'}&bib=$issue->[$i]->{'biblionumber'}&bi=$issue->[$i]->{'biblioitemnumber'}>
256 $issue->[$i]{'barcode'}</a></td>
d0374d0 Initial revision
rangi authored
257 <TD>$issue->[$i]{'date_due'}</td>";
258 #find the charge for an item
259 my ($charge,$itemtype)=calc_charges(\%env,$issue->[$i]{'itemnumber'},$bornum);
260 print "<TD>$itemtype</td>";
261 print "<TD>$charge</td>";
262
263 # if ($datedue < $today){
264 # print "<td>Overdue</td>";
265 # } else {
266 # print "<td> &nbsp; </td>";
267 # }
268 #check item is not reserved
204ff64 Getting Iteminfo in Search to only display correct reserves (mainly u…
rangi authored
269 my ($rescount,$reserves)=Findgroupreserve($issue->[$i]{'biblioitemnumber'},$issue->[$i]{'biblionumber'});
d0374d0 Initial revision
rangi authored
270 if ($rescount >0){
58a8ef5 Changed it so you cant renew a book that is on request, made a link from
rangi authored
271 print "<TD><a href=/cgi-bin/koha/request.pl?bib=$issue->[$i]{'biblionumber'}>On Request - no renewals</a></td></tr>";
d8c989a Commenting out the code that doesnt allow renewals if a renewal has a…
rangi authored
272 # } elsif ($issue->[$i]->{'renewals'} > 0) {
273 # print "<TD>Previously Renewed - no renewals</td></tr>";
d0374d0 Initial revision
rangi authored
274 } else {
275 print "<TD>";
58a8ef5 Changed it so you cant renew a book that is on request, made a link from
rangi authored
276
d0374d0 Initial revision
rangi authored
277 print "<input type=radio name=\"renew_item_$issue->[$i]{'itemnumber'}\" value=y>Y
278 <input type=radio name=\"renew_item_$issue->[$i]{'itemnumber'}\" value=n>N</td>
279 </tr>
280 ";
58a8ef5 Changed it so you cant renew a book that is on request, made a link from
rangi authored
281 }
d0374d0 Initial revision
rangi authored
282 }
283 print <<printend
284
285 <tr VALIGN=TOP >
286 <TD colspan=5 align=right>
287 <INPUT TYPE="image" name="submit" VALUE="update" height=42 WIDTH=187 BORDER=0 src="/images/update-renewals.gif">
288 </td>
289 </form>
290 </tr>
291
292
293 </table>
294
295
296 <P>
297
298 <TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
299
300 <TR VALIGN=TOP>
301
302 <td bgcolor="99cc33" background="/images/background-mem.gif" colspan=5><B>ITEMS REQUESTED</b></TD>
303 </TR>
304
305 <TR VALIGN=TOP>
306
307 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Title</b></TD>
308 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Requested</b></TD>
309
310
311 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Charge</b></TD>
312
313 <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Remove</b></TD>
314 </TR>
315 <form action=/cgi-bin/koha/modrequest.pl method=post>
316 <input type=hidden name=from value=borrower>
317 printend
318 ;
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
319
d0374d0 Initial revision
rangi authored
320 my ($rescount,$reserves)=FindReserves('',$bornum); #From C4::Reserves2
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
321
322 # FIXME
323 # does it make sense to turn this into a foreach my $i (0..$rescount)
324 # kind of loop?
325 #
d0374d0 Initial revision
rangi authored
326 for (my $i=0;$i<$rescount;$i++){
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
327 $reserves->[$i]{'reservedate'} = slashifyDate($reserves->[$i]{'reservedate'});
328
d0374d0 Initial revision
rangi authored
329 print "<tr VALIGN=TOP >
5849a03 Fix so that reserves are only showing for the biblioitem not the bibl…
rangi authored
330 <TD><a href=\"/cgi-bin/koha/request.pl?bib=$reserves->[$i]{'biblionumber'}\">$reserves->[$i]{'btitle'}</a></td>
d0374d0 Initial revision
rangi authored
331 <TD>$reserves->[$i]{'reservedate'}</td>
332 <input type=hidden name=biblio value=$reserves->[$i]{'biblionumber'}>
333 <input type=hidden name=borrower value=$bornum>
334 <TD></td>
335 <TD><select name=\"rank-request\">
336 <option value=n>No
337 <option value=del>Yes
338 </select>
339 </tr>
340 ";
341 }
342 print <<printend
343
344 <tr VALIGN=TOP >
345 <TD colspan=5 align=right>
346 <INPUT TYPE="image" name="submit" VALUE="update" height=42 WIDTH=187 BORDER=0 src="/images/cancel-requests.gif"></td>
347 </tr>
348 </table>
349 </form>
350 <p align=right>
351 <a href=/cgi-bin/koha/readingrec.pl?bornum=$bornum><img height=42 WIDTH=187 BORDER=0 src="/images/reading-record.gif"></a>
352 </p>
353 printend
354 ;
355
356
357 print endmenu('member');
358 print endpage();
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
359
360
Something went wrong with that request. Please try again.