Fixing bug 450
[wip/koha-chris_n.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::Catalogue;
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 C4::Catalogue;
35 use strict;
36
37 my $query=new CGI;
38 my $id=$query->param('id');
39 my ($count,@booksellers)=bookseller($id);
40 my ($template, $loggedinuser, $cookie)
41     = get_template_and_user({template_name => "acqui/supplier.tmpl",
42                              query => $query,
43                              type => "intranet",
44                              authnotrequired => 0,
45                              flagsrequired => {acquisition => 1},
46                              debug => 1,
47                              });
48 #build array for currencies
49 my  ($count, $currencies) = &getcurrencies();
50 my @loop_pricescurrency;
51 my @loop_invoicecurrency;
52 for (my $i=0;$i<$count;$i++) {
53         if ($booksellers[0]->{'listprice'} eq $currencies->[$i]->{'currency'}) {
54                 push @loop_pricescurrency, { currency => "<option selected value=\"$currencies->[$i]->{'currency'}\">$currencies->[$i]->{'currency'}</option>" };
55         } else {
56                 push @loop_pricescurrency, { currency => "<option value=\"$currencies->[$i]->{'currency'}\">$currencies->[$i]->{'currency'}</option>"};
57         }
58         if ($booksellers[0]->{'invoiceprice'} eq $currencies->[$i]->{'currency'}) {
59                 push @loop_invoicecurrency, { currency => "<option selected value=\"$currencies->[$i]->{'currency'}\">$currencies->[$i]->{'currency'}</option>"};
60         } else {
61                 push @loop_invoicecurrency, { currency => "<option value=\"$currencies->[$i]->{'currency'}\">$currencies->[$i]->{'currency'}</option>"};
62         }
63 }
64 $template->param(id => $id,
65                                         name => $booksellers[0]->{'name'},
66                                         postal =>$booksellers[0]->{'postal'},
67                                         address1 => $booksellers[0]->{'address1'},
68                                         address2 => $booksellers[0]->{'address2'},
69                                         address3 => $booksellers[0]->{'address3'},
70                                         address4 => $booksellers[0]->{'address4'},
71                                         phone =>$booksellers[0]->{'phone'},
72                                         fax => $booksellers[0]->{'fax'},
73                                         url => $booksellers[0]->{'url'},
74                                         contact => $booksellers[0]->{'contact'},
75                                         contpos => $booksellers[0]->{'contpos'},
76                                         contphone => $booksellers[0]->{'contphone'},
77                                         contaltphone => $booksellers[0]->{'contaltphone'},
78                                         contfax => $booksellers[0]->{'contfax'},
79                                         contemail => $booksellers[0]->{'contemail'},
80                                         contnotes => $booksellers[0]->{'contnotes'},
81                                         active => $booksellers[0]->{'active'},
82                                         specialty => $booksellers[0]->{'specialty'},
83                                         gstreg => $booksellers[0]->{'gstreg'},
84                                         listincgst => $booksellers[0]->{'listincgst'},
85                                         invoiceincgst => $booksellers[0]->{'invoiceincgst'},
86                                         discount => $booksellers[0]->{'discount'},
87                                         loop_pricescurrency => \@loop_pricescurrency,
88                                         loop_invoicecurrency => \@loop_invoicecurrency,);
89
90 output_html_with_http_headers $query, $cookie, $template->output;