Skip to content

HTTPS clone URL

Subversion checkout URL

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