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

SF.net SVN: ledger-smb: [1361] branches/1.2/LedgerSMB



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

Log Message:
-----------
Fixing bug 1748255

Modified Paths:
--------------
    branches/1.2/LedgerSMB/AA.pm
    branches/1.2/LedgerSMB/CT.pm
    branches/1.2/LedgerSMB/GL.pm
    branches/1.2/LedgerSMB/HR.pm
    branches/1.2/LedgerSMB/IC.pm
    branches/1.2/LedgerSMB/IR.pm
    branches/1.2/LedgerSMB/IS.pm
    branches/1.2/LedgerSMB/OE.pm
    branches/1.2/LedgerSMB/OP.pm
    branches/1.2/LedgerSMB/PE.pm

Modified: branches/1.2/LedgerSMB/AA.pm
===================================================================
--- branches/1.2/LedgerSMB/AA.pm	2007-07-09 22:51:13 UTC (rev 1360)
+++ branches/1.2/LedgerSMB/AA.pm	2007-07-09 23:09:45 UTC (rev 1361)
@@ -39,6 +39,8 @@
 sub post_transaction {
 
     my ( $self, $myconfig, $form ) = @_;
+    $form->{invnumber} = $form->update_defaults( $myconfig, $invnumber )
+      unless $form->{invnumber};
 
     # connect to database
     my $dbh = $form->{dbh};
@@ -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: branches/1.2/LedgerSMB/CT.pm
===================================================================
--- branches/1.2/LedgerSMB/CT.pm	2007-07-09 22:51:13 UTC (rev 1360)
+++ branches/1.2/LedgerSMB/CT.pm	2007-07-09 23:09:45 UTC (rev 1361)
@@ -208,6 +208,9 @@
     my $sth;
     my $null;
 
+    $form->{customernumber} =
+      $form->update_defaults( $myconfig, "customernumber", $dbh )
+      if !$form->{customernumber};
     # remove double spaces
     $form->{name} =~ s/  / /g;
 
@@ -301,9 +304,6 @@
     my $language_code;
     ( $null, $language_code ) = split /--/, $form->{language};
 
-    $form->{customernumber} =
-      $form->update_defaults( $myconfig, "customernumber", $dbh )
-      if !$form->{customernumber};
 
     $query = qq|
 		UPDATE customer 
@@ -388,6 +388,9 @@
 
     # connect to database
     my $dbh = $form->{dbh};
+    $form->{vendornumber} =
+      $form->update_defaults( $myconfig, "vendornumber", $dbh )
+      if !$form->{vendornumber};
 
     my $query;
     my $sth;
@@ -476,9 +479,6 @@
     my $language_code;
     ( $null, $language_code ) = split /--/, $form->{language};
 
-    $form->{vendornumber} =
-      $form->update_defaults( $myconfig, "vendornumber", $dbh )
-      if !$form->{vendornumber};
 
     $form->{startdate} = undef unless $form->{startdate};
     $form->{enddate}   = undef unless $form->{enddate};

Modified: branches/1.2/LedgerSMB/GL.pm
===================================================================
--- branches/1.2/LedgerSMB/GL.pm	2007-07-09 22:51:13 UTC (rev 1360)
+++ branches/1.2/LedgerSMB/GL.pm	2007-07-09 23:09:45 UTC (rev 1361)
@@ -70,6 +70,8 @@
     my $project_id;
     my $department_id;
     my $i;
+    $form->{reference} = $form->update_defaults( $myconfig, 'glnumber', $dbh )
+      unless $form->{reference};
 
     # connect to database, turn off AutoCommit
     my $dbh = $form->{dbh};
@@ -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: branches/1.2/LedgerSMB/HR.pm
===================================================================
--- branches/1.2/LedgerSMB/HR.pm	2007-07-09 22:51:13 UTC (rev 1360)
+++ branches/1.2/LedgerSMB/HR.pm	2007-07-09 23:09:45 UTC (rev 1361)
@@ -102,6 +102,9 @@
     my $dbh = $form->{dbh};
     my $query;
     my $sth;
+    $form->{employeenumber} =
+      $form->update_defaults( $myconfig, "employeenumber", $dbh )
+      if !$form->{employeenumber};
 
     if ( !$form->{id} ) {
         my $uid = localtime;
@@ -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: branches/1.2/LedgerSMB/IC.pm
===================================================================
--- branches/1.2/LedgerSMB/IC.pm	2007-07-09 22:51:13 UTC (rev 1360)
+++ branches/1.2/LedgerSMB/IC.pm	2007-07-09 23:09:45 UTC (rev 1361)
@@ -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';
@@ -1599,13 +1599,8 @@
     $form->{$id} = 1;
 
     my @a = qw(partnumber description bin);
-    if ( $form->{sort} eq 'partnumber' ) {
-        $sortorder = "TRUE";
-    }
-    else {
-        @a = grep !/$form->{sort}/, @a;
-        $sortorder = "$form->{sort} $form->{direction}, " . join ',', @a;
-    }
+    @a = grep !/$form->{sort}/, @a;
+    $sortorder = "$form->{sort} $form->{direction}, " . join ',', @a;
 
     @a = ();
     my $query = qq|

Modified: branches/1.2/LedgerSMB/IR.pm
===================================================================
--- branches/1.2/LedgerSMB/IR.pm	2007-07-09 22:51:13 UTC (rev 1360)
+++ branches/1.2/LedgerSMB/IR.pm	2007-07-09 23:09:45 UTC (rev 1361)
@@ -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_$_"} ) {
@@ -671,8 +673,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: branches/1.2/LedgerSMB/IS.pm
===================================================================
--- branches/1.2/LedgerSMB/IS.pm	2007-07-09 22:51:13 UTC (rev 1360)
+++ branches/1.2/LedgerSMB/IS.pm	2007-07-09 23:09:45 UTC (rev 1361)
@@ -808,6 +808,8 @@
     my ( $self, $myconfig, $form ) = @_;
 
     my $dbh = $form->{dbh};
+    $form->{invnumber} = $form->update_defaults( $myconfig, "sinumber", $dbh )
+      unless $form->{invnumber};
 
     my $query;
     my $sth;
@@ -1368,8 +1370,6 @@
     $form->{terms}       *= 1;
     $form->{taxincluded} *= 1;
 
-    $form->{invnumber} = $form->update_defaults( $myconfig, "sinumber", $dbh )
-      unless $form->{invnumber};
 
     # save AR record
     $query = qq|

Modified: branches/1.2/LedgerSMB/OE.pm
===================================================================
--- branches/1.2/LedgerSMB/OE.pm	2007-07-09 22:51:13 UTC (rev 1360)
+++ branches/1.2/LedgerSMB/OE.pm	2007-07-09 23:09:45 UTC (rev 1361)
@@ -246,6 +246,9 @@
 
 sub save {
     my ( $self, $myconfig, $form ) = @_;
+    $form->{"$ordnumber"} =
+      $form->update_defaults( $myconfig, $numberfld, $dbh )
+      unless $form->{ordnumber};
 
     $form->db_prepare_vars(
         "quonumber", "transdate",     "vendor_id",     "customer_id",
@@ -278,9 +281,6 @@
           : "rfqnumber";
     }
 
-    $form->{"$ordnumber"} =
-      $form->update_defaults( $myconfig, $numberfld, $dbh )
-      unless $form->{ordnumber};
 
     my $query;
     my $sth;
@@ -2298,6 +2298,7 @@
     foreach $vendor_id ( keys %a ) {
 
         %tax = ();
+        my $ordnumber = $form->update_defaults( $myconfig, 'ponumber' );
 
         $query = qq|
 			SELECT v.curr, v.taxincluded, t.rate, c.accno
@@ -2401,7 +2402,6 @@
 
         }
 
-        my $ordnumber = $form->update_defaults( $myconfig, 'ponumber' );
 
         my $null;
         my $employee_id;
@@ -2519,6 +2519,8 @@
             $form->{"$form->{vc}_id"} = $vc_id;
             $amount                   = 0;
             $netamount                = 0;
+            $ordnumber ||=
+              $form->update_defaults( $myconfig, $numberfld, $dbh );
 
             foreach $id ( @{ $oe{orders}{$curr}{$vc_id} } ) {
 
@@ -2549,8 +2551,6 @@
                 $dbh->do($query) || $form->dberror($query);
             }
 
-            $ordnumber ||=
-              $form->update_defaults( $myconfig, $numberfld, $dbh );
 
             #fixme:  Change this
             $query = qq|

Modified: branches/1.2/LedgerSMB/OP.pm
===================================================================
--- branches/1.2/LedgerSMB/OP.pm	2007-07-09 22:51:13 UTC (rev 1360)
+++ branches/1.2/LedgerSMB/OP.pm	2007-07-09 23:09:45 UTC (rev 1361)
@@ -37,6 +37,11 @@
 sub overpayment {
     my ( $self, $myconfig, $form, $dbh, $amount, $ml ) = @_;
 
+    $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};
 
@@ -58,11 +63,6 @@
     ($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: branches/1.2/LedgerSMB/PE.pm
===================================================================
--- branches/1.2/LedgerSMB/PE.pm	2007-07-09 22:51:13 UTC (rev 1360)
+++ branches/1.2/LedgerSMB/PE.pm	2007-07-09 23:09:45 UTC (rev 1361)
@@ -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.