From 49c6d821e3d293047a673404b2a95f637da7d34f Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Tue, 12 Jan 2010 10:26:27 +0000 Subject: [PATCH] Release 2.2.3 Allow using of multi level sub-types when digits are of same length in account types Print COA also prints class id and account type id. --- CHANGELOG.txt | 11 +++++++++++ admin/fiscalyears.php | 28 ++++++++++++++++++++++++++++ config.default.php | 6 +++++- gl/includes/db/gl_db_accounts.inc | 9 +++++++-- reporting/rep701.php | 8 ++++++-- update.html | 2 +- 6 files changed, 58 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index d826fb9..536fe95 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,17 @@ Legend: ! -> Note $ -> Affected files +------------------------------- Release 2.2.3 ---------------------------------- +12-Jan-2010 Joe Hunt +! Release 2.2.3 +! Allow using of multi level sub-types when digits are of same length in account types +$ config.default.php + update.html + /gl/includes/db/gl_db_accounts.inc +! Print COA also prints class id and account type id. +$ /reporting/rep701.php + + 11-Jan-2010 Janusz Dobrowolski # Removed invalid constraint on tax_types. $ /sql/en_US-new.sql diff --git a/admin/fiscalyears.php b/admin/fiscalyears.php index b507abb..85792f7 100644 --- a/admin/fiscalyears.php +++ b/admin/fiscalyears.php @@ -369,6 +369,34 @@ function delete_this_fiscalyear($selected_id) $sql = "DELETE FROM ".TB_PREF."audit_trail WHERE gl_date <= '$to'"; db_query($sql, "Could not delete audit trail"); + + $sql = "SELECT type, id FROM ".TB_PREF."comments"; + $result = db_query($sql, "Could not retrieve comments"); + while ($row = db_fetch($result)) + { + $sql = "SELECT count(*) FROM ".TB_PREF."gl_trans WHERE type = {$row['type']} AND type_no = {$row['id']}"; + $res = db_query($sql, "Could not retrieve gl_trans"); + $row2 = db_fetch_row($res); + if ($row2[0] == 0) // if no link, then delete comments + { + $sql = "DELETE FROM ".TB_PREF."comments WHERE type = {$row['type']} AND id = {$row['id']}"; + db_query($sql, "Could not delete comments"); + } + } + $sql = "SELECT type, id FROM ".TB_PREF."refs"; + $result = db_query($sql, "Could not retrieve refs"); + while ($row = db_fetch($result)) + { + $sql = "SELECT count(*) FROM ".TB_PREF."gl_trans WHERE type = {$row['type']} AND type_no = {$row['id']}"; + $res = db_query($sql, "Could not retrieve gl_trans"); + $row2 = db_fetch_row($res); + if ($row2[0] == 0) // if no link, then delete refs + { + $sql = "DELETE FROM ".TB_PREF."refs WHERE type = {$row['type']} AND id = {$row['id']}"; + db_query($sql, "Could not delete refs"); + } + } + delete_fiscalyear($selected_id); commit_transaction(); } diff --git a/config.default.php b/config.default.php index bebb6a7..d79eb80 100644 --- a/config.default.php +++ b/config.default.php @@ -56,7 +56,7 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_ // Main Title $app_title = "FrontAccounting"; // application version - $version = "2.2.2"; + $version = "2.2.3"; // Build for development purposes $build_version = date("d.m.Y", filemtime("$path_to_root/CHANGELOG.txt")); @@ -211,4 +211,8 @@ if (!defined('ICON_EDIT')) define("ICON_SUBMIT", "ok.gif"); define("ICON_ESCAPE", "escape.png"); } + + /* allow using of multi level sub-types when digits are of same length in account types */ + $use_new_account_types = 0; + ?> \ No newline at end of file diff --git a/gl/includes/db/gl_db_accounts.inc b/gl/includes/db/gl_db_accounts.inc index 518f577..ee4d4c7 100644 --- a/gl/includes/db/gl_db_accounts.inc +++ b/gl/includes/db/gl_db_accounts.inc @@ -50,6 +50,8 @@ function get_gl_accounts($from=null, $to=null) function get_gl_accounts_all($balance=-1) { + global $use_new_account_types; + if ($balance == 1) $where ="WHERE ctype>0 AND ctype<".CL_INCOME; elseif ($balance == 0) @@ -62,8 +64,11 @@ function get_gl_accounts_all($balance=-1) LEFT JOIN ".TB_PREF."chart_master ON ".TB_PREF."chart_master.account_type=".TB_PREF."chart_types.id "; if ($balance != -1) $sql .= $where; - $sql .= " ORDER BY ".TB_PREF."chart_class.cid, IF(parent > 0,parent,".TB_PREF."chart_types.id), - IF(parent > 0,".TB_PREF."chart_types.id, parent), ".TB_PREF."chart_master.account_code"; + if (isset($use_new_account_types) && $use_new_account_types == 1) + $sql .= " ORDER BY ".TB_PREF."chart_class.cid, ".TB_PREF."chart_types.id, parent, ".TB_PREF."chart_master.account_code"; + else + $sql .= " ORDER BY ".TB_PREF."chart_class.cid, IF(parent > 0,parent,".TB_PREF."chart_types.id), + IF(parent > 0,".TB_PREF."chart_types.id, parent), ".TB_PREF."chart_master.account_code"; return db_query($sql, "could not get gl accounts"); } diff --git a/reporting/rep701.php b/reporting/rep701.php index 847fb04..fc7b8a4 100644 --- a/reporting/rep701.php +++ b/reporting/rep701.php @@ -71,13 +71,17 @@ function print_Chart_of_Accounts() if ($account['AccountClassName'] != $classname) { $rep->Font('bold'); - $rep->TextCol(0, 4, $account['AccountClassName']); + //$rep->TextCol(0, 4, $account['AccountClassName']); + $rep->TextCol(0, 1, $account['ClassID']); + $rep->TextCol(1, 4, $account['AccountClassName']); $rep->Font(); //$rep->row -= ($rep->lineHeight + 4); $rep->NewLine(); } $group = $account['AccountTypeName']; - $rep->TextCol(0, 4, $account['AccountTypeName']); + //$rep->TextCol(0, 4, $account['AccountTypeName']); + $rep->TextCol(0, 1, $account['AccountType']); + $rep->TextCol(1, 4, $account['AccountTypeName']); //$rep->Line($rep->row - 4); //$rep->row -= ($rep->lineHeight + 4); $rep->NewLine(); diff --git a/update.html b/update.html index 2580973..8dc71bd 100644 --- a/update.html +++ b/update.html @@ -18,7 +18,7 @@ these files.
  • Upload all the new files. -
  • Look into the file, config.default.php and compare with your own config.php file. You should update the the following in your config.php:

  • Rename or remove the /install folder (you have already performed the install +
  • Look into the file, config.default.php and compare with your own config.php file. You should update the the following in your config.php:

  • Rename or remove the /install folder (you have already performed the install process earlier).
    1. -- 2.30.2