From d94e0b8f9fbc2d40d6662e02d70b351d22d41318 Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Thu, 22 Nov 2012 17:58:37 +0100 Subject: [PATCH] Added check for correct account selected for Retained Earnings and Profit/Loss in GL Setup. --- admin/gl_setup.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/admin/gl_setup.php b/admin/gl_setup.php index 5f66fcc..26309ba 100644 --- a/admin/gl_setup.php +++ b/admin/gl_setup.php @@ -47,13 +47,18 @@ function can_process() } $grn_act = get_company_pref('grn_clearing_act'); - if ((get_post('grn_clearing_act',0) != $grn_act) && db_num_rows(get_grn_items(0, '', true))) + if ((get_post('grn_clearing_act') != $grn_act) && db_num_rows(get_grn_items(0, '', true))) { display_error(_("Before GRN Clearing Account can be changed all GRNs have to be invoiced")); $_POST['grn_clearing_act'] = $grn_act; set_focus('grn_clearing_account'); return false; } + if (!is_account_balancesheet(get_post('retained_earnings_act')) || is_account_balancesheet(get_post('profit_loss_year_act'))) + { + display_error(_("The Retained Earnings Account should be a Balance Account or the Profit and Loss Year Account should be an Expense Account (preferred the last one in the Expense Class)")); + return false; + } return true; } -- 2.30.2