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

SF.net SVN: ledger-smb: [1513] branches/1.2/LedgerSMB/AM.pm



Revision: 1513
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1513&view=rev
Author:   einhverfr
Date:     2007-09-05 17:04:49 -0700 (Wed, 05 Sep 2007)

Log Message:
-----------
Fixing bug 1763928:  Books closed-to date not multi-format safe

Modified Paths:
--------------
    branches/1.2/LedgerSMB/AM.pm

Modified: branches/1.2/LedgerSMB/AM.pm
===================================================================
--- branches/1.2/LedgerSMB/AM.pm	2007-09-05 23:21:35 UTC (rev 1512)
+++ branches/1.2/LedgerSMB/AM.pm	2007-09-06 00:04:49 UTC (rev 1513)
@@ -1690,6 +1690,10 @@
 		UPDATE defaults SET value = ? 
 		 WHERE setting_key = ?|;
     my $sth = $dbh->prepare($query);
+    my $sth_closedto = $dbh->prepare(qq|
+		UPDATE defaults SET value = to_char(?::date, 'YYYY-MM-DD') 
+		 WHERE setting_key = ?|);
+		
     for (qw(revtrans closedto audittrail)) {
 
         if ( $form->{$_} ) {
@@ -1698,8 +1702,11 @@
         else {
             $val = 0;
         }
-        $val = undef if ($_ eq 'closedto' and $val == 0); 
-        $sth->execute( $val, $_ );
+        if ($_ eq 'closedto'){
+            $sth_closedto->execute( $val || undef, $_);
+        } else { 
+            $sth->execute( $val, $_ );
+        }
     }
 
     if ( $form->{removeaudittrail} ) {


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