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
33 use C4::Interface::CGI::Output;
38 my $id=$input->param('id');
39 my $title=$input->param('title');
40 my $author=$input->param('author');
41 my $copyright=$input->param('copyright');
42 my ($count,@booksellers)=bookseller($id);
43 my $ordnum=$input->param('ordnum');
44 my $biblio=$input->param('biblio');
45 my $basket=$input->param('basket');
48 my $dbh = C4::Context->dbh;
53 $data=bibdata($biblio);
55 if ($data->{'title'} eq ''){
56 $data->{'title'}=$title;
57 $data->{'author'}=$author;
58 $data->{'copyrightdate'}=$copyright;
61 $data=getsingleorder($ordnum);
62 $biblio=$data->{'biblionumber'};
64 my ($template, $loggedinuser, $cookie)
65 = get_template_and_user({template_name => "acqui/newbiblio.tmpl",
69 flagsrequired => {acquisition => 1},
73 #my ($count2,$currencies)=getcurrencies;
74 my ($count,$rates)=getcurrencies();
75 my @loop_currency = ();
76 for (my $i=0;$i<$count;$i++){
78 $line{currency} = $rates->[$i]->{'currency'};
79 $line{rate} = $rates->[$i]->{'rate'};
80 push @loop_currency, \%line;
83 my $query="Select itemtype,description from itemtypes order by description";
84 my $sth=$dbh->prepare($query);
89 $itemtypes{''} = "Please choose";
90 while (my ($value,$lib) = $sth->fetchrow_array) {
91 push @itemtype, $value;
92 $itemtypes{$value}=$lib;
95 my $CGIitemtype=CGI::scrolling_list( -name => 'format',
96 -values => \@itemtype,
97 -default => $data->{'itemtype'},
98 -labels => \%itemtypes,
106 my ($count2,@branches)=branches();
107 for (my $i=0;$i<$count2;$i++){
108 push @select_branch, $branches[$i]->{'branchcode'};#
109 $select_branches{$branches[$i]->{'branchcode'}} = $branches[$i]->{'branchname'};
111 my $CGIbranch=CGI::scrolling_list( -name => 'branch',
112 -values => \@select_branch,
113 -default => $data->{'branchcode'},
114 -labels => \%select_branches,
118 my $auto_barcode = C4::Context->boolean_preference("autoBarcode") || 0;
119 # See whether barcodes should be automatically allocated.
120 # Defaults to 0, meaning "no".
122 if ($auto_barcode eq '1') {
123 $sth=$dbh->prepare("Select max(barcode) from items");
125 my $data=$sth->fetchrow_hashref;
126 $barcode = $data->{'barcode'}+1;
132 my %select_bookfunds;
133 ($count2,@bookfund)=bookfunds();
134 for (my $i=0;$i<$count2;$i++){
135 push @select_bookfund, $bookfund[$i]->{'bookfundid'};
136 $select_bookfunds{$bookfund[$i]->{'bookfundid'}} = $bookfund[$i]->{'bookfundname'}
138 my $CGIbookfund=CGI::scrolling_list( -name => 'bookfund',
139 -values => \@select_bookfund,
140 -default => $data->{'bookfundid'},
141 -labels => \%select_bookfunds,
145 $template->param( existing => $biblio,
151 biblioitemnumber => $data->{'biblioitemnumber'},
152 itemtype => $data->{'itemtype'},
153 discount => $booksellers[0]->{'discount'},
154 listincgst => $booksellers[0]->{'listincgst'},
155 listprice => $booksellers[0]->{'listprice'},
156 gstreg => $booksellers[0]->{'gstreg'},
157 name => $booksellers[0]->{'name'},
158 currency => $booksellers[0]->{'listprice'},
159 gstrate => C4::Context->preference("gist") ,
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;