3 #script to add a new item and to mark orders as received
4 #written 1/3/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
34 my $flagsrequired = { acquisitions => 1};
35 my ($loggedinuser, $cookie, $sessionID) = checkauth($input, 0, $flagsrequired);
36 my $user=$input->remote_user;
37 my $biblionumber = $input->param('biblionumber');
38 my $biblioitemnumber=$input->param('biblioitemnumber');
39 my $ordnum=$input->param('ordnum');
40 my $origquantityrec=$input->param('origquantityrec');
41 my $quantityrec=$input->param('quantityrec');
42 my $quantity=$input->param('quantity');
43 my $cost=$input->param('cost');
44 my $invoiceno=$input->param('invoice');
45 my $datereceived=$input->param('datereceived');
46 my $replacement=$input->param('rrp');
47 my $gst=$input->param('gst');
48 my $freight=$input->param('freight');
49 my $supplierid = $input->param('supplierid');
50 my @branch=$input->param('homebranch');
51 my @barcode=$input->param('barcode');
52 my @ccode=$input->param('ccode');
53 my @itemtype=$input->param('itemtype');
54 my @location=$input->param('location');
56 # if ($quantityrec != 0){
57 # $cost /= $quantityrec;
60 if ($quantityrec > $origquantityrec ) {
61 # save the quantity recieved.
62 $datereceived = ModReceiveOrder($biblionumber,$ordnum,$quantityrec,$user,$cost,$invoiceno,$freight,$replacement,undef,$datereceived);
63 # create items if the user has entered barcodes
64 # my @barcodes=split(/\,| |\|/,$barcode);
65 # foreach barcode provided, build the item MARC::Record and create the item
66 foreach my $bc (@barcode) {
67 my $itemRecord = TransformKohaToMarc({
68 "items.replacementprice" => $replacement,
69 "items.price" => $cost,
70 "items.booksellerid" => $supplierid,
71 "items.homebranch" => $branch[$cnt],
72 "items.holdingbranch" => $branch[$cnt],
73 "items.barcode" => $barcode[$cnt],
74 "items.ccode" => $ccode[$cnt],
75 "items.itype" => $itemtype[$cnt],
76 "items.location" => $location[$cnt],
77 "items.loan" => 0, });
78 AddItem($itemRecord,$biblionumber);
81 print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoice=$invoiceno&supplierid=$supplierid&freight=$freight&gst=$gst&datereceived=$datereceived");
83 # print $input->header;
84 # #delorder($biblionumber,$ordnum);
85 # print $input->redirect("/acquisitions/");