Topic: GL account cannot be inactivated

Hi

It is not possible to declare a general ledger account as inactive, while a bank account is linked to this GL account. Even if the bank account itself is declared as inactive in "Bank Accounts" (tick box).
In the above described case the following message is shown when trying to set the GL account as inactive: "The account belongs to a bank account and cannot be inactivated."

Is there a work around how to set a general ledger account linked to a bank account as inactive?

Version used: 2.4.16

Thanks and regards
Rafy

Re: GL account cannot be inactivated

I did it directly in the MySQL-Database:


USE your_fa_database;

UPDATE `0_chart_master` SET `inactive` = '1' WHERE `0_chart_master`.`account_code` = '   "your_bank_account"   ';


-> replace your_fa_database with the name of your database
-> replace "your_bank_account" with the concerned bank account number, eg. 1010

Re: GL account cannot be inactivated

Which version of PHP/MySQL are you using?

Looks like the de-activation of the linked bank account is not being updated in the database presumably if there are transactions dependent on it.

This error is effected in line 87 (in current FA version) of gl/manage/gl_accounts.php.
Lines 89-94:

            elseif (update_gl_account($_POST['account_code'], $_POST['account_name'], 
                $_POST['account_type'], $_POST['account_code2'])) {
                update_record_status($_POST['account_code'], $_POST['inactive'],
                    'chart_master', 'account_code');
                update_tag_associations(TAG_ACCOUNT, $_POST['account_code'], 
                    $_POST['account_tags']);

need to succeed.

Furthermore, the table 0_bank_accounts too needs to have the inactive field set as needed and refreshed for the session variables to be updated. From line 282, the function is_bank_account($account_code) has been defined in gl/includes/db/gl_db_accounts.inc.

Hence the specific version of MySQL when queried may be returning a NULL instead of 0 for the inactive field or the get_post() part of the html response may not be of the type expected in the browser / PHP version used.

@joe: Any checks in the code that is preventing it?