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;
37 my $booksellerid=$input->param('booksellerid');
38 my $title=$input->param('title');
39 my $author=$input->param('author');
40 my $copyright=$input->param('copyright');
41 my ($count,@booksellers)=bookseller($booksellerid);
42 my $ordnum=$input->param('ordnum');
43 my $biblio=$input->param('biblio');
44 my $basketno=$input->param('basketno');
45 my $suggestionid = $input->param('suggestionid');
48 my $dbh = C4::Context->dbh;
49 if ($ordnum eq ''){ # create order
51 # $ordnum=newordernum;
53 $data=bibdata($biblio);
55 if ($suggestionid) { # get suggestion fields if applicable.
56 $data = getsuggestion($suggestionid);
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},
77 # get currencies (for change rates calcs if needed
78 my ($count,$rates)=getcurrencies();
79 my @loop_currency = ();
80 for (my $i=0;$i<$count;$i++){
82 $line{currency} = $rates->[$i]->{'currency'};
83 $line{rate} = $rates->[$i]->{'rate'};
84 push @loop_currency, \%line;
88 my $sth=$dbh->prepare("Select itemtype,description from itemtypes order by description");
92 while (my ($value,$lib) = $sth->fetchrow_array) {
93 push @itemtype, $value;
94 $itemtypes{$value}=$lib;
96 my $CGIitemtype=CGI::scrolling_list( -name => 'format',
97 -values => \@itemtype,
98 -default => $data->{'itemtype'},
99 -labels => \%itemtypes,
104 # build branches list
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 # build bookfund list
123 my %select_bookfunds;
124 ($count2,@bookfund)=bookfunds();
125 for (my $i=0;$i<$count2;$i++){
126 push @select_bookfund, $bookfund[$i]->{'bookfundid'};
127 $select_bookfunds{$bookfund[$i]->{'bookfundid'}} = $bookfund[$i]->{'bookfundname'}
129 my $CGIbookfund=CGI::scrolling_list( -name => 'bookfund',
130 -values => \@select_bookfund,
131 -default => $data->{'bookfundid'},
132 -labels => \%select_bookfunds,
137 $template->param( existing => $biblio,
140 basketno => $basketno,
141 booksellerid => $booksellerid,
142 suggestionid => $suggestionid,
144 biblioitemnumber => $data->{'biblioitemnumber'},
145 itemtype => $data->{'itemtype'},
146 discount => $booksellers[0]->{'discount'},
147 listincgst => $booksellers[0]->{'listincgst'},
148 listprice => $booksellers[0]->{'listprice'},
149 gstreg => $booksellers[0]->{'gstreg'},
150 name => $booksellers[0]->{'name'},
151 currency => $booksellers[0]->{'listprice'},
152 gstrate => C4::Context->preference("gist") ,
153 loop_currencies => \@loop_currency,
154 orderexists => ($new eq 'yes')?0:1,
155 title => $data->{'title'},
156 author => $data->{'author'},
157 copyrightdate => $data->{'copyrightdate'},
158 CGIitemtype => $CGIitemtype,
159 CGIbranch => $CGIbranch,
160 CGIbookfund => $CGIbookfund,
161 isbn => $data->{'isbn'},
162 seriestitle => $data->{'seriestitle'},
163 quantity => $data->{'quantity'},
164 listprice => $data->{'listprice'},
165 rrp => $data->{'rrp'},
166 ecost => $data->{'ecost'},
167 notes => $data->{'notes'},
168 sort1 => $data->{'sort1'},
169 sort2 => $data->{'sort2'},
170 publishercode => $data->{'publishercode'});
172 output_html_with_http_headers $input, $cookie, $template->output;