3 #written 11/1/2000 by chris@katipo.oc.nz
4 #script to display borrowers account details
7 # Copyright 2000-2002 Katipo Communications
9 # This file is part of Koha.
11 # Koha is free software; you can redistribute it and/or modify it under the
12 # terms of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
16 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
17 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
18 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License along
21 # with Koha; if not, write to the Free Software Foundation, Inc.,
22 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
37 my $borrowernumber=$input->param('borrowernumber');
40 # get borrower details
41 my $data=GetMember
('borrowernumber'=>$borrowernumber);
42 my $add=$input->param('add');
44 # print $input->header;
45 my $barcode=$input->param('barcode');
46 my $itemnum = GetItemnumberFromBarcode
($barcode) if $barcode;
47 my $desc=$input->param('desc');
48 my $amount=$input->param('amount');
49 my $type=$input->param('type');
50 my $error=manualinvoice
($borrowernumber,$itemnum,$desc,$type,$amount);
52 my ($template, $loggedinuser, $cookie)
53 = get_template_and_user
({template_name
=> "members/maninvoice.tmpl",
57 flagsrequired
=> {borrowers
=> 1},
60 if ($error =~ /FOREIGN KEY/ && $error =~ /itemnumber/){
61 $template->param('ITEMNUMBER' => 1);
63 $template->param('ERROR' => $error);
64 output_html_with_http_headers
$input, $cookie, $template->output;
67 print $input->redirect("/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber");
72 my ($template, $loggedinuser, $cookie)
73 = get_template_and_user
({template_name
=> "members/maninvoice.tmpl",
77 flagsrequired
=> {borrowers
=> 1, updatecharges
=> 1},
81 # get authorised values with type of MANUAL_INV
83 my $dbh = C4
::Context
->dbh;
84 my $sth = $dbh->prepare('SELECT * FROM authorised_values WHERE category = "MANUAL_INV"');
86 while ( my $row = $sth->fetchrow_hashref() ) {
87 push @invoice_types, $row;
89 $template->param( invoice_types_loop
=> \
@invoice_types );
91 if ( $data->{'category_type'} eq 'C') {
92 my ( $catcodes, $labels ) = GetborCatFromCatType
( 'A', 'WHERE category_type = ?' );
93 my $cnt = scalar(@
$catcodes);
94 $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1;
95 $template->param( 'catcode' => $catcodes->[0]) if $cnt == 1;
98 $template->param( adultborrower
=> 1 ) if ( $data->{'category_type'} eq 'A' );
99 my ($picture, $dberror) = GetPatronImage
($data->{'cardnumber'});
100 $template->param( picture
=> 1 ) if $picture;
103 borrowernumber
=> $borrowernumber,
104 firstname
=> $data->{'firstname'},
105 surname
=> $data->{'surname'},
106 cardnumber
=> $data->{'cardnumber'},
107 categorycode
=> $data->{'categorycode'},
108 category_type
=> $data->{'category_type'},
109 categoryname
=> $data->{'description'},
110 address
=> $data->{'address'},
111 address2
=> $data->{'address2'},
112 city
=> $data->{'city'},
113 zipcode
=> $data->{'zipcode'},
114 country
=> $data->{'country'},
115 phone
=> $data->{'phone'},
116 email
=> $data->{'email'},
117 branchcode
=> $data->{'branchcode'},
118 branchname
=> GetBranchName
($data->{'branchcode'}),
119 is_child
=> ($data->{'category_type'} eq 'C'),
121 output_html_with_http_headers
$input, $cookie, $template->output;