[0000162] Deleting a GL account may cause problems with quick entries
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Fri, 21 Aug 2009 21:22:13 +0000 (21:22 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Fri, 21 Aug 2009 21:22:13 +0000 (21:22 +0000)
CHANGELOG.txt
gl/manage/gl_accounts.php

index 182dff71cfe721224e7a99af58d2dcf4525de3ba..08abbd99cabd1de8077fe86b88e5c851969708e9 100644 (file)
@@ -19,6 +19,10 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+21-Aut-2009 Joe Hunt
+# [0000162] Deleting a GL account may cause problems with quick entries 
+$ /gl/manage/gl_accounts.php
+
 20-Aug-2009 Joe Hunt
 # If account code2 is used in the accounts the report Chart of Accounts gave a bad index and didn't print the code.
 $ /gl/includes/gl_db_accounts.inc
index f5ddabdbcf50343e1e864b3225732d2e9fafbfd5..9bf7ed8de4b923a4c958cff778250a67692d780c 100644 (file)
@@ -182,6 +182,17 @@ function can_delete($selected_account)
                return false;
        }                                                                       
        
+       $sql= "SELECT COUNT(*) FROM ".TB_PREF."quick_entry_lines WHERE 
+               dest_id='$selected_account' AND UPPER(LEFT(action, 1)) <> 'T'";
+       $result = db_query($sql,"Couldn't test for existing suppliers GL codes");
+
+       $myrow = db_fetch_row($result);
+       if ($myrow[0] > 0) 
+       {
+               display_error(_("Cannot delete this account because it is used by one or more Quick Entry Lines."));
+               return false;
+       }                                                                       
+
        return true;
 }