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

SF.net SVN: ledger-smb: [1377] trunk/LedgerSMB



Revision: 1377
          http://svn.sourceforge.net/ledger-smb/?rev=1377&view=rev
Author:   einhverfr
Date:     2007-07-10 14:54:36 -0700 (Tue, 10 Jul 2007)

Log Message:
-----------
Fixing partial commit due to update_defaults in legacy code

Modified Paths:
--------------
    trunk/LedgerSMB/AA.pm
    trunk/LedgerSMB/GL.pm
    trunk/LedgerSMB/HR.pm
    trunk/LedgerSMB/IC.pm
    trunk/LedgerSMB/IR.pm
    trunk/LedgerSMB/IS.pm
    trunk/LedgerSMB/Location.pm
    trunk/LedgerSMB/OE.pm
    trunk/LedgerSMB/OP.pm
    trunk/LedgerSMB/PE.pm

Modified: trunk/LedgerSMB/AA.pm
===================================================================
--- trunk/LedgerSMB/AA.pm	2007-07-10 21:40:09 UTC (rev 1376)
+++ trunk/LedgerSMB/AA.pm	2007-07-10 21:54:36 UTC (rev 1377)
@@ -42,6 +42,8 @@
 
     # connect to database
     my $dbh = $form->{dbh};
+    $form->{invnumber} = $form->update_defaults( $myconfig, $invnumber )
+      unless $form->{invnumber};
 
     my $query;
     my $sth;
@@ -286,8 +288,6 @@
     $form->{datepaid} = $form->{transdate} unless $form->{datepaid};
     my $datepaid = ($paid) ? qq|'$form->{datepaid}'| : 'NOW';
 
-    $form->{invnumber} = $form->update_defaults( $myconfig, $invnumber )
-      unless $form->{invnumber};
 
     $query = qq|
 		UPDATE $table 

