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