Rewritten function gl_account_in_company_defaults in gl_db_accounts.inc
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 24 Jun 2010 11:18:54 +0000 (11:18 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 24 Jun 2010 11:18:54 +0000 (11:18 +0000)
More test on tags due to db error in reports with tags.

CHANGELOG.txt
gl/includes/db/gl_db_accounts.inc
reporting/rep705.php
reporting/rep706.php
reporting/rep707.php

index e053ce9d1836abff0e0ebe2bc992ecf530469327..b04261af4d404b91f4c2b569b290bacbd49745aa 100644 (file)
@@ -19,6 +19,14 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+24-Jun-2010 Joe Hunt
+# Rewritten function gl_account_in_company_defaults in gl_db_accounts.inc
+$ /gl/includes/db/gl_db_accounts.inc
+# More test on tags due to db error in reports with tags.
+$ /reporting/rep705.php
+  /reporting/rep706.php
+  /reporting/rep707.php
+  
 23-Jun-2010 Chaitanya/Joe Hunt
 ! Changed memo message in supp invoice price variance
 $ /purchasing/includes/db/invoice_db.inc
index a4004d81339ee7b47571d6f47d1d2777caeb96b0..f085cfe84b8cd767374cefed78ae142634b78f7a 100644 (file)
@@ -88,22 +88,22 @@ function get_gl_account_name($code)
 
 function gl_account_in_company_defaults($acc)
 {
-       $sql= "SELECT COUNT(*) FROM ".TB_PREF."company WHERE debtors_act=$acc 
-               OR pyt_discount_act=$acc
-               OR creditors_act=$acc 
-               OR bank_charge_act=$acc 
-               OR exchange_diff_act=$acc
-               OR profit_loss_year_act=$acc
-               OR retained_earnings_act=$acc
-               OR freight_act=$acc
-               OR default_sales_act=$acc 
-               OR default_sales_discount_act=$acc
-               OR default_prompt_payment_act=$acc
-               OR default_inventory_act=$acc
-               OR default_cogs_act=$acc
-               OR default_adj_act=$acc
-               OR default_inv_sales_act=$acc
-               OR default_assembly_act=$acc";
+       $sql= "SELECT COUNT(*) FROM ".TB_PREF."sys_prefs WHERE (name='debtors_act' 
+               OR name='pyt_discount_act'
+               OR name='creditors_act' 
+               OR name='bank_charge_act' 
+               OR name='exchange_diff_act'
+               OR name='profit_loss_year_act'
+               OR name='retained_earnings_act'
+               OR name='freight_act'
+               OR name='default_sales_act' 
+               OR name='default_sales_discount_act'
+               OR name='default_prompt_payment_act'
+               OR name='default_inventory_act'
+               OR name='default_cogs_act'
+               OR name='default_adj_act'
+               OR name='default_inv_sales_act'
+               OR name='default_assembly_act') AND value=$acc";
        $result = db_query($sql,"Couldn't test for default company GL codes");
 
        $myrow = db_fetch_row($result);
index e035869f3cb4b1bfab44c0c20a3dc1df4c88d7e1..001f91fe2d10a372ef60552263702bcd695e0edc 100644 (file)
@@ -84,7 +84,7 @@ function display_type ($type, $typename, $yr, $mo, $convert, &$dec, &$rep, $dime
        $result = get_gl_accounts(null, null, $type);   
        while ($account=db_fetch($result))
        {
-               if ($tags != -1)
+               if ($tags != -1 && is_array($tags) && $tags[0] != false)
                {
                        if (!is_record_in_tags($tags, TAG_ACCOUNT, $account['account_code']))
                                continue;
index 2fa624a6a21e26ea4bcac2def85d2a5facfd14e4..f5f321bf3142f0ad705c03031d7260429cef3e75 100644 (file)
@@ -40,7 +40,7 @@ function display_type ($type, $typename, $from, $to, $convert, &$dec, &$rep, $di
        $result = get_gl_accounts(null, null, $type);   
        while ($account=db_fetch($result))
        {
-               if ($tags != -1)
+               if ($tags != -1 && is_array($tags) && $tags[0] != false)
                {
                        if (!is_record_in_tags($tags, TAG_ACCOUNT, $account['account_code']))
                                continue;
index 1d1f2fe3a98120a5a31daba4d4ebb7d224685523..85ef695ffe260cbe9b5f75da0c3fac8975e51d3d 100644 (file)
@@ -41,7 +41,7 @@ function display_type ($type, $typename, $from, $to, $begin, $end, $compare, $co
        $result = get_gl_accounts(null, null, $type);   
        while ($account=db_fetch($result))
        {
-               if ($tags != -1)
+               if ($tags != -1 && is_array($tags) && $tags[0] != false)
                {
                        if (!is_record_in_tags($tags, TAG_ACCOUNT, $account['account_code']))
                                continue;