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
31 use C4::Interface::CGI::Output;
38 # get_template_and_user used only to check auth & get user id
39 my ($template, $loggedinuser, $cookie)
40 = get_template_and_user({template_name => "acqui/order.tmpl",
44 flagsrequired => {acquisition => 1},
48 my $existing=$input->param('existing');
49 my $title=$input->param('title');
50 my $author=$input->param('author');
51 my $copyright=$input->param('copyright');
52 my $isbn=$input->param('ISBN');
53 my $itemtype=$input->param('format');
54 my $ordnum=$input->param('ordnum');
55 my $basketno=$input->param('basket');
56 my $quantity=$input->param('quantity');
57 my $listprice=$input->param('list_price');
58 my $series=$input->param('Series');
59 if ($listprice eq ''){
62 my $supplier=$input->param('supplier');
63 my $notes=$input->param('notes');
64 my $bookfund=$input->param('bookfund');
65 my $who=$loggedinuser;
68 my $rrp=$input->param('rrp');
69 my $ecost=$input->param('ecost');
70 my $gst=$input->param('GST');
71 my $orderexists=$input->param('orderexists');
72 my $budget=$input->param('budget');
73 my $cost=$input->param('cost');
74 my$sub=$input->param('sub');
75 my $invoice=$input->param('invoice');
77 if ($quantity ne '0'){
78 #check to see if biblio exists
79 if ($existing eq 'no'){
80 #if it doesnt create it
81 $bibnum = &newbiblio({ title => $title?$title:"",
82 author => $author?$author:"",
83 copyright => $copyright?$copyright:"",
84 series => $series?$series:"",
86 $bibitemnum = &newbiblioitem({ biblionumber => $bibnum,
87 itemtype => $itemtype?$itemtype:"",
88 isbn => $isbn?$isbn:""
91 newsubtitle($bibnum,$title);
94 $bibnum=$input->param('biblio');
95 $bibitemnum=$input->param('bibitemnum');
96 my $oldtype=$input->param('oldtype');
97 if ($bibitemnum eq '' || $itemtype ne $oldtype){
98 $bibitemnum= &newbiblioitem({ biblionumber => $bibnum,
99 itemtype => $itemtype?$itemtype:"",
100 isbn => $isbn?$isbn:"" });
103 biblionumber => $bibnum,
104 title => $title?$title:"",
105 author => $author?$author:"",
106 copyrightdate => $copyright?$copyright:"",
107 series => $series?$series:"" });
109 if ($orderexists ne '') {
110 modorder($title,$ordnum,$quantity,$listprice,$bibnum,$basketno,$supplier,$who,$notes,$bookfund,$bibitemnum,$rrp,$ecost,$gst,$budget,$cost,$sub,$invoice);
112 neworder($bibnum,$title,$ordnum,$basketno,$quantity,$listprice,$supplier,$who,$notes,$bookfund,$bibitemnum,$rrp,$ecost,$gst,$budget,$cost,$sub,$invoice);
115 $bibnum=$input->param('biblio');
116 delorder($bibnum,$ordnum);
119 print $input->redirect("basket.pl?basket=$basketno");