---
 C4/Acquisition.pm      |   12 ++++++------
 acqui/addorder.pl      |    2 +-
 acqui/neworderempty.pl |    1 +
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm
index 20b9477..1df6121 100644
--- a/C4/Acquisition.pm
+++ b/C4/Acquisition.pm
@@ -471,7 +471,7 @@ sub NewOrder {
 &ModOrder($title, $ordernumber, $quantity, $listprice,
     $biblionumber, $basketno, $supplier, $who, $notes,
     $bookfundid, $bibitemnum, $rrp, $ecost, $gst, $budget,
-    $unitprice, $booksellerinvoicenumber);
+    $unitprice, $booksellerinvoicenumber, $branchcode);
 
 Modifies an existing order. Updates the order with order number
 C<$ordernumber> and biblionumber C<$biblionumber>. All other arguments
@@ -479,7 +479,7 @@ update the fields with the same name in the aqorders table 
of the Koha
 database.
 
 Entries with order number C<$ordernumber> in the aqorderbreakdown
-table are also updated to the new book fund ID.
+table are also updated to the new book fund ID or branchcode.
 
 =back
 
@@ -490,9 +490,10 @@ sub ModOrder {
         $title,      $ordnum,   $quantity, $listprice, $bibnum,
         $basketno,   $supplier, $who,      $notes,     $bookfund,
         $bibitemnum, $rrp,      $ecost,    $gst,       $budget,
-        $cost,       $invoice,  $sort1,    $sort2,     $purchaseorder
+        $cost,       $invoice,  $sort1,    $sort2,     $purchaseorder, 
$branchcode
       )
       = @_;
+ # FIXME : Refactor to pass a hashref instead of fifty params.
     my $dbh = C4::Context->dbh;
     my $query = "
         UPDATE aqorders
@@ -510,7 +511,6 @@ sub ModOrder {
                $ordnum,   $bibnum
     );
     $sth->finish;
-    my $branchcode;  
     $query = "
         UPDATE aqorderbreakdown
         SET    bookfundid=?,branchcode=?
@@ -518,8 +518,8 @@ sub ModOrder {
     ";
     $sth = $dbh->prepare($query);
 
-    unless ( $sth->execute( $bookfund,$branchcode, $ordnum ) )
-    {    # zero rows affected [Bug 734]
+    my $rv = $sth->execute( $bookfund,$branchcode, $ordnum );
+    unless($rv && ( $rv ne '0E0' ))   {    # zero rows affected [Bug 734]
         my $query ="
             INSERT INTO aqorderbreakdown
                      (ordernumber,branchcode,bookfundid)
diff --git a/acqui/addorder.pl b/acqui/addorder.pl
index 7c4bdcd..a87702c 100755
--- a/acqui/addorder.pl
+++ b/acqui/addorder.pl
@@ -207,7 +207,7 @@ if ( $quantity ne '0' ) {
             $biblionumber,  $basketno, $booksellerid, $loggedinuser,
             $notes,   $bookfund, $bibitemnum,   $rrp,
             $ecost,   $gst,      $budget,       $cost,
-            $invoice, $sort1,    $sort2,               $purchaseorder
+            $invoice, $sort1,    $sort2,               $purchaseorder, $branch
         );
     }
     else { # else, it's a new line
diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl
index c9cfc07..103f98d 100755
--- a/acqui/neworderempty.pl
+++ b/acqui/neworderempty.pl
@@ -162,6 +162,7 @@ foreach my $thisbranch ( sort keys %$branches ) {
         value      => $thisbranch,
         branchname => $branches->{$thisbranch}->{'branchname'},
     );
+       $row{'selected'} = 1 if( $thisbranch eq $data->{branchcode}) ;
     push @branchloop, \%row;
 }
 $template->param( branchloop => [EMAIL PROTECTED] , itypeloop => [EMAIL 
PROTECTED] );
-- 
1.5.5.GIT

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches

Reply via email to