New variable in config.php, $use_oldstyle_convert, if set to 1, same convert as in...
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Sun, 14 Jun 2009 14:21:49 +0000 (14:21 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Sun, 14 Jun 2009 14:21:49 +0000 (14:21 +0000)
CHANGELOG.txt
config.php
includes/types.inc
reporting/rep705.php
reporting/rep706.php
reporting/rep707.php

index 2e869c16b4a38a970f8abf60d6fb1e99df2343e8..f5ab1841750a7d9ccde7b0a8c141434303d0c83d 100644 (file)
@@ -23,9 +23,12 @@ $ -> Affected files
 ! Much better presentation of new Balance Sheet, P&L Statement and Monthly Breakdown.
 $ /gl/includes/db/gl_db_account_types.inc
   /gl/includes/db/gl_db_accounts.inc
+  /includes/types.inc
   /reporting/rep705.php
   /reporting/rep706.php
   /reporting/rep707.php
+! New variable in config.php, $use_oldstyle_convert, if set to 1, same convert as in old versions.  
+$ config.php
   
 13-Jun-2009 Joe Hunt/Pete/Tom Moulton
 ! Changed next reference method to also include partly alpha characters in front, fi. WA036 increments to WA037
index d27448c2e6678cb39d19b7b00fbfb88c0a54b715..c3e0d689add15b74e2039cae9763f327a0709716 100644 (file)
@@ -64,6 +64,9 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_
        /* use Audit Trails in GL */
        $use_audit_trail = 0;
 
+       /* use old style convert (income and expense in BS, PL) */
+       $use_oldstyle_convert = 0;
+
        /* Integrated base Wiki Help URL or null if not used */
        //$help_base_url = $path_to_root.'/modules/wiki/index.php?n='._('Help').'.';
        $help_base_url = null;
index e12efa0d088164faa73059d0a5b34f27e2354aba..8bf64e97ae9804f4eb9ab1ac6b6ebe68944ad435 100644 (file)
@@ -309,6 +309,7 @@ class wo_types
        }
 }
 
+define('CL_NONE', 0); // for backward compatibility
 define('CL_ASSETS', 1);
 define('CL_LIABILITIES', 2);
 define('CL_EQUITY', 3);
@@ -325,6 +326,14 @@ $class_types = array(
                CL_EXPENSE => _("Expense"),
 );
 
+function get_class_type_convert($ctype)
+{
+       global $use_oldstyle_convert;
+       if (isset($use_oldstyle_convert) && $use_oldstyle_convert == 1)
+               return (($ctype >= CL_INCOME || $ctype == CL_NONE) ? -1 : 1);
+       else    
+               return ((($ctype >= CL_LIABILITIES && $ctype <= CL_INCOME) || $ctype == CL_NONE) ? -1 : 1);
+}
 define('WO_LABOUR', 0);
 define('WO_OVERHEAD', 1);
 
index 610a82bd4675ff213a102cf3a2e45bbb87d8c37c..a9ca35ea20d92f124668b15a7280ddb376ac8741 100644 (file)
@@ -285,7 +285,7 @@ function print_annual_expense_breakdown()
                }
                $classname = $account['AccountClassName'];
                $ctype = $account['ClassType'];
-               $convert = (($ctype == CL_INCOME || $ctype == 0) ? -1 : 1); // backwards compatibility
+               $convert = get_class_type_convert($ctype); 
 
                if ($account['account_code'] != null)
                {
index a8c64ec720839466a7fce992e4649eec9db8fe88..3f09f5c0083bf81d54436283f0c36413694a693a 100644 (file)
@@ -236,7 +236,7 @@ function print_balance_sheet()
                }
                $classname = $account['AccountClassName'];
                $ctype = $account['ClassType'];
-               $convert = (($ctype == CL_LIABILITIES || $ctype == CL_EQUITY || $ctype == 0) ? -1 : 1); // backwards compatibility
+               $convert = get_class_type_convert($ctype); 
 
                if ($account['account_code'] != null)
                {
index 7ce02b2c8c8594db6c8f2ed5b07782c549ebbd49..e19c29fee14db86c90259da0cd401424eea9bb68 100644 (file)
@@ -251,8 +251,8 @@ function print_profit_and_loss_statement()
                }
                $classname = $account['AccountClassName'];
                $ctype = $account['ClassType'];
-               $convert = (($ctype == CL_INCOME || $ctype == 0) ? -1 : 1); // backwards compatibility
-
+               $convert = get_class_type_convert($ctype); 
+               
                if ($account['account_code'] != null)
                {
                        //$per_balance *= -1;