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

SF.net SVN: ledger-smb: [423] trunk/LedgerSMB/AM.pm



Revision: 423
          http://svn.sourceforge.net/ledger-smb/?rev=423&view=rev
Author:   einhverfr
Date:     2006-10-30 22:53:40 -0800 (Mon, 30 Oct 2006)

Log Message:
-----------
System -> Defaults now properly saves defaults and retrieves accounts.  other functionality not working.

Modified Paths:
--------------
    trunk/LedgerSMB/AM.pm

Modified: trunk/LedgerSMB/AM.pm
===================================================================
--- trunk/LedgerSMB/AM.pm	2006-10-31 06:30:55 UTC (rev 422)
+++ trunk/LedgerSMB/AM.pm	2006-10-31 06:53:40 UTC (rev 423)
@@ -1370,31 +1370,34 @@
                                                FROM chart
                                               WHERE accno = ?)
 		 WHERE setting_key = ?|);
-	my %translation = {
+	my %translation = (
 		inventory_accno_id => 'IC',
 		income_accno_id => 'IC_income',
 		expense_accno_id => 'IC_expense',
 		fxgain_accno_id => 'FX_gain',
 		fxloss_accno_id => 'FX_loss'	
-	};
+	);
 	for (
 		qw(inventory_accno_id income_accno_id expense_accno_id 
 		fxgain_accno_id fxloss_accno_id glnumber sinumber vinumber
 		sonumber ponumber sqnumber rfqnumber partnumber employeenumber
 		customernumber vendornumber projectnumber yearend curr
-		weightunit businessnumber yearend)
+		weightunit businessnumber)
 	){
-		my $name;
+		my $val = $form->{$_};
+
 		if ($translation{$_}){
-			$name = $translation{$_};
+			$val = $form->{$translation{$_}};
+			print STDERR $val;
+		} 
+		if ($_ =~ /accno/){
+			print STDERR "Account $_: $translation{$_}";
+			$sth_accno->execute($val, $_) 
+				|| $form->dberror("Saving $_");
 		} else {
-			$name = $_;
+			$sth_plain->execute($val, $_)
+				|| $form->dberror("Saving $_");
 		}
-		if ($_ =~ /accno_id/){
-			$sth_accno->execute($form->{$name}, $_);
-		} else {
-			$sth_plain->execute($form->{$name}, $_);
-		}
 
 	}
 	my $rc = $dbh->commit;


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