3 #script to add an order into the system
4 #written 29/2/00 by chris@katipo.co.nz
6 # Copyright 2000-2002 Katipo Communications
8 # This file is part of Koha.
10 # Koha is free software; you can redistribute it and/or modify it under the
11 # terms of the GNU General Public License as published by the Free Software
12 # Foundation; either version 2 of the License, or (at your option) any later
15 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
16 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License along with
20 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
21 # Suite 330, Boston, MA 02111-1307 USA
31 use C4::Interface::CGI::Output;
39 # get_template_and_user used only to check auth & get user id
40 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
42 template_name => "acqui/order.tmpl",
46 flagsrequired => { acquisition => 1 },
52 my $ordnum = $input->param('ordnum');
53 my $basketno = $input->param('basketno');
54 my $booksellerid = $input->param('booksellerid');
56 $input->param('existing'); # existing biblio, (not basket or order)
57 my $title = $input->param('title');
58 my $author = $input->param('author');
59 my $copyrightdate = $input->param('copyrightdate');
60 my $isbn = $input->param('ISBN');
61 my $itemtype = $input->param('format');
62 my $quantity = $input->param('quantity');
63 my $listprice = $input->param('list_price');
64 if ( $listprice eq '' ) {
67 my $series = $input->param('Series');
69 # my $supplier=$input->param('supplier');
70 my $notes = $input->param('notes');
71 my $bookfund = $input->param('bookfund');
72 my $sort1 = $input->param('sort1');
73 my $sort2 = $input->param('sort2');
74 my $rrp = $input->param('rrp');
75 my $ecost = $input->param('ecost');
76 my $gst = $input->param('GST');
77 my $budget = $input->param('budget');
78 my $cost = $input->param('cost');
79 my $sub = $input->param('sub');
80 my $invoice = $input->param('invoice');
81 my $publishercode = $input->param('publishercode');
82 my $suggestionid = $input->param('suggestionid');
84 # create, modify or delete biblio
85 # create if $quantity>=0 and $existing='no'
86 # modify if $quantity>=0 and $existing='yes'
87 # delete if $quantity has been se to 0 by the librarian
90 if ( $quantity ne '0' ) {
92 #check to see if biblio exists
93 if ( $existing eq 'no' ) {
95 #if it doesnt create it
98 title => $title ? $title : "",
99 author => $author ? $author : "",
100 copyrightdate => $copyrightdate ? $copyrightdate : "",
101 series => $series ? $series : "",
104 $bibitemnum = &newbiblioitem(
106 biblionumber => $bibnum,
107 itemtype => $itemtype ? $itemtype : "",
108 isbn => $isbn ? $isbn : "",
109 publishercode => $publishercode ? $publishercode : "",
113 # change suggestion status if applicable
115 changestatus( $suggestionid, 'ORDERED', '', $bibnum );
119 $bibnum = $input->param('biblio');
120 $bibitemnum = $input->param('bibitemnum');
121 my $oldtype = $input->param('oldtype');
125 # warn "MODORDER $title / $ordnum / $quantity / $bookfund";
127 $title, $ordnum, $quantity, $listprice,
128 $bibnum, $basketno, $booksellerid, $loggedinuser,
129 $notes, $bookfund, $bibitemnum, $rrp,
130 $ecost, $gst, $budget, $cost,
131 $invoice, $sort1, $sort2
136 # warn "new order : ";
137 $basketno = neworder(
138 $basketno, $bibnum, $title, $quantity,
139 $listprice, $booksellerid, $loggedinuser, $notes,
140 $bookfund, $bibitemnum, $rrp, $ecost,
141 $gst, $budget, $cost, $sub,
142 $invoice, $sort1, $sort2
147 $bibnum = $input->param('biblio');
148 delorder( $bibnum, $ordnum );
150 print $input->redirect("basket.pl?basket=$basketno");