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');
51 my $author=$input->param('author');
52 $author=~ s/\'/\\\'/g;
53 my $copyright=$input->param('copyright');
54 my $isbn=$input->param('ISBN');
55 my $itemtype=$input->param('format');
56 my $ordnum=$input->param('ordnum');
57 my $basketno=$input->param('basket');
58 my $quantity=$input->param('quantity');
59 my $listprice=$input->param('list_price');
60 my $series=$input->param('Series');
61 if ($listprice eq ''){
64 my $supplier=$input->param('supplier');
65 my $notes=$input->param('notes');
66 my $bookfund=$input->param('bookfund');
67 my $who=$loggedinuser;
70 my $rrp=$input->param('rrp');
71 my $ecost=$input->param('ecost');
72 my $gst=$input->param('GST');
73 my $orderexists=$input->param('orderexists');
74 my $budget=$input->param('budget');
75 my $cost=$input->param('cost');
76 my$sub=$input->param('sub');
77 my $invoice=$input->param('invoice');
79 if ($quantity ne '0'){
80 #check to see if biblio exists
81 if ($existing eq 'no'){
82 #if it doesnt create it
83 $bibnum = &newbiblio({ title => $title?$title:"",
84 author => $author?$author:"",
85 copyright => $copyright?$copyright:"",
86 series => $series?$series:"",
88 $bibitemnum = &newbiblioitem({ biblionumber => $bibnum,
89 itemtype => $itemtype?$itemtype:"",
90 isbn => $isbn?$isbn:""
93 newsubtitle($bibnum,$title);
96 $bibnum=$input->param('biblio');
97 $bibitemnum=$input->param('bibitemnum');
98 my $oldtype=$input->param('oldtype');
99 if ($bibitemnum eq '' || $itemtype ne $oldtype){
100 $bibitemnum= &newbiblioitem({ biblionumber => $bibnum,
101 itemtype => $itemtype?$itemtype:"",
102 isbn => $isbn?$isbn:"" });
105 biblionumber => $bibnum,
106 title => $title?$title:"",
107 author => $author?$author:"",
108 copyrightdate => $copyright?$copyright:"",
109 series => $series?$series:"" });
111 if ($orderexists ne '') {
112 modorder($title,$ordnum,$quantity,$listprice,$bibnum,$basketno,$supplier,$who,$notes,$bookfund,$bibitemnum,$rrp,$ecost,$gst,$budget,$cost,$sub,$invoice);
114 neworder($bibnum,$title,$ordnum,$basketno,$quantity,$listprice,$supplier,$who,$notes,$bookfund,$bibitemnum,$rrp,$ecost,$gst,$budget,$cost,$sub,$invoice);
117 $bibnum=$input->param('biblio');
118 delorder($bibnum,$ordnum);
121 print $input->redirect("basket.pl?basket=$basketno");