perltidy before next commit.
[koha.git] / acqui / supplier.pl
1 #!/usr/bin/perl
2
3 # $Id$
4
5 #script to show display basket of orders
6 #written by chris@katipo.co.nz 24/2/2000
7
8
9 # Copyright 2000-2002 Katipo Communications
10 #
11 # This file is part of Koha.
12 #
13 # Koha is free software; you can redistribute it and/or modify it under the
14 # terms of the GNU General Public License as published by the Free Software
15 # Foundation; either version 2 of the License, or (at your option) any later
16 # version.
17 #
18 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
19 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
20 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
21 #
22 # You should have received a copy of the GNU General Public License along with
23 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
24 # Suite 330, Boston, MA  02111-1307 USA
25
26 use C4::Auth;
27 use C4::Acquisition;
28 use C4::Biblio;
29 use C4::Output;
30 use CGI;
31 use C4::Interface::CGI::Output;
32 use C4::Database;
33 use HTML::Template;
34 use strict;
35
36 my $query=new CGI;
37 my $id=$query->param('supplierid');
38 my ($count,@booksellers)=bookseller($id);
39 my ($template, $loggedinuser, $cookie)
40     = get_template_and_user({template_name => "acqui/supplier.tmpl",
41                              query => $query,
42                              type => "intranet",
43                              authnotrequired => 0,
44                              flagsrequired => {acquisition => 1},
45                              debug => 1,
46                              });
47 #build array for currencies
48 my  ($count, $currencies) = &getcurrencies();
49 my @loop_pricescurrency;
50 my @loop_invoicecurrency;
51 for (my $i=0;$i<$count;$i++) {
52         if ($booksellers[0]->{'listprice'} eq $currencies->[$i]->{'currency'}) {
53                 push @loop_pricescurrency, { currency => "<option selected=\"selected\" value=\"$currencies->[$i]->{'currency'}\">$currencies->[$i]->{'currency'}</option>" };
54         } else {
55                 push @loop_pricescurrency, { currency => "<option value=\"$currencies->[$i]->{'currency'}\">$currencies->[$i]->{'currency'}</option>"};
56         }
57         if ($booksellers[0]->{'invoiceprice'} eq $currencies->[$i]->{'currency'}) {
58                 push @loop_invoicecurrency, { currency => "<option selected=\"selected\" value=\"$currencies->[$i]->{'currency'}\">$currencies->[$i]->{'currency'}</option>"};
59         } else {
60                 push @loop_invoicecurrency, { currency => "<option value=\"$currencies->[$i]->{'currency'}\">$currencies->[$i]->{'currency'}</option>"};
61         }
62 }
63 $template->param(id => $id,
64                                         name => $booksellers[0]->{'name'},
65                                         postal =>$booksellers[0]->{'postal'},
66                                         address1 => $booksellers[0]->{'address1'},
67                                         address2 => $booksellers[0]->{'address2'},
68                                         address3 => $booksellers[0]->{'address3'},
69                                         address4 => $booksellers[0]->{'address4'},
70                                         phone =>$booksellers[0]->{'phone'},
71                                         fax => $booksellers[0]->{'fax'},
72                                         url => $booksellers[0]->{'url'},
73                                         contact => $booksellers[0]->{'contact'},
74                                         contpos => $booksellers[0]->{'contpos'},
75                                         contphone => $booksellers[0]->{'contphone'},
76                                         contaltphone => $booksellers[0]->{'contaltphone'},
77                                         contfax => $booksellers[0]->{'contfax'},
78                                         contemail => $booksellers[0]->{'contemail'},
79                                         contnotes => $booksellers[0]->{'contnotes'},
80                                         active => $booksellers[0]->{'active'},
81                                         specialty => $booksellers[0]->{'specialty'},
82                                         gstreg => $booksellers[0]->{'gstreg'},
83                                         listincgst => $booksellers[0]->{'listincgst'},
84                                         invoiceincgst => $booksellers[0]->{'invoiceincgst'},
85                                         discount => $booksellers[0]->{'discount'},
86                                         loop_pricescurrency => \@loop_pricescurrency,
87                                         loop_invoicecurrency => \@loop_invoicecurrency,);
88
89 output_html_with_http_headers $query, $cookie, $template->output;