diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-09-06 00:04:49 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-09-06 00:04:49 +0000 |
commit | 4dde7266bd8643fa6477dbd0fcffeb59e61dc645 (patch) | |
tree | 8564ec25a9b531113e08f141ff664862b9a13814 | |
parent | 9dd72130f253426df35db305d6b6234ce5831fa8 (diff) |
Fixing bug 1763928: Books closed-to date not multi-format safe
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@1513 4979c152-3d1c-0410-bac9-87ea11338e46
-rwxr-xr-x | LedgerSMB/AM.pm | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/LedgerSMB/AM.pm b/LedgerSMB/AM.pm index dfc16c19..445a2ab1 100755 --- a/LedgerSMB/AM.pm +++ b/LedgerSMB/AM.pm @@ -1690,6 +1690,10 @@ sub closebooks { 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 @@ sub closebooks { 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} ) { |