koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] koha/acqui addorder.pl [rel_3_0]


From: paul poulain
Subject: [Koha-cvs] koha/acqui addorder.pl [rel_3_0]
Date: Wed, 24 Jan 2007 13:43:47 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         rel_3_0
Changes by:     paul poulain <tipaul>   07/01/24 13:43:47

Modified files:
        acqui          : addorder.pl 

Log message:
        acquisitions bugfixes :
        * normalizing variable names (biblionumber instead of bibnum)
        * removing useless & outdated code ($donation)
        * API CHANGE : in acquisition, we created a small biblio, through a 
specific API in Biblio.pm. I changed this behaviour by :
        - creating a small MARC::Record 1st
        - calling the NewBiblio sub that will take care of all table filling.
        This is done through a new Biblio.pm sub "Koha2Marc", that get a hash 
as parameter, and returns a MARC::Record.
        
        NewBiblio should be the only entry to create biblio in Koha.
        Note to KATIPO : i have removed some feature that used to work in 1.2, 
but, afaik, are useless since 2.0
        Feel free to tell me if I have removed too many things...

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/acqui/addorder.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.33.2.4&r2=1.33.2.5

Patches:
Index: addorder.pl
===================================================================
RCS file: /sources/koha/koha/acqui/addorder.pl,v
retrieving revision 1.33.2.4
retrieving revision 1.33.2.5
diff -u -b -r1.33.2.4 -r1.33.2.5
--- addorder.pl 22 Dec 2006 15:02:56 -0000      1.33.2.4
+++ addorder.pl 24 Jan 2007 13:43:47 -0000      1.33.2.5
@@ -170,7 +170,6 @@
 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')";
@@ -181,138 +180,53 @@
 # create if $quantity>=0 and $existing='no'
 # modify if $quantity>=0 and $existing='yes'
 # delete if $quantity has been se to 0 by the librarian
-my $bibnum;
+my $biblionumber=$input->param('biblionumber');
 my $bibitemnum;
 if ( $quantity ne '0' ) {
-
     #check to see if biblio exists
     if ( $existing eq 'no' ) {
 
         #if it doesnt create it
-        $bibnum = &newbiblio(
-            {
-                title         => $title         ? $title         : "",
-                author        => $author        ? $author        : "",
-                copyrightdate => $copyrightdate ? $copyrightdate : "",
-                series        => $series        ? $series        : "",
-            }
-        );
-        $bibitemnum = &newbiblioitem(
+        my $record = Koha2Marc(
             {
-                biblionumber  => $bibnum,
-                itemtype      => $itemtype ? $itemtype : "",
-                isbn          => $isbn ? $isbn : "",
-                publishercode => $publishercode ? $publishercode : "",
-            }
-        );
+                "biblio.title"              => "$title",
+                "biblio.author"             => "$author",
+                "biblio.copyrightdate"      => $copyrightdate ? $copyrightdate 
: "",
+                "biblio.series"             => $series        ? $series        
: "",
+                "biblioitems.itemtype"      => $itemtype ? $itemtype : "",
+                "biblioitems.isbn"          => $isbn ? $isbn : "",
+                "biblioitems.publishercode" => $publishercode ? $publishercode 
: "",
+            });
+        # create the record in catalogue, with framework ''
+        ($biblionumber,$bibitemnum) = AddBiblio($record,'');
 
         # change suggestion status if applicable
         if ($suggestionid) {
-            ModStatus( $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.
+            ModStatus( $suggestionid, 'ORDERED', '', $biblionumber );
             }
-        );
-        &modbiblio(
-            {
-                biblionumber  => $bibnum,
-                title         => $title ? $title : "",
-                author        => $author ? $author : "",
-                copyrightdate => $copyrightdate ? $copyrightdate : "",
-                series        => $series ? $series : ""
-            },
-        );
     }
+    # if we already have $ordnum, then it's an ordermodif
     if ($ordnum) {
-
-        #              warn "MODORDER $title / $ordnum / $quantity / 
$bookfund";
         ModOrder(
             $title,   $ordnum,   $quantity,     $listprice,
-            $bibnum,  $basketno, $booksellerid, $loggedinuser,
+            $biblionumber,  $basketno, $booksellerid, $loggedinuser,
             $notes,   $bookfund, $bibitemnum,   $rrp,
             $ecost,   $gst,      $budget,       $cost,
             $invoice, $sort1,    $sort2
         );
     }
-    else {
+    else { # else, it's a new line
         ( $basketno, $ordnum ) = NewOrder(
-            $basketno,  $bibnum,       $title,        $quantity,
+            $basketno,  $biblionumber,       $title,        $quantity,
             $listprice, $booksellerid, $loggedinuser, $notes,
             $bookfund,  $bibitemnum,   $rrp,          $ecost,
             $gst,       $budget,       $cost,         $sub,
             $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
-        );
-        ModReceiveOrder(
-            $bibnum,  $ordnum, $quantity, $user, $cost,
-            $invoice, 0,       $bookfund, $rrp
-        );
-    }
 }
-else {
-    $bibnum = $input->param('biblio');
-    DelOrder( $bibnum, $ordnum );
+else { # qty=0, delete the line
+    $biblionumber = $input->param('biblionumber');
+    DelOrder( $biblionumber, $ordnum );
 }
 print $input->redirect("basket.pl?basketno=$basketno");




reply via email to

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