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 #print $input->header;
34 #print startmenu('acquisitions');
36 my $existing=$input->param('existing');
37 my $title=$input->param('title');
39 my $author=$input->param('author');
40 $author=~ s/\'/\\\'/g;
41 my $copyright=$input->param('copyright');
42 my $isbn=$input->param('ISBN');
43 my $itemtype=$input->param('format');
44 my $ordnum=$input->param('ordnum');
45 my $basketno=$input->param('basket');
46 my $quantity=$input->param('quantity');
47 my $listprice=$input->param('list_price');
48 my $series=$input->param('Series');
49 if ($listprice eq ''){
52 my $supplier=$input->param('supplier');
53 my $notes=$input->param('notes');
54 my $bookfund=$input->param('bookfund');
55 my $who=$input->remote_user;
58 my $rrp=$input->param('rrp');
59 my $ecost=$input->param('ecost');
60 my $gst=$input->param('GST');
61 my $orderexists=$input->param('orderexists');
63 print STDERR "quantity = $quantity // existing = $existing\n";
64 #check to see if biblio exists
65 if ($quantity ne '0'){
66 if ($existing eq 'no'){
67 #if it doesnt create it
68 $bibnum = &newbiblio({ title => $title?$title:"",
69 author => $author?$author:"",
70 copyright => $copyright?$copyright:"",
71 series => $series?$series:"",
73 $bibitemnum = &newbiblioitem({ biblionumber => $bibnum,
74 itemtype => $itemtype?$itemtype:"",
75 isbn => $isbn?$isbn:""
78 newsubtitle($bibnum,$title);
80 #unuseful (already added 4 line before
81 # modbiblio({ biblionumber => $bibnum,
82 # title => $title?$title:"",
83 # author => $author?$author:"",
84 # copyrightdate => $copyright?$copyright:"",
85 # series => $series?$series:"" });
87 print STDERR "inside loop\n";
88 $bibnum=$input->param('biblio');
89 $bibitemnum=$input->param('bibitemnum');
90 my $oldtype=$input->param('oldtype');
91 print STDERR "bibitemnum : $bibitemnum itemtype:$itemtype oldtype:$oldtype\n";
92 if ($bibitemnum eq '' || $itemtype ne $oldtype){
93 $bibitemnum= &newbiblioitem({ biblionumber => $bibnum,
94 itemtype => $itemtype?$itemtype:"",
95 isbn => $isbn?$isbn:"" });
96 print STDERR "newbiblioitem\n";
98 print STDERR "modbiblio\n";
100 biblionumber => $bibnum,
101 title => $title?$title:"",
102 author => $author?$author:"",
103 copyrightdate => $copyright?$copyright:"",
104 series => $series?$series:"" });
106 if ($orderexists ne '') {
107 modorder($title,$ordnum,$quantity,$listprice,$bibnum,$basketno,$supplier,$who,$notes,$bookfund,$bibitemnum,$rrp,$ecost,$gst);
109 neworder($bibnum,$title,$ordnum,$basketno,$quantity,$listprice,$supplier,$who,$notes,$bookfund,$bibitemnum,$rrp,$ecost,$gst);
112 $bibnum=$input->param('biblio');
113 delorder($bibnum,$ordnum);
116 print $input->redirect("newbasket.pl?id=$supplier&basket=$basketno");