[Koha-patches] [PATCH] kohabug 2139 Fixes C4::Aquisition::AddOrder so that it saves the branchcode

Galen Charlton galen.charlton at liblime.com
Thu Jul 24 17:18:45 CEST 2008


From: Chris Nighswonger <chris.nighswonger at liblime.com>

&AddOrder did not save the branchcode posted with a new order. This patch adds that param.

Added code to select the branch the order is for in the branch dropdown list on
acqui/orderreceive.pl

Signed-off-by: Galen Charlton <galen.charlton at liblime.com>
---
 C4/Acquisition.pm     |    9 +++++----
 acqui/addorder.pl     |    3 ++-
 acqui/orderreceive.pl |    2 ++
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm
index a599fdd..9ad58e9 100644
--- a/C4/Acquisition.pm
+++ b/C4/Acquisition.pm
@@ -398,7 +398,8 @@ sub NewOrder {
         $listprice, $booksellerid, $authorisedby, $notes,
         $bookfund,  $bibitemnum,   $rrp,          $ecost,
         $gst,       $budget,       $cost,         $sub,
-        $invoice,   $sort1,        $sort2,        $purchaseorder
+        $invoice,   $sort1,        $sort2,        $purchaseorder,
+		$branchcode
       )
       = @_;
 
@@ -454,11 +455,11 @@ sub NewOrder {
     #get ordnum MYSQL dependant, but $dbh->last_insert_id returns null
     my $ordnum = $dbh->{'mysql_insertid'};
     $query = "
-        INSERT INTO aqorderbreakdown (ordernumber,bookfundid)
-        VALUES (?,?)
+        INSERT INTO aqorderbreakdown (ordernumber,bookfundid, branchcode)
+        VALUES (?,?,?)
     ";
     $sth = $dbh->prepare($query);
-    $sth->execute( $ordnum, $bookfund );
+    $sth->execute( $ordnum, $bookfund, $branchcode );
     $sth->finish;
     return ( $basketno, $ordnum );
 }
diff --git a/acqui/addorder.pl b/acqui/addorder.pl
index a87702c..a9b5f9c 100755
--- a/acqui/addorder.pl
+++ b/acqui/addorder.pl
@@ -216,7 +216,8 @@ if ( $quantity ne '0' ) {
             $listprice, $booksellerid, $loggedinuser, $notes,
             $bookfund,  $bibitemnum,   $rrp,          $ecost,
             $gst,       $budget,       $cost,         $sub,
-            $invoice,   $sort1,        $sort2,		$purchaseorder
+            $invoice,   $sort1,        $sort2,		$purchaseorder,
+			$branch
         );
     }
 }
diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl
index eaab7ee..313a384 100755
--- a/acqui/orderreceive.pl
+++ b/acqui/orderreceive.pl
@@ -82,6 +82,7 @@ my $gst          = $input->param('gst');
 
 my @results = SearchOrder( $search, $supplierid, $biblionumber, $catview );
 my $count   = scalar @results;
+my $order 	= GetOrder($search);
 
 my $bookseller = GetBookSellerFromId( $results[0]->{'booksellerid'} );
 
@@ -144,6 +145,7 @@ if ( $count == 1 ) {
             value      => $thisbranch,
             description => $branches->{$thisbranch}->{'branchname'},
         );
+	    $row{'selected'} = 1 if( $thisbranch eq $order->{branchcode}) ;
         push @branchloop, \%row;
     }
 
-- 
1.5.5.GIT




More information about the Koha-patches mailing list