koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha/acqui addorder.pl


From: Mason James
Subject: [Koha-cvs] koha/acqui addorder.pl
Date: Wed, 07 Jun 2006 19:25:59 +0000

CVSROOT:        /sources/koha
Module name:    koha
Changes by:     Mason James <sushi>     06/06/07 19:25:59

Modified files:
        acqui          : addorder.pl 

Log message:
        slight change in receiveorder() call, added bookfund arg. bookfund now 
updated during receive for HLT.
        
        Mason's ACQ fixes from HLT-DEV , work in progress.
        
        Adding code to check existing orders in basket to avoid duplication of 
rows.
        
        Addorder() now allows the user to select whether: the bibitem for the 
order will be an existing bibitem, or a newly created  bibitem.
        
        adding back in the part the saves the edit page's changes.
        
        Fix for bug 3589, can now order and receive donations in one go.
        
        Fixing a bug, acquisitions wasnt making a new biblioitem when needed.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/acqui/addorder.pl?cvsroot=koha&r1=1.27&r2=1.28

Patches:
Index: addorder.pl
===================================================================
RCS file: /sources/koha/koha/acqui/addorder.pl,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- addorder.pl 7 Jun 2006 19:14:06 -0000       1.27
+++ addorder.pl 7 Jun 2006 19:25:59 -0000       1.28
@@ -32,6 +32,7 @@
 use C4::Database;
 use HTML::Template;
 
+#use Data::Dumper;
 #use Date::Manip;
 
 my $input = new CGI;
@@ -61,10 +62,11 @@
 my $itemtype      = $input->param('format');
 my $quantity      = $input->param('quantity');
 my $listprice     = $input->param('list_price');
+my $branch        = $input->param('branch');
 if ( $listprice eq '' ) {
     $listprice = 0;
 }
-my $series = $input->param('Series');
+my $series = $input->param('series');
 
 # my $supplier=$input->param('supplier');
 my $notes         = $input->param('notes');
@@ -80,6 +82,12 @@
 my $invoice       = $input->param('invoice');
 my $publishercode = $input->param('publishercode');
 my $suggestionid  = $input->param('suggestionid');
+my $donation      = $input->param('donation');
+my $user          = $input->remote_user;
+
+#warn "CREATEBIBITEM =  $input->param('createbibitem')";
+#warn Dumper $input->param('createbibitem');
+my $createbibitem = $input->param('createbibitem');
 
 # create, modify or delete biblio
 # create if $quantity>=0 and $existing='no'
@@ -115,10 +123,64 @@
             changestatus( $suggestionid, 'ORDERED', '', $bibnum );
         }
     }
+
+    elsif ( $createbibitem eq 'YES' ) {
+        $bibnum     = $input->param('biblio');
+        $bibitemnum = $input->param('bibitemnum');
+        $bibitemnum = &newbiblioitem(
+            {
+                biblionumber  => $bibnum,
+                itemtype      => $itemtype ? $itemtype : "",
+                isbn          => $isbn ? $isbn : "",
+                publishercode => $publishercode ? $publishercode : "",
+            }
+        );
+        &modbiblio(
+            {
+                biblionumber  => $bibnum,
+                title         => $title ? $title : "",
+                author        => $author ? $author : "",
+                copyrightdate => $copyrightdate ? $copyrightdate : "",
+                series        => $series ? $series : ""
+            }
+        );
+    }
+
+    # then attach it to an existing bib
+
     else {
+        warn "attaching to an existing bibitem";
+
         $bibnum     = $input->param('biblio');
+
+        # if we are moddig the bibitem, not creating it createbib wont be set,
+        #
+        if ($createbibitem) {
+            $bibitemnum = $createbibitem;
+        }
+        else {
         $bibitemnum = $input->param('bibitemnum');
+        }
+
         my $oldtype = $input->param('oldtype');
+        &modbibitem(
+            {
+                biblioitemnumber => $bibitemnum,
+                isbn             => $isbn,
+                publishercode    => $publishercode,
+                itemtype         =>
+                  $itemtype,    # added itemtype, not prev. being changed.
+            }
+        );
+        &modbiblio(
+            {
+                biblionumber  => $bibnum,
+                title         => $title ? $title : "",
+                author        => $author ? $author : "",
+                copyrightdate => $copyrightdate ? $copyrightdate : "",
+                series        => $series ? $series : ""
+            },
+        );
     }
     if ($ordnum) {
 
@@ -132,9 +194,7 @@
         );
     }
     else {
-
-        #      warn "new order : ";
-        $basketno = neworder(
+        ( $basketno, $ordnum ) = neworder(
             $basketno,  $bibnum,       $title,        $quantity,
             $listprice, $booksellerid, $loggedinuser, $notes,
             $bookfund,  $bibitemnum,   $rrp,          $ecost,
@@ -142,6 +202,26 @@
             $invoice,   $sort1,        $sort2
         );
     }
+    if ($donation) {
+        my $barcode  = $input->param('barcode');
+        my @barcodes = split( /\,| |\|/, $barcode );
+        my ($error)  = newitems(
+            {
+                biblioitemnumber => $bibitemnum,
+                biblionumber     => $bibnum,
+                replacementprice => $rrp,
+                price            => $cost,
+                booksellerid     => $booksellerid,
+                homebranch       => $branch,
+                loan             => 0
+            },
+            @barcodes
+        );
+        receiveorder(
+            $bibnum,  $ordnum, $quantity, $user, $cost,
+            $invoice, 0,       $bookfund, $rrp
+        );
+    }
 }
 else {
     $bibnum = $input->param('biblio');




reply via email to

[Prev in Thread] Current Thread [Next in Thread]