From: Joe Hunt Date: Fri, 21 Aug 2009 21:22:13 +0000 (+0000) Subject: [0000162] Deleting a GL account may cause problems with quick entries X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=371b8938c52e8fb9ba3a539cb0d505f51fbd5ebd;p=textcart.git [0000162] Deleting a GL account may cause problems with quick entries --- diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 182dff7..08abbd9 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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 diff --git a/gl/manage/gl_accounts.php b/gl/manage/gl_accounts.php index f5ddabd..9bf7ed8 100644 --- a/gl/manage/gl_accounts.php +++ b/gl/manage/gl_accounts.php @@ -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; }