Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 212 lines (181 sloc) 6.748 kb
d0374d0 Initial revision
rangi authored
1 #!/usr/bin/perl
2
7197a37 Added magic RCS comment.
arensb authored
3 # $Id$
4
5e8ec73 moved ethnicity fixups into C4::Koha, eventually to be replaced with …
pate authored
5 # script to do a borrower enquiry/bring up borrower details etc
6 # Displays all the details about a borrower
7 # written 20/12/99 by chris@katipo.co.nz
8 # last modified 21/1/2000 by chris@katipo.co.nz
7197a37 Added magic RCS comment.
arensb authored
9 # modified 31/1/2001 by chris@katipo.co.nz
5e8ec73 moved ethnicity fixups into C4::Koha, eventually to be replaced with …
pate authored
10 # to not allow items on request to be renewed
11 #
12 # needs html removed and to use the C4::Output more, but its tricky
13 #
14
1e67687 Added copyright statement to all .pl and .pm files
tonnesen authored
15
16 # Copyright 2000-2002 Katipo Communications
17 #
18 # This file is part of Koha.
19 #
20 # Koha is free software; you can redistribute it and/or modify it under the
21 # terms of the GNU General Public License as published by the Free Software
22 # Foundation; either version 2 of the License, or (at your option) any later
23 # version.
24 #
25 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
26 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
27 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
28 #
29 # You should have received a copy of the GNU General Public License along with
30 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
31 # Suite 330, Boston, MA 02111-1307 USA
32
d0374d0 Initial revision
rangi authored
33 use strict;
9d54a64 adding authentification with Auth.pm
tipaul authored
34 use C4::Auth;
dbca398 Merged with arensb-context branch: use C4::Context->dbh instead of
arensb authored
35 use C4::Context;
d0374d0 Initial revision
rangi authored
36 use C4::Output;
52a5fd4 Moved C4/Charset.pm to C4/Interface/CGI/Output.pm
acli authored
37 use C4::Interface::CGI::Output;
38 use C4::Interface::CGI::Template;
d0374d0 Initial revision
rangi authored
39 use CGI;
40 use C4::Search;
41 use Date::Manip;
b0ecedf *** empty log message ***
wolfpac444 authored
42 use C4::Date;
d0374d0 Initial revision
rangi authored
43 use C4::Reserves2;
44 use C4::Circulation::Renewals2;
60debf9 Changing the form so it passes through a modify value to tell the scr…
rangi authored
45 use C4::Circulation::Circ2;
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
46 use C4::Koha;
0379fec templatified
dnmeid authored
47 use HTML::Template;
8663e9c calc_charges expects to be passed a database handler, this wasnt happ…
rangi authored
48
dbca398 Merged with arensb-context branch: use C4::Context->dbh instead of
arensb authored
49 my $dbh = C4::Context->dbh;
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
50
d0374d0 Initial revision
rangi authored
51 my $input = new CGI;
52
9d54a64 adding authentification with Auth.pm
tipaul authored
53 my ($template, $loggedinuser, $cookie)
54 = get_template_and_user({template_name => "members/moremember.tmpl",
55 query => $input,
56 type => "intranet",
57 authnotrequired => 0,
58 flagsrequired => {borrowers => 1},
59 debug => 1,
60 });
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
61
0379fec templatified
dnmeid authored
62 my $bornum=$input->param('bornum');
5e8ec73 moved ethnicity fixups into C4::Koha, eventually to be replaced with …
pate authored
63
d0374d0 Initial revision
rangi authored
64 #start the page and read in includes
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
65
0379fec templatified
dnmeid authored
66 my $data=borrdata('',$bornum);
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
67
b31ff7e fixes for bug 246 (zipcode), 207 (display of institutional member) an…
tipaul authored
68 $template->param($data->{'categorycode'} => 1); # in template <TMPL_IF name="I"> => instutitional (A for Adult & C for children)
69
b0ecedf *** empty log message ***
wolfpac444 authored
70 $data->{'dateenrolled'} = format_date($data->{'dateenrolled'});
71 $data->{'expiry'} = format_date($data->{'expiry'});
72 $data->{'dateofbirth'} = format_date($data->{'dateofbirth'});
5edc7ef fixes for #207, 208, 211
tipaul authored
73 $data->{'IS_ADULT'} = ($data->{'categorycode'} ne 'I');
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
74
5e8ec73 moved ethnicity fixups into C4::Koha, eventually to be replaced with …
pate authored
75 $data->{'ethnicity'} = fixEthnicity($data->{'ethnicity'});
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
76
52a5fd4 Moved C4/Charset.pm to C4/Interface/CGI/Output.pm
acli authored
77 $data->{&expand_sex_into_predicate($data->{'sex'})} = 1;
78
5849a03 Fix so that reserves are only showing for the biblioitem not the bibl…
rangi authored
79 if ($data->{'categorycode'} eq 'C'){
b31ff7e fixes for bug 246 (zipcode), 207 (display of institutional member) an…
tipaul authored
80 my $data2=borrdata('',$data->{'guarantor'});
81 $data->{'streetaddress'}=$data2->{'streetaddress'};
82 $data->{'city'}=$data2->{'city'};
83 $data->{'physstreet'}=$data2->{'physstreet'};
84 $data->{'streetcity'}=$data2->{'streetcity'};
85 $data->{'phone'}=$data2->{'phone'};
86 $data->{'phoneday'}=$data2->{'phoneday'};
87 $data->{'zipcode'} = $data2->{'zipcode'};
5849a03 Fix so that reserves are only showing for the biblioitem not the bibl…
rangi authored
88 }
0379fec templatified
dnmeid authored
89
90
46c2ff9 Merged in optional ethnicity fix from rel-1-2
tonnesen authored
91 if ($data->{'ethnicity'} || $data->{'ethnotes'}) {
0379fec templatified
dnmeid authored
92 $template->param(printethnicityline => 1);
46c2ff9 Merged in optional ethnicity fix from rel-1-2
tonnesen authored
93 }
5849a03 Fix so that reserves are only showing for the biblioitem not the bibl…
rangi authored
94
95 if ($data->{'categorycode'} ne 'C'){
b31ff7e fixes for bug 246 (zipcode), 207 (display of institutional member) an…
tipaul authored
96 $template->param(isguarantee => 1);
97 # FIXME
98 # It looks like the $i is only being returned to handle walking through
99 # the array, which is probably better done as a foreach loop.
100 #
101 my ($count,$guarantees)=findguarantees($data->{'borrowernumber'});
102 my @guaranteedata;
103 for (my $i=0;$i<$count;$i++){
104 push (@guaranteedata, {borrowernumber => $guarantees->[$i]->{'borrowernumber'},
105 cardnumber => $guarantees->[$i]->{'cardnumber'},
106 name => $guarantees->[$i]->{'firstname'} . " " . $guarantees->[$i]->{'surname'}});
107 }
108 $template->param(guaranteeloop => \@guaranteedata);
7197a37 Added magic RCS comment.
arensb authored
109
5849a03 Fix so that reserves are only showing for the biblioitem not the bibl…
rangi authored
110 } else {
b31ff7e fixes for bug 246 (zipcode), 207 (display of institutional member) an…
tipaul authored
111 my ($guarantor)=findguarantor($data->{'borrowernumber'});
112 unless ($guarantor->{'borrowernumber'} == 0){
113 $template->param(guarantorborrowernumber => $guarantor->{'borrowernumber'}, guarantorcardnumber => $guarantor->{'cardnumber'});
114 }
d0374d0 Initial revision
rangi authored
115 }
116
117 my %bor;
118 $bor{'borrowernumber'}=$bornum;
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
119
120 # FIXME
7197a37 Added magic RCS comment.
arensb authored
121 # it looks like $numaccts is a temp variable and that the
122 # for (my $i;$i<$numaccts;$i++)
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
123 # can be turned into a foreach loop instead
124 #
d0374d0 Initial revision
rangi authored
125 my ($numaccts,$accts,$total)=getboracctrecord('',\%bor);
126 #if ($numaccts > 10){
127 # $numaccts=10;
128 #}
0379fec templatified
dnmeid authored
129 my @accountdata;
d0374d0 Initial revision
rangi authored
130 for (my$i=0;$i<$numaccts;$i++){
b31ff7e fixes for bug 246 (zipcode), 207 (display of institutional member) an…
tipaul authored
131 my $amount= $accts->[$i]{'amount'} + 0.00;
132 my $amount2= $accts->[$i]{'amountoutstanding'} + 0.00;
133 my %row = %$accts->[$i];
134 if ($amount2 != 0){
135 my $item=" &nbsp; ";
136 $row{'date'} = format_date($accts->[$i]{'date'});
137
138 if ($accts->[$i]{'accounttype'} ne 'Res'){
139 #get item data
140 #$item=
141 }
142
143 # FIXME
144 # why set this variable if it's not going to be used?
145 #
146 my $env;
147 if ($accts->[$i]{'accounttype'} ne 'Res'){
148 my $iteminfo=C4::Circulation::Circ2::getiteminformation($env,$accts->[$i]->{'itemnumber'},'');
149 # FIXME, seems to me $iteminfo gets not defined
150 %row = (%row , %$iteminfo) if $iteminfo;
151 }
152 }
153 push (@accountdata, \%row);
d0374d0 Initial revision
rangi authored
154 }
155
156 my ($count,$issue)=borrissues($bornum);
157 my $today=ParseDate('today');
0379fec templatified
dnmeid authored
158 my @issuedata;
d0374d0 Initial revision
rangi authored
159 for (my $i=0;$i<$count;$i++){
b31ff7e fixes for bug 246 (zipcode), 207 (display of institutional member) an…
tipaul authored
160 my $datedue=ParseDate($issue->[$i]{'date_due'});
161 $issue->[$i]{'date_due'} = format_date($issue->[$i]{'date_due'});
162 my %row = %{$issue->[$i]};
163 if ($datedue < $today){
164 $row{'red'}=1; #print "<font color=red>";
165 }
166 #find the charge for an item
167 # FIXME - This is expecting
168 # &C4::Circulation::Renewals2::calc_charges, but it's getting
169 # &C4::Circulation::Circ2::calc_charges, which only returns one
170 # element, so itemtype isn't being set.
171 # But &C4::Circulation::Renewals2::calc_charges doesn't appear to
172 # return the correct item type either (or a properly-formatted
173 # charge, for that matter).
174 my ($charge,$itemtype)=calc_charges(undef,$dbh,$issue->[$i]{'itemnumber'},$bornum);
175 $row{'itemtype'}=$itemtype;
176 $row{'charge'}=$charge;
177
178 #check item is not reserved
179 my ($restype,$reserves)=CheckReserves($issue->[$i]{'itemnumber'});
180 if ($restype){
181 print "<TD><a href=/cgi-bin/koha/request.pl?bib=$issue->[$i]{'biblionumber'}>On Request - no renewals</a></td></tr>";
182 # } elsif ($issue->[$i]->{'renewals'} > 0) {
183 # print "<TD>Previously Renewed - no renewals</td></tr>";
184 } else {
185 $row{'norenew'}=0;
186 }
187 push (@issuedata, \%row);
d0374d0 Initial revision
rangi authored
188 }
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
189
d0374d0 Initial revision
rangi authored
190 my ($rescount,$reserves)=FindReserves('',$bornum); #From C4::Reserves2
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
191
0379fec templatified
dnmeid authored
192 my @reservedata;
8447974 fix for #187
tipaul authored
193 foreach my $reserveline (@$reserves) {
194 $reserveline->{'reservedate2'} = format_date($reserveline->{'reservedate'});
195 my $restitle;
196 my %row = %$reserveline;
197 if ($reserveline->{'constrainttype'} eq 'o'){
9f32a8a Bug fixes.
wolfpac444 authored
198 $restitle=getreservetitle($reserveline->{'biblionumber'},$reserveline->{'borrowernumber'},$reserveline->{'reservedate'},$reserveline->{'rtimestamp'});
e90b815 fix for #218
tipaul authored
199 %row = (%row , %$restitle) if $restitle;
8447974 fix for #187
tipaul authored
200 }
201 push (@reservedata, \%row);
d0374d0 Initial revision
rangi authored
202 }
203
0379fec templatified
dnmeid authored
204 $template->param($data);
e662ba2 Handle non-latin1 charsets
acli authored
205 $template->param(
0379fec templatified
dnmeid authored
206 bornum => $bornum,
207 accountloop => \@accountdata,
208 issueloop => \@issuedata,
209 reserveloop => \@reservedata);
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored
210
52a5fd4 Moved C4/Charset.pm to C4/Interface/CGI/Output.pm
acli authored
211 output_html_with_http_headers $input, $cookie, $template->output;
Something went wrong with that request. Please try again.