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

SF.net SVN: ledger-smb: [1366] trunk



Revision: 1366
          http://svn.sourceforge.net/ledger-smb/?rev=1366&view=rev
Author:   einhverfr
Date:     2007-07-09 18:08:48 -0700 (Mon, 09 Jul 2007)

Log Message:
-----------
Applying fix for order consolidation

Modified Paths:
--------------
    trunk/LedgerSMB/OE.pm
    trunk/dists/source/build.sh
    trunk/scripts/menu.pl

Modified: trunk/LedgerSMB/OE.pm
===================================================================
--- trunk/LedgerSMB/OE.pm	2007-07-10 01:00:55 UTC (rev 1365)
+++ trunk/LedgerSMB/OE.pm	2007-07-10 01:08:48 UTC (rev 1366)
@@ -2515,8 +2515,12 @@
             $form->{entity_id} = $vc_id;
             $amount                   = 0;
             $netamount                = 0;
+            my @orderids;
+            my $orderid_str = "";
 
             foreach $id ( @{ $oe{orders}{$curr}{$vc_id} } ) {
+                push(@orderids, $id);
+                $orderid_str .= "?, ";
 
                 # header
                 $ref = $oe{oe}{$curr}{$id};
@@ -2584,34 +2588,24 @@
             $sth = $dbh->prepare($query);
             $sth->execute() || $form->dberror($query);
 
+            $orderid_str =~ s/, $//;
+
             # add items
-            foreach $item (@orderitems) {
-                for (
-                    qw(
-                    qty sellprice discount project_id ship)
-                  )
-                {
-                    $item->{$_} *= 1;
-                }
-                $query = qq|
+            $query = qq|
 				INSERT INTO orderitems 
 					(trans_id, parts_id, description,
 					qty, sellprice, discount, unit, reqdate,
 					project_id, ship, serialnumber, notes)
-				VALUES 
-					(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
+				SELECT ?, parts_id, description,
+					qty, sellprice, discount, unit, reqdate,
+					project_id, ship, serialnumber, notes
+				  FROM orderitems
+                                 WHERE trans_id IN ($orderid_str)|;
 
-                $sth = $dbh->prepare($query);
-                $sth->execute(
-                    $id,                   $item->{parts_id},
-                    $item->{description},  $item->{qty},
-                    $item->{sellprice},    $item->{discount},
-                    $item->{unit},         $form->{reqdate},
-                    $item->{project_id},   $item->{ship},
-                    $item->{serialnumber}, $item->{notes}
-                ) || $form->dberror($query);
+            $sth = $dbh->prepare($query);
+            $sth->execute($id, @orderids) || $form->dberror($query);
 
-            }
+           
         }
     }
 

Modified: trunk/dists/source/build.sh
===================================================================
--- trunk/dists/source/build.sh	2007-07-10 01:00:55 UTC (rev 1365)
+++ trunk/dists/source/build.sh	2007-07-10 01:08:48 UTC (rev 1366)
@@ -2,7 +2,7 @@
 
 # Simple script to prepare for release
 
-version="1.2.0b2";
+version="1.3.0_milestone_1";
 build_d="../release";
 
 if test -d blib; then

Modified: trunk/scripts/menu.pl
===================================================================
--- trunk/scripts/menu.pl	2007-07-10 01:00:55 UTC (rev 1365)
+++ trunk/scripts/menu.pl	2007-07-10 01:08:48 UTC (rev 1366)
@@ -43,41 +43,8 @@
          template => 'menu_expand',
          format => 'HTML',
     );
-    $request->{subs} = [];
-    $menu->debug({file => '/tmp/debug-menu'});
-    $request->debug({file => '/tmp/debug'});
     $template->render($menu);
 }
 
-sub _attach_references {
-    no strict qw(refs);
-    my ($args) = @_;
-    my ($source, $dest, $path) 
-	= ($args->{source}, $args->{dest}, $args->{path});
-    my %hash;
-    if ($path and $source->{id}){
-        for (sort keys %$source){
-            next if $_ eq 'subs';
-            $hash{$_} = $source->{$_};
-        }
-        $hash{path} = $path;
-        push @{$dest}, \%hash;
-        foreach (sort keys %{$source->{subs}}) {
-            _attach_references({
-                 source => $source->{subs}->{$_}, 
-                 dest => $dest,
-                 path => "$path--$_",
-            });
-        }
-    } else {
-        foreach (sort keys %$source){
-            _attach_references({
-                source => $source->{$_},
-                dest => $dest,
-                path => "$_",
-            });
-        }
-    }
-}
 
 1;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.