3 #script to show display basket of orders
4 #written by chris@katipo.co.nz 24/2/2000
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 with
21 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
22 # Suite 330, Boston, MA 02111-1307 USA
31 use C4::Interface::CGI::Output;
36 my $id=$input->param('id');
37 my $title=$input->param('title');
38 my $author=$input->param('author');
39 my $copyright=$input->param('copyright');
40 my ($count,@booksellers)=bookseller($id);
41 my $ordnum=$input->param('ordnum');
42 my $biblio=$input->param('biblio');
43 my $basket=$input->param('basket');
46 my $dbh = C4::Context->dbh;
51 $data=bibdata($biblio);
53 if ($data->{'title'} eq ''){
54 $data->{'title'}=$title;
55 $data->{'author'}=$author;
56 $data->{'copyrightdate'}=$copyright;
59 $data=getsingleorder($ordnum);
60 $biblio=$data->{'biblionumber'};
62 my ($template, $loggedinuser, $cookie)
63 = get_template_and_user({template_name => "acqui/newbiblio.tmpl",
67 flagsrequired => {acquisition => 1},
71 #my ($count2,$currencies)=getcurrencies;
72 my ($count,$rates)=getcurrencies();
73 my @loop_currency = ();
74 for (my $i=0;$i<$count;$i++){
76 $line{currency} = $rates->[$i]->{'currency'};
77 $line{rate} = $rates->[$i]->{'rate'};
78 push @loop_currency, \%line;
81 my $sth=$dbh->prepare("Select itemtype,description from itemtypes order by description");
86 $itemtypes{''} = "Please choose";
87 while (my ($value,$lib) = $sth->fetchrow_array) {
88 push @itemtype, $value;
89 $itemtypes{$value}=$lib;
92 my $CGIitemtype=CGI::scrolling_list( -name => 'format',
93 -values => \@itemtype,
94 -default => $data->{'itemtype'},
95 -labels => \%itemtypes,
103 my ($count2,@branches)=branches();
104 for (my $i=0;$i<$count2;$i++){
105 push @select_branch, $branches[$i]->{'branchcode'};#
106 $select_branches{$branches[$i]->{'branchcode'}} = $branches[$i]->{'branchname'};
108 my $CGIbranch=CGI::scrolling_list( -name => 'branch',
109 -values => \@select_branch,
110 -default => $data->{'branchcode'},
111 -labels => \%select_branches,
115 my $auto_barcode = C4::Context->boolean_preference("autoBarcode") || 0;
116 # See whether barcodes should be automatically allocated.
117 # Defaults to 0, meaning "no".
119 if ($auto_barcode eq '1') {
120 $sth=$dbh->prepare("Select max(barcode) from items");
122 my $data=$sth->fetchrow_hashref;
123 $barcode = $data->{'barcode'}+1;
129 my %select_bookfunds;
130 ($count2,@bookfund)=bookfunds();
131 for (my $i=0;$i<$count2;$i++){
132 push @select_bookfund, $bookfund[$i]->{'bookfundid'};
133 $select_bookfunds{$bookfund[$i]->{'bookfundid'}} = $bookfund[$i]->{'bookfundname'}
135 my $CGIbookfund=CGI::scrolling_list( -name => 'bookfund',
136 -values => \@select_bookfund,
137 -default => $data->{'bookfundid'},
138 -labels => \%select_bookfunds,
142 $template->param( existing => $biblio,
148 biblioitemnumber => $data->{'biblioitemnumber'},
149 itemtype => $data->{'itemtype'},
150 discount => $booksellers[0]->{'discount'},
151 listincgst => $booksellers[0]->{'listincgst'},
152 listprice => $booksellers[0]->{'listprice'},
153 gstreg => $booksellers[0]->{'gstreg'},
154 name => $booksellers[0]->{'name'},
155 currency => $booksellers[0]->{'listprice'},
156 gstrate => C4::Context->preference("gist") ,
157 loop_currencies => \@loop_currency,
158 orderexists => ($new eq 'yes')?0:1,
159 title => $data->{'title'},
160 author => $data->{'author'},
161 copyrightdate => $data->{'copyrightdate'},
162 CGIitemtype => $CGIitemtype,
163 CGIbranch => $CGIbranch,
164 CGIbookfund => $CGIbookfund,
165 isbn => $data->{'isbn'},
166 seriestitle => $data->{'seriestitle'},
167 quantity => $data->{'quantity'},
168 listprice => $data->{'listprice'},
169 rrp => $data->{'rrp'},
170 ecost => $data->{'ecost'},
171 notes => $data->{'notes'},
172 barcode => $data->{'barcode'},
173 publishercode => $data->{'publishercode'});
175 output_html_with_http_headers $input, $cookie, $template->output;