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 $query="Select itemtype,description from itemtypes order by description";
82 my $sth=$dbh->prepare($query);
87 $itemtypes{''} = "Please choose";
88 while (my ($value,$lib) = $sth->fetchrow_array) {
89 push @itemtype, $value;
90 $itemtypes{$value}=$lib;
93 my $CGIitemtype=CGI::scrolling_list( -name => 'format',
94 -values => \@itemtype,
95 -default => $data->{'itemtype'},
96 -labels => \%itemtypes,
104 my ($count2,@branches)=branches();
105 for (my $i=0;$i<$count2;$i++){
106 push @select_branch, $branches[$i]->{'branchcode'};#
107 $select_branches{$branches[$i]->{'branchcode'}} = $branches[$i]->{'branchname'};
109 my $CGIbranch=CGI::scrolling_list( -name => 'branch',
110 -values => \@select_branch,
111 -default => $data->{'branchcode'},
112 -labels => \%select_branches,
116 my $auto_barcode = C4::Context->boolean_preference("autoBarcode") || 0;
117 # See whether barcodes should be automatically allocated.
118 # Defaults to 0, meaning "no".
120 if ($auto_barcode eq '1') {
121 $sth=$dbh->prepare("Select max(barcode) from items");
123 my $data=$sth->fetchrow_hashref;
124 $barcode = $data->{'barcode'}+1;
130 my %select_bookfunds;
131 ($count2,@bookfund)=bookfunds();
132 for (my $i=0;$i<$count2;$i++){
133 push @select_bookfund, $bookfund[$i]->{'bookfundid'};
134 $select_bookfunds{$bookfund[$i]->{'bookfundid'}} = $bookfund[$i]->{'bookfundname'}
136 my $CGIbookfund=CGI::scrolling_list( -name => 'bookfund',
137 -values => \@select_bookfund,
138 -default => $data->{'bookfundid'},
139 -labels => \%select_bookfunds,
143 $template->param( existing => $biblio,
149 biblioitemnumber => $data->{'biblioitemnumber'},
150 itemtype => $data->{'itemtype'},
151 discount => $booksellers[0]->{'discount'},
152 listincgst => $booksellers[0]->{'listincgst'},
153 listprice => $booksellers[0]->{'listprice'},
154 gstreg => $booksellers[0]->{'gstreg'},
155 name => $booksellers[0]->{'name'},
156 currency => $booksellers[0]->{'listprice'},
157 gstrate => C4::Context->preference("gist") ,
158 loop_currencies => \@loop_currency,
159 orderexists => ($new eq 'yes')?0:1,
160 title => $data->{'title'},
161 author => $data->{'author'},
162 copyrightdate => $data->{'copyrightdate'},
163 CGIitemtype => $CGIitemtype,
164 CGIbranch => $CGIbranch,
165 CGIbookfund => $CGIbookfund,
166 isbn => $data->{'isbn'},
167 seriestitle => $data->{'seriestitle'},
168 quantity => $data->{'quantity'},
169 listprice => $data->{'listprice'},
170 rrp => $data->{'rrp'},
171 ecost => $data->{'ecost'},
172 notes => $data->{'notes'},
173 barcode => $data->{'barcode'},);
175 output_html_with_http_headers $input, $cookie, $template->output;