Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 194 lines (165 sloc) 6.206 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;
8663e9c calc_charges expects to be passed a database handler, this wasnt happ…
rangi authored
40 use C4::Database;
0379fec templatified
dnmeid authored
41 use HTML::Template;
8663e9c calc_charges expects to be passed a database handler, this wasnt happ…
rangi authored
42
43 my $dbh=C4Connect;
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
44
d0374d0 Initial revision
rangi authored
45 my $input = new CGI;
46
0379fec templatified
dnmeid authored
47 my $theme = $input->param('theme'); # only used if allowthemeoverride is set
48 my %tmpldata = pathtotemplate ( template => 'moremember.tmpl', theme => $theme );
49 my $template = HTML::Template->new(filename => $tmpldata{'path'}, die_on_bad_params => 0);
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
50
0379fec templatified
dnmeid authored
51 my $bornum=$input->param('bornum');
5e8ec73 moved ethnicity fixups into C4::Koha, eventually to be replaced with …
pate authored
52
d0374d0 Initial revision
rangi authored
53 #start the page and read in includes
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
54
0379fec templatified
dnmeid authored
55 my $data=borrdata('',$bornum);
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
56
57 $data->{'dateenrolled'} = slashifyDate($data->{'dateenrolled'});
58 $data->{'expiry'} = slashifyDate($data->{'expiry'});
59 $data->{'dateofbirth'} = slashifyDate($data->{'dateofbirth'});
60
5e8ec73 moved ethnicity fixups into C4::Koha, eventually to be replaced with …
pate authored
61 $data->{'ethnicity'} = fixEthnicity($data->{'ethnicity'});
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
62
5849a03 Fix so that reserves are only showing for the biblioitem not the bibl…
rangi authored
63 if ($data->{'categorycode'} eq 'C'){
64 my $data2=borrdata('',$data->{'guarantor'});
65 $data->{'streetaddress'}=$data2->{'streetaddress'};
66 $data->{'city'}=$data2->{'city'};
67 $data->{'physstreet'}=$data2->{'phystreet'};
68 $data->{'streetcity'}=$data2->{'streetcity'};
69 $data->{'phone'}=$data2->{'phone'};
70 $data->{'phoneday'}=$data2->{'phoneday'};
71 }
0379fec templatified
dnmeid authored
72
73
46c2ff9 Merged in optional ethnicity fix from rel-1-2
tonnesen authored
74 if ($data->{'ethnicity'} || $data->{'ethnotes'}) {
0379fec templatified
dnmeid authored
75 $template->param(printethnicityline => 1);
46c2ff9 Merged in optional ethnicity fix from rel-1-2
tonnesen authored
76 }
5849a03 Fix so that reserves are only showing for the biblioitem not the bibl…
rangi authored
77
78 if ($data->{'categorycode'} ne 'C'){
0379fec templatified
dnmeid authored
79 $template->param(isguarantee => 1);
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
80 # FIXME
81 # It looks like the $i is only being returned to handle walking through
82 # the array, which is probably better done as a foreach loop.
83 #
5849a03 Fix so that reserves are only showing for the biblioitem not the bibl…
rangi authored
84 my ($count,$guarantees)=findguarantees($data->{'borrowernumber'});
0379fec templatified
dnmeid authored
85 my @guaranteedata;
5849a03 Fix so that reserves are only showing for the biblioitem not the bibl…
rangi authored
86 for (my $i=0;$i<$count;$i++){
0379fec templatified
dnmeid authored
87 push (@guaranteedata, {borrowernumber => $guarantees->[$i]->{'borrowernumber'},
88 cardnumber => $guarantees->[$i]->{'cardnumber'}});
5849a03 Fix so that reserves are only showing for the biblioitem not the bibl…
rangi authored
89 }
0379fec templatified
dnmeid authored
90 $template->param(guaranteeloop => \@guaranteedata);
91
5849a03 Fix so that reserves are only showing for the biblioitem not the bibl…
rangi authored
92 } else {
93 my ($guarantor)=findguarantor($data->{'borrowernumber'});
0379fec templatified
dnmeid authored
94 unless ($guarantor->{'borrowernumber'} == 0){
95 $template->param(guarantorborrowernumber => $guarantor->{'borrowernumber'}, guarantorcardnumber => $guarantor->{'cardnumber'});
5849a03 Fix so that reserves are only showing for the biblioitem not the bibl…
rangi authored
96 }
d0374d0 Initial revision
rangi authored
97 }
98
99 my %bor;
100 $bor{'borrowernumber'}=$bornum;
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
101
102 # FIXME
103 # it looks like $numaccts is a temp variable and that the
104 # for (my $i;$i<$numaccts;$i+++)
105 # can be turned into a foreach loop instead
106 #
d0374d0 Initial revision
rangi authored
107 my ($numaccts,$accts,$total)=getboracctrecord('',\%bor);
108 #if ($numaccts > 10){
109 # $numaccts=10;
110 #}
0379fec templatified
dnmeid authored
111 my @accountdata;
d0374d0 Initial revision
rangi authored
112 for (my$i=0;$i<$numaccts;$i++){
113 my $amount= $accts->[$i]{'amount'} + 0.00;
0379fec templatified
dnmeid authored
114 my $amount2= $accts->[$i]{'amountoutstanding'} + 0.00;
115 my %row = %$accts->[$i];
ce15a83 Turned off the tidy accounts feature in the view accounts screen
rangi authored
116 if ($amount2 != 0){
0379fec templatified
dnmeid authored
117 my $item=" &nbsp; ";
118 $row{'date'} = slashifyDate($accts->[$i]{'date'});
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
119
d0374d0 Initial revision
rangi authored
120 if ($accts->[$i]{'accounttype'} ne 'Res'){
0379fec templatified
dnmeid authored
121 #get item data
122 #$item=
d0374d0 Initial revision
rangi authored
123 }
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
124
125 # FIXME
126 # why set this variable if it's not going to be used?
127 #
60debf9 Changing the form so it passes through a modify value to tell the scr…
rangi authored
128 my $env;
129 if ($accts->[$i]{'accounttype'} ne 'Res'){
130 my $iteminfo=C4::Circulation::Circ2::getiteminformation($env,$accts->[$i]->{'itemnumber'},'');
0379fec templatified
dnmeid authored
131 # FIXME, seems to me $iteminfo gets not defined
132 %row = (%row , %$iteminfo) if $iteminfo;
60debf9 Changing the form so it passes through a modify value to tell the scr…
rangi authored
133 }
d0374d0 Initial revision
rangi authored
134 }
0379fec templatified
dnmeid authored
135 push (@accountdata, \%row);
d0374d0 Initial revision
rangi authored
136 }
137
138 my ($count,$issue)=borrissues($bornum);
139 my $today=ParseDate('today');
0379fec templatified
dnmeid authored
140 my @issuedata;
d0374d0 Initial revision
rangi authored
141 for (my $i=0;$i<$count;$i++){
0379fec templatified
dnmeid authored
142 my $datedue=ParseDate($issue->[$i]{'date_due'});
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
143 $issue->[$i]{'date_due'} = slashifyDate($issue->[$i]{'date_due'});
0379fec templatified
dnmeid authored
144 my %row = %$issue->[$i];
d0374d0 Initial revision
rangi authored
145 if ($datedue < $today){
0379fec templatified
dnmeid authored
146 $row{'red'}=1; #print "<font color=red>";
d0374d0 Initial revision
rangi authored
147 }
148 #find the charge for an item
8663e9c calc_charges expects to be passed a database handler, this wasnt happ…
rangi authored
149 my ($charge,$itemtype)=calc_charges(undef,$dbh,$issue->[$i]{'itemnumber'},$bornum);
0379fec templatified
dnmeid authored
150 $row{'itemtype'}=$itemtype;
151 $row{'charge'}=$charge;
d0374d0 Initial revision
rangi authored
152
153 #check item is not reserved
ee9ee38 Fixed bug so that items appear as reserved only when they actually are!
finlayt authored
154 my ($restype,$reserves)=CheckReserves($issue->[$i]{'itemnumber'});
155 if ($restype){
58a8ef5 Changed it so you cant renew a book that is on request, made a link from
rangi authored
156 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
157 # } elsif ($issue->[$i]->{'renewals'} > 0) {
158 # print "<TD>Previously Renewed - no renewals</td></tr>";
d0374d0 Initial revision
rangi authored
159 } else {
0379fec templatified
dnmeid authored
160 $row{'norenew'}=0;
58a8ef5 Changed it so you cant renew a book that is on request, made a link from
rangi authored
161 }
0379fec templatified
dnmeid authored
162 push (@issuedata, \%row);
d0374d0 Initial revision
rangi authored
163 }
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
164
d0374d0 Initial revision
rangi authored
165 my ($rescount,$reserves)=FindReserves('',$bornum); #From C4::Reserves2
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
166
167 # FIXME
168 # does it make sense to turn this into a foreach my $i (0..$rescount)
169 # kind of loop?
170 #
0379fec templatified
dnmeid authored
171 my @reservedata;
d0374d0 Initial revision
rangi authored
172 for (my $i=0;$i<$rescount;$i++){
8663e9c calc_charges expects to be passed a database handler, this wasnt happ…
rangi authored
173 $reserves->[$i]{'reservedate2'} = slashifyDate($reserves->[$i]{'reservedate'});
174 my $restitle;
0379fec templatified
dnmeid authored
175 my %row = %$reserves->[$i];
8663e9c calc_charges expects to be passed a database handler, this wasnt happ…
rangi authored
176 if ($reserves->[$i]{'constrainttype'} eq 'o'){
0379fec templatified
dnmeid authored
177 $restitle=getreservetitle($reserves->[$i]{'biblionumber'},$reserves->[$i]{'borrowernumber'},$reserves->[$i]{'reservedate'},$reserves->[$i]{'timestamp'});
178 %row = (%row , %$restitle);
179 }
180 push (@reservedata, \%row);
d0374d0 Initial revision
rangi authored
181 }
182
0379fec templatified
dnmeid authored
183 $dbh->disconnect;
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
184
0379fec templatified
dnmeid authored
185 $template->param($data);
186 $template->param(startmenumember => join('', startmenu('member')),
187 endmenumember => join('', endmenu('member')),
188 bornum => $bornum,
189 accountloop => \@accountdata,
190 issueloop => \@issuedata,
191 reserveloop => \@reservedata);
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
192
0379fec templatified
dnmeid authored
193 print "Content-Type: text/html\n\n", $template->output;
Something went wrong with that request. Please try again.