Modified: trunk/LedgerSMB/GL.pm
===================================================================
--- trunk/LedgerSMB/GL.pm	2007-07-10 21:40:09 UTC (rev 1376)
+++ trunk/LedgerSMB/GL.pm	2007-07-10 21:54:36 UTC (rev 1377)
@@ -65,6 +65,8 @@
 sub post_transaction {
 
     my ( $self, $myconfig, $form ) = @_;
+    $form->{reference} = $form->update_defaults( $myconfig, 'glnumber', $dbh )
+      unless $form->{reference};
 
     my $null;
     my $project_id;
@@ -117,8 +119,6 @@
     ( $null, $department_id ) = split /--/, $form->{department};
     $department_id *= 1;
 
-    $form->{reference} = $form->update_defaults( $myconfig, 'glnumber', $dbh )
-      unless $form->{reference};
     $form->{reference} ||= $form->{id};
 
     $query = qq|

Modified: trunk/LedgerSMB/HR.pm
===================================================================
--- trunk/LedgerSMB/HR.pm	2007-07-10 21:40:09 UTC (rev 1376)
+++ trunk/LedgerSMB/HR.pm	2007-07-10 21:54:36 UTC (rev 1377)
@@ -98,6 +98,9 @@
 
 sub save_employee {
     my ( $self, $myconfig, $form ) = @_;
+    $form->{employeenumber} =
+      $form->update_defaults( $myconfig, "employeenumber", $dbh )
+      if !$form->{employeenumber};
 
     my $dbh = $form->{dbh};
     my $query;
@@ -124,9 +127,6 @@
     $managerid     *= 1;
     $form->{sales} *= 1;
 
-    $form->{employeenumber} =
-      $form->update_defaults( $myconfig, "employeenumber", $dbh )
-      if !$form->{employeenumber};
 
     $query = qq|
 		UPDATE employee 

Modified: trunk/LedgerSMB/IC.pm
===================================================================
--- trunk/LedgerSMB/IC.pm	2007-07-10 21:40:09 UTC (rev 1376)
+++ trunk/LedgerSMB/IC.pm	2007-07-10 21:54:36 UTC (rev 1377)
@@ -204,6 +204,9 @@
 
 sub save {
     my ( $self, $myconfig, $form ) = @_;
+    $form->{partnumber} =
+      $form->update_defaults( $myconfig, "partnumber", $dbh )
+      if !$form->{partnumber};
 
     ( $form->{inventory_accno} ) = split( /--/, $form->{IC_inventory} );
     ( $form->{expense_accno} )   = split( /--/, $form->{IC_expense} );
@@ -378,9 +381,6 @@
     ( $null, $partsgroup_id ) = split /--/, $form->{partsgroup};
     $partsgroup_id *= 1;
 
-    $form->{partnumber} =
-      $form->update_defaults( $myconfig, "partnumber", $dbh )
-      if !$form->{partnumber};
 
     if ( !$form->{priceupdate} ) {
         $form->{priceupdate} = 'now';

Modified: trunk/LedgerSMB/IR.pm
===================================================================
--- trunk/LedgerSMB/IR.pm	2007-07-10 21:40:09 UTC (rev 1376)
+++ trunk/LedgerSMB/IR.pm	2007-07-10 21:54:36 UTC (rev 1377)
@@ -41,6 +41,8 @@
     my ( $self, $myconfig, $form ) = @_;
 
     my $dbh = $form->{dbh};
+    $form->{invnumber} = $form->update_defaults( $myconfig, "vinumber", $dbh )
+      unless $form->{invnumber};
 
     for ( 1 .. $form->{rowcount} ) {
         unless ( $form->{"deliverydate_$_"} ) {
@@ -406,6 +408,8 @@
                     $form->update_balance( $dbh, "invoice", "allocated",
                         qq|id = $ref->{id}|,
                         $qty * -1 );
+                    $form->update_balance( $dbh, "invoice", "allocated",
+				qq|id =$invoice_id|,$qty);
 
                     $allocated += $qty;
 
@@ -430,33 +434,6 @@
                   };
 
             }
-            $query = qq|
-				UPDATE invoice 
-				   SET trans_id = ?,
-				       parts_id = ?,
-				       description = ?,
-				       qty = ?,
-				       sellprice = ?,
-				       fxsellprice = ?,
-				       discount = ?,
-				       allocated = ?,
-				       unit = ?,
-				       deliverydate = ?,
-				       project_id = ?,
-				       serialnumber = ?,
-				       notes = ?
-				 WHERE id = ?|;
-            $sth = $dbh->prepare($query);
-            $sth->execute(
-                $form->{id},               $form->{"id_$i"},
-                $form->{"description_$i"}, $form->{"qty_$i"} * -1,
-                $form->{"sellprice_$i"},   $fxsellprice,
-                $form->{"discount_$i"},    $allocated,
-                $form->{"unit_$i"},        $form->{"deliverydate_$i"},
-                $project_id,               $form->{"serialnumber_$i"},
-                $form->{"notes_$i"},       $invoice_id
-            ) || $form->dberror($query);
-
         }
     }
 
@@ -712,8 +689,6 @@
     # set values which could be empty
     $form->{taxincluded} *= 1;
 
-    $form->{invnumber} = $form->update_defaults( $myconfig, "vinumber", $dbh )
-      unless $form->{invnumber};
 
     # save AP record
     $query = qq|

Modified: trunk/LedgerSMB/IS.pm
===================================================================
--- trunk/LedgerSMB/IS.pm	2007-07-10 21:40:09 UTC (rev 1376)
+++ trunk/LedgerSMB/IS.pm	2007-07-10 21:54:36 UTC (rev 1377)
@@ -804,6 +804,8 @@
 
 sub post_invoice {
     my ( $self, $myconfig, $form ) = @_;
+    $form->{invnumber} = $form->update_defaults( $myconfig, "sinumber", $dbh )
+      unless $form->{invnumber};
 
     my $dbh = $form->{dbh};
 
@@ -891,8 +893,6 @@
       ($exchangerate)
       ? $exchangerate
       : $form->parse_amount( $myconfig, $form->{exchangerate} );
-    $form->{invnumber} = $form->update_defaults( $myconfig, "sinumber", $dbh )
-      unless $form->{invnumber};
 
     my $i;
     my $item;

Modified: trunk/LedgerSMB/Location.pm
===================================================================
--- trunk/LedgerSMB/Location.pm	2007-07-10 21:40:09 UTC (rev 1376)
+++ trunk/LedgerSMB/Location.pm	2007-07-10 21:54:36 UTC (rev 1377)
@@ -1,4 +1,3 @@
-
 =head1 NAME
 
 LedgerSMB::Location - LedgerSMB class for managing Business Locations

Modified: trunk/LedgerSMB/OE.pm
===================================================================
--- trunk/LedgerSMB/OE.pm	2007-07-10 21:40:09 UTC (rev 1376)
+++ trunk/LedgerSMB/OE.pm	2007-07-10 21:54:36 UTC (rev 1377)
@@ -253,7 +253,6 @@
         "currency",  "department_id", "employee_id",   "language_code",
         "ponumber",  "terms"
     );
-
     # connect to database, turn off autocommit
     my $dbh = $form->{dbh};
     my @queryargs;
@@ -277,11 +276,12 @@
           ? "sqnumber"
           : "rfqnumber";
     }
-
     $form->{"$ordnumber"} =
       $form->update_defaults( $myconfig, $numberfld, $dbh )
       unless $form->{ordnumber};
 
+
+
     my $query;
     my $sth;
     my $null;

Modified: trunk/LedgerSMB/OP.pm
===================================================================
--- trunk/LedgerSMB/OP.pm	2007-07-10 21:40:09 UTC (rev 1376)
+++ trunk/LedgerSMB/OP.pm	2007-07-10 21:54:36 UTC (rev 1377)
@@ -37,6 +37,12 @@
 sub overpayment {
     my ( $self, $myconfig, $form, $dbh, $amount, $ml ) = @_;
 
+    my $invnumber = $form->{invnumber};
+    $invnumber =
+      $form->update_defaults( $myconfig, ( $form->{arap} eq 'ar' )
+        ? "sinumber"
+        : "vinumber", $dbh )
+      unless $invnumber;
     my $fxamount = $form->round_amount( $amount * $form->{exchangerate}, 2 );
     my ($paymentaccno) = split /--/, $form->{account};
 
@@ -57,12 +63,6 @@
     $query = qq|SELECT id FROM $form->{arap} WHERE invnumber = '$uid'|;
     ($uid) = $dbh->selectrow_array($query);
 
-    my $invnumber = $form->{invnumber};
-    $invnumber =
-      $form->update_defaults( $myconfig, ( $form->{arap} eq 'ar' )
-        ? "sinumber"
-        : "vinumber", $dbh )
-      unless $invnumber;
 
     $query = qq|
 		UPDATE $form->{arap} 

Modified: trunk/LedgerSMB/PE.pm
===================================================================
--- trunk/LedgerSMB/PE.pm	2007-07-10 21:40:09 UTC (rev 1376)
+++ trunk/LedgerSMB/PE.pm	2007-07-10 21:54:36 UTC (rev 1377)
@@ -568,6 +568,9 @@
 
 sub save_job {
     my ( $self, $myconfig, $form ) = @_;
+    $form->{projectnumber} =
+      $form->update_defaults( $myconfig, "projectnumber", $dbh )
+      unless $form->{projectnumber};
 
     my $dbh = $form->{dbh};
 
@@ -597,9 +600,6 @@
         ( $form->{id} ) = $dbh->selectrow_array($query);
     }
 
-    $form->{projectnumber} =
-      $form->update_defaults( $myconfig, "projectnumber", $dbh )
-      unless $form->{projectnumber};
 
     $query = qq|
 		UPDATE project 


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