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 use C4::Interface::CGI::Output;
39 # get_template_and_user used only to check auth & get user id
40 my ($template, $loggedinuser, $cookie)
41 = get_template_and_user({template_name => "acqui/order.tmpl",
45 flagsrequired => {acquisition => 1},
50 my $ordnum=$input->param('ordnum');
51 my $basketno=$input->param('basketno');
52 my $booksellerid = $input->param('booksellerid');
53 my $existing=$input->param('existing'); # existing biblio, (not basket or order)
54 my $title=$input->param('title');
55 my $author=$input->param('author');
56 my $copyrightdate=$input->param('copyrightdate');
57 my $isbn=$input->param('ISBN');
58 my $itemtype=$input->param('format');
59 my $quantity=$input->param('quantity');
60 my $listprice=$input->param('list_price');
61 if ($listprice eq ''){
64 my $series=$input->param('Series');
65 # my $supplier=$input->param('supplier');
66 my $notes=$input->param('notes');
67 my $bookfund=$input->param('bookfund');
68 my $sort1=$input->param('sort1');
69 my $sort2=$input->param('sort2');
70 my $rrp=$input->param('rrp');
71 my $ecost=$input->param('ecost');
72 my $gst=$input->param('GST');
73 my $budget=$input->param('budget');
74 my $cost=$input->param('cost');
75 my $sub=$input->param('sub');
76 my $invoice=$input->param('invoice');
77 my $publishercode = $input->param('publishercode');
78 my $suggestionid= $input->param('suggestionid');
80 # create, modify or delete biblio
81 # create if $quantity>=0 and $existing='no'
82 # modify if $quantity>=0 and $existing='yes'
83 # delete if $quantity has been se to 0 by the librarian
86 if ($quantity ne '0'){
87 #check to see if biblio exists
88 if ($existing eq 'no'){
89 #if it doesnt create it
90 $bibnum = &newbiblio({ title => $title?$title:"",
91 author => $author?$author:"",
92 copyrightdate => $copyrightdate?$copyrightdate:"",
93 series => $series?$series:"",
95 $bibitemnum = &newbiblioitem({ biblionumber => $bibnum,
96 itemtype => $itemtype?$itemtype:"",
97 isbn => $isbn?$isbn:"",
98 publishercode => $publishercode?$publishercode:"",
100 # change suggestion status if applicable
102 changestatus($suggestionid,'ORDERED','',$bibnum);
105 $bibnum=$input->param('biblio');
106 $bibitemnum=$input->param('bibitemnum');
107 my $oldtype=$input->param('oldtype');
110 # warn "MODORDER $title / $ordnum / $quantity / $bookfund";
111 modorder($title,$ordnum,$quantity,$listprice,$bibnum,$basketno,$booksellerid,$loggedinuser,$notes,$bookfund,$bibitemnum,$rrp,$ecost,$gst,$budget,$cost,$invoice,$sort1,$sort2);
113 # warn "new order : ";
114 $basketno=neworder($basketno,$bibnum,$title,$quantity,$listprice,$booksellerid,$loggedinuser,$notes,$bookfund,$bibitemnum,$rrp,$ecost,$gst,$budget,$cost,$sub,$invoice,$sort1,$sort2);
117 $bibnum=$input->param('biblio');
118 delorder($bibnum,$ordnum);
120 print $input->redirect("basket.pl?basket=$basketno");