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
34 use C4::Interface::CGI::Output;
39 #print $input->header();
40 my $id=$input->param('id');
41 my $title=$input->param('title');
42 my $author=$input->param('author');
43 my $copyright=$input->param('copyright');
44 my ($count,@booksellers)=bookseller($id);
45 my $ordnum=$input->param('ordnum');
46 my $biblio=$input->param('biblio');
47 my $basket=$input->param('basket');
50 my $dbh = C4::Context->dbh;
56 $data=bibdata($biblio);
58 if ($data->{'title'} eq ''){
59 $data->{'title'}=$title;
60 $data->{'author'}=$author;
61 $data->{'copyrightdate'}=$copyright;
64 $data=getsingleorder($ordnum);
65 $biblio=$data->{'biblionumber'};
67 my ($template, $loggedinuser, $cookie)
68 = get_template_and_user({template_name => "acqui/newbiblio.tmpl",
72 flagsrequired => {acquisition => 1},
76 #my ($count2,$currencies)=getcurrencies;
77 my ($count,$rates)=getcurrencies();
78 my @loop_currency = ();
79 for (my $i=0;$i<$count;$i++){
81 $line{currency} = $rates->[$i]->{'currency'};
82 $line{rate} = $rates->[$i]->{'rate'};
83 push @loop_currency, \%line;
86 my $query="Select itemtype,description from itemtypes order by description";
87 my $sth=$dbh->prepare($query);
92 $itemtypes{''} = "Please choose";
93 while (my ($value,$lib) = $sth->fetchrow_array) {
94 push @itemtype, $value;
95 $itemtypes{$value}=$lib;
98 my $CGIitemtype=CGI::scrolling_list( -name => 'format',
99 -values => \@itemtype,
100 -default => $data->{'itemtype'},
101 -labels => \%itemtypes,
109 my ($count2,@branches)=branches();
110 for (my $i=0;$i<$count2;$i++){
111 push @select_branch, $branches[$i]->{'branchcode'};#
112 $select_branches{$branches[$i]->{'branchcode'}} = $branches[$i]->{'branchname'};
114 my $CGIbranch=CGI::scrolling_list( -name => 'branch',
115 -values => \@select_branch,
116 -default => $data->{'branchcode'},
117 -labels => \%select_branches,
121 my $auto_barcode = C4::Context->boolean_preference("autoBarcode") || 0;
122 # See whether barcodes should be automatically allocated.
123 # Defaults to 0, meaning "no".
125 if ($auto_barcode eq '1') {
126 $sth=$dbh->prepare("Select max(barcode) from items");
128 my $data=$sth->fetchrow_hashref;
129 $barcode = $data->{'barcode'}+1;
135 my %select_bookfunds;
136 ($count2,@bookfund)=bookfunds();
137 for (my $i=0;$i<$count2;$i++){
138 push @select_bookfund, $bookfund[$i]->{'bookfundid'};
139 $select_bookfunds{$bookfund[$i]->{'bookfundid'}} = $bookfund[$i]->{'bookfundname'}
141 my $CGIbookfund=CGI::scrolling_list( -name => 'bookfund',
142 -values => \@select_bookfund,
143 -default => $data->{'bookfundid'},
144 -labels => \%select_bookfunds,
148 $template->param( existing => $biblio,
154 biblioitemnumber => $data->{'biblioitemnumber'},
155 itemtype => $data->{'itemtype'},
156 discount => $booksellers[0]->{'discount'},
157 listingcst => $booksellers[0]->{'listincgst'},
158 listprice => $booksellers[0]->{'listprice'},
159 gstreg => $booksellers[0]->{'gstreg'},
160 name => $booksellers[0]->{'name'},
161 loop_currencies => \@loop_currency,
162 orderexists => ($new eq 'yes')?0:1,
163 title => $data->{'title'},
164 author => $data->{'author'},
165 copyrightdate => $data->{'copyrightdate'},
166 CGIitemtype => $CGIitemtype,
167 CGIbranch => $CGIbranch,
168 CGIbookfund => $CGIbookfund,
169 isbn => $data->{'isbn'},
170 seriestitle => $data->{'seriestitle'},
171 quantity => $data->{'quantity'},
172 listprice => $data->{'listprice'},
173 rrp => $data->{'rrp'},
174 ecost => $data->{'ecost'},
175 notes => $data->{'notes'},
176 barcode => $data->{'barcode'},);
178 output_html_with_http_headers $input, $cookie, $template->output;