3 #script to add an order into the system
4 #written 29/2/00 by chris@katipo.co.nz
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
32 my $existing=$input->param('existing');
33 my $title=$input->param('title');
35 my $author=$input->param('author');
36 $author=~ s/\'/\\\'/g;
37 my $copyright=$input->param('copyright');
38 my $isbn=$input->param('ISBN');
39 my $itemtype=$input->param('format');
40 my $ordnum=$input->param('ordnum');
41 my $basketno=$input->param('basket');
42 my $quantity=$input->param('quantity');
43 my $listprice=$input->param('list_price');
44 my $series=$input->param('Series');
45 if ($listprice eq ''){
48 my $supplier=$input->param('supplier');
49 my $notes=$input->param('notes');
50 my $bookfund=$input->param('bookfund');
51 my $who=$input->remote_user;
54 my $rrp=$input->param('rrp');
55 my $ecost=$input->param('ecost');
56 my $gst=$input->param('GST');
57 my $orderexists=$input->param('orderexists');
59 if ($quantity ne '0'){
60 #check to see if biblio exists
61 if ($existing eq 'no'){
62 #if it doesnt create it
63 $bibnum = &newbiblio({ title => $title?$title:"",
64 author => $author?$author:"",
65 copyright => $copyright?$copyright:"",
66 series => $series?$series:"",
68 $bibitemnum = &newbiblioitem({ biblionumber => $bibnum,
69 itemtype => $itemtype?$itemtype:"",
70 isbn => $isbn?$isbn:""
73 newsubtitle($bibnum,$title);
76 $bibnum=$input->param('biblio');
77 $bibitemnum=$input->param('bibitemnum');
78 my $oldtype=$input->param('oldtype');
79 if ($bibitemnum eq '' || $itemtype ne $oldtype){
80 $bibitemnum= &newbiblioitem({ biblionumber => $bibnum,
81 itemtype => $itemtype?$itemtype:"",
82 isbn => $isbn?$isbn:"" });
85 biblionumber => $bibnum,
86 title => $title?$title:"",
87 author => $author?$author:"",
88 copyrightdate => $copyright?$copyright:"",
89 series => $series?$series:"" });
91 if ($orderexists ne '') {
92 modorder($title,$ordnum,$quantity,$listprice,$bibnum,$basketno,$supplier,$who,$notes,$bookfund,$bibitemnum,$rrp,$ecost,$gst);
94 neworder($bibnum,$title,$ordnum,$basketno,$quantity,$listprice,$supplier,$who,$notes,$bookfund,$bibitemnum,$rrp,$ecost,$gst);
97 $bibnum=$input->param('biblio');
98 delorder($bibnum,$ordnum);
101 print $input->redirect("basket.pl?basket=$basketno");