4 #script to show display basket of orders
6 # Copyright 2000-2002 Katipo Communications
7 # Copyright 2008-2009 BibLibre SARL
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 with
21 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
22 # Suite 330, Boston, MA 02111-1307 USA
29 this script shows the details for a bookseller given on input arg.
30 It allows to edit & save information about this bookseller.
37 To know the bookseller this script has to display details.
49 use C4
::Dates qw
/format_date /;
56 my $id = $query->param('supplierid');
57 my @booksellers = GetBookSellerFromId
($id) if $id;
58 my $count = scalar @booksellers;
59 my $op = $query->param('op') || "display";
60 my ($template, $loggedinuser, $cookie) = get_template_and_user
(
61 { template_name
=> "acqui/supplier.tmpl",
65 flagsrequired
=> { acquisition
=> 'vendors_manage' },
69 my $GST = $booksellers[0]->{'gstrate'} || C4
::Context
->preference("gist");
72 my @contracts = GetContracts
($id);
73 my $contractcount = scalar(@contracts);
74 $template->param(hascontracts
=> 1) if ($contractcount > 0);
76 #build array for currencies
77 if ($op eq "display") {
80 my @contracts = @
{GetContract
( { booksellerid
=> $id } )};
84 $$_{contractstartdate
} = format_date
($$_{contractstartdate
});
85 $$_{contractenddate
} = format_date
($$_{contractenddate
});
90 name
=> $booksellers[0]->{'name'},
91 postal
=> $booksellers[0]->{'postal'},
92 address1
=> $booksellers[0]->{'address1'},
93 address2
=> $booksellers[0]->{'address2'},
94 address3
=> $booksellers[0]->{'address3'},
95 address4
=> $booksellers[0]->{'address4'},
96 phone
=> $booksellers[0]->{'phone'},
97 fax
=> $booksellers[0]->{'fax'},
98 url
=> $booksellers[0]->{'url'},
99 contact
=> $booksellers[0]->{'contact'},
100 contpos
=> $booksellers[0]->{'contpos'},
101 contphone
=> $booksellers[0]->{'contphone'},
102 contaltphone
=> $booksellers[0]->{'contaltphone'},
103 contfax
=> $booksellers[0]->{'contfax'},
104 contemail
=> $booksellers[0]->{'contemail'},
105 contnotes
=> $booksellers[0]->{'contnotes'},
106 notes
=> $booksellers[0]->{'notes'},
107 active
=> $booksellers[0]->{'active'},
108 gstreg
=> $booksellers[0]->{'gstreg'},
109 listincgst
=> $booksellers[0]->{'listincgst'},
110 invoiceincgst
=> $booksellers[0]->{'invoiceincgst'},
111 gstrate
=> $booksellers[0]->{'gstrate'}*100,
112 discount
=> $booksellers[0]->{'discount'},
113 invoiceprice
=> $booksellers[0]->{'invoiceprice'},
114 listprice
=> $booksellers[0]->{'listprice'},
116 basketcount
=> $booksellers[0]->{'basketcount'},
117 contracts
=> \
@contracts
120 elsif ($op eq 'delete') {
122 print $query->redirect("/cgi-bin/koha/acqui/acqui-home.pl");
125 my @currencies = GetCurrencies
();
126 my $count = scalar @currencies;
128 my @loop_pricescurrency;
129 my @loop_invoicecurrency;
130 for (my $i=0;$i<$count;$i++) {
131 if ($booksellers[0]->{'listprice'} eq $currencies[$i]->{'currency'}) {
132 push @loop_pricescurrency, { currency
=> "<option selected=\"selected\" value=\"$currencies[$i]->{'currency'}\">$currencies[$i]->{'currency'}</option>" };
134 push @loop_pricescurrency, { currency
=> "<option value=\"$currencies[$i]->{'currency'}\">$currencies[$i]->{'currency'}</option>"};
136 if ($booksellers[0]->{'invoiceprice'} eq $currencies[$i]->{'currency'}) {
137 push @loop_invoicecurrency, { currency
=> "<option selected=\"selected\" value=\"$currencies[$i]->{'currency'}\">$currencies[$i]->{'currency'}</option>"};
139 push @loop_invoicecurrency, { currency
=> "<option value=\"$currencies[$i]->{'currency'}\">$currencies[$i]->{'currency'}</option>"};
142 my $GST = $booksellers[0]->{'gstrate'} || C4
::Context
->preference("gist");
146 name
=> $booksellers[0]->{'name'},
147 postal
=> $booksellers[0]->{'postal'},
148 address1
=> $booksellers[0]->{'address1'},
149 address2
=> $booksellers[0]->{'address2'},
150 address3
=> $booksellers[0]->{'address3'},
151 address4
=> $booksellers[0]->{'address4'},
152 phone
=> $booksellers[0]->{'phone'},
153 fax
=> $booksellers[0]->{'fax'},
154 url
=> $booksellers[0]->{'url'},
155 contact
=> $booksellers[0]->{'contact'},
156 contpos
=> $booksellers[0]->{'contpos'},
157 contphone
=> $booksellers[0]->{'contphone'},
158 contaltphone
=> $booksellers[0]->{'contaltphone'},
159 contfax
=> $booksellers[0]->{'contfax'},
160 contemail
=> $booksellers[0]->{'contemail'},
161 contnotes
=> $booksellers[0]->{'contnotes'},
162 notes
=> $booksellers[0]->{'notes'},
163 active
=> $id?
$booksellers[0]->{'active'}:1, # set active ON by default for supplier add (id empty for add)
164 gstreg
=> $booksellers[0]->{'gstreg'},
165 listincgst
=> $booksellers[0]->{'listincgst'},
166 invoiceincgst
=> $booksellers[0]->{'invoiceincgst'},
167 gstrate
=> $booksellers[0]->{'gstrate'}*100,
168 discount
=> $booksellers[0]->{'discount'},
169 loop_pricescurrency
=> \
@loop_pricescurrency,
170 loop_invoicecurrency
=> \
@loop_invoicecurrency,
178 output_html_with_http_headers
$query, $cookie, $template->output;