From 8f8e4c4823dd07c604ade72529e7a4dda5f98996 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Thu, 2 Dec 2010 14:24:24 +0000 Subject: [PATCH] When deleting a fiscal year, the open balances should share the same trans no. --- CHANGELOG.txt | 4 ++++ admin/db/fiscalyears_db.inc | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 4b413994..ccf88c08 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,10 @@ Legend: ! -> Note $ -> Affected files +02-Dec-2010 Joe Hunt +# When deleting a fiscal year, the open balances should share the same trans no. +$ /admin/db/fiscalyear_db.inc + 01-Dec-2010 Joe Hunt ! Better test for correct balance accounts when closing fiscal year. $ /admin/db/fiscalyear_db.inc diff --git a/admin/db/fiscalyears_db.inc b/admin/db/fiscalyears_db.inc index ff4e4bcd..b14ce5ba 100644 --- a/admin/db/fiscalyears_db.inc +++ b/admin/db/fiscalyears_db.inc @@ -328,13 +328,13 @@ function delete_this_fiscalyear($selected_id) $sql = "SELECT account, SUM(amount) AS amount FROM ".TB_PREF."gl_trans WHERE tran_date <= '$to' GROUP by account"; $result = db_query($sql, "Could not retrieve gl trans"); + $trans_no = get_next_trans_no(ST_JOURNAL); while ($row = db_fetch($result)) { $sql = "DELETE FROM ".TB_PREF."gl_trans WHERE tran_date <= '$to' AND account = '{$row['account']}'"; db_query($sql, "Could not delete gl trans"); if (is_account_balancesheet($row['account'])) { - $trans_no = get_next_trans_no(ST_JOURNAL); $sql = "INSERT INTO ".TB_PREF."gl_trans (type, type_no, tran_date, account, memo_, amount) VALUES (".ST_JOURNAL.", $trans_no, '$to', '{$row['account']}', '$ref', {$row['amount']})"; db_query($sql, "Could not insert gl trans"); -- 2.30.2