[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4121] branches/1.3/LedgerSMB/AM.pm
- Subject: SF.net SVN: ledger-smb:[4121] branches/1.3/LedgerSMB/AM.pm
- From: ..hidden..
- Date: Thu, 01 Dec 2011 11:50:38 +0000
Revision: 4121
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4121&view=rev
Author: tshvr
Date: 2011-12-01 11:50:37 +0000 (Thu, 01 Dec 2011)
Log Message:
-----------
more checking on save_taxes to avoid db duplicate record error
Modified Paths:
--------------
branches/1.3/LedgerSMB/AM.pm
Modified: branches/1.3/LedgerSMB/AM.pm
===================================================================
--- branches/1.3/LedgerSMB/AM.pm 2011-12-01 11:40:37 UTC (rev 4120)
+++ branches/1.3/LedgerSMB/AM.pm 2011-12-01 11:50:37 UTC (rev 4121)
@@ -56,6 +56,8 @@
use LedgerSMB::Tax;
use LedgerSMB::Sysconfig;
+my $logger = Log::Log4perl->get_logger('AM');
+
=item AM->get_account($myconfig, $form);
Populates the $form attributes accno, description, charttype, gifi_accno,
@@ -1926,9 +1928,31 @@
foreach my $item ( split / /, $form->{taxaccounts} ) {
my ( $chart_id, $i ) = split /_/, $item;
- my $rate =
+
+ my $rate=$form->{"taxrate_$i"};
+ $rate=~s/^\s+|\s+$//g;
+ my $validto=$form->{"validto_$i"};
+ $validto=~s/^\s+|\s+$//g;
+ my $pass=$form->{"pass_$i"};
+ $pass=~s/^\s+|\s+$//g;
+ my $taxnumber=$form->{"taxnumber_$i"};
+ $taxnumber=~s/^\s+|\s+$//g;
+ my $old_validto=$form->{"old_validto_$i"};
+ $old_validto=~s/^\s+|\s+$//g;
+ #print STDERR localtime()." AM save_taxes chart_id=$chart_id i=$i rate=$rate validto=$validto pass=$pass taxnumber=$taxnumber old_validto=$old_validto\n";
+ if($rate eq '' && $validto eq '' && $pass eq '' && $taxnumber eq '')
+ {
+ $logger->debug("skipping chart_id=$chart_id i=$i rate=$rate validto=$validto pass=$pass taxnumber=$taxnumber old_validto=$old_validto skipping");
+ next;
+ }
+ if($old_validto eq '')
+ {
+ $logger->info("will insert new chart_id=$chart_id i=$i rate=$rate validto=$validto pass=$pass taxnumber=$taxnumber old_validto=$old_validto");
+ }
+
+ $rate =
$form->parse_amount( $myconfig, $form->{"taxrate_$i"} ) / 100;
- my $validto = $form->{"validto_$i"};
+ $validto = $form->{"validto_$i"};
$validto = 'infinity' if not $validto;
$form->{"pass_$i"} = 0 if not $form->{"pass_$i"};
delete $form->{"old_validto_$i"} if ! $form->{"old_validto_$i"};
@@ -1940,9 +1964,7 @@
$form->{"old_validto_$i"}
);
$sth->execute(@queryargs) ||$form->dberror($query);
-
-
-
+ $sth->finish;
}
my $rc = $dbh->commit;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.