X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;ds=inline;f=gl%2Fmanage%2Fgl_accounts.php;h=f3e5bc95fb759afdf7270734c5ac95d0eb444b09;hb=95303d7b5280820af76ddbd8908b120813f1e763;hp=5c88705d83c8f9bcd0c7943eccf725d62d775449;hpb=fbb7a3d6150e02e442bd763a717915649fb43437;p=fa-stable.git diff --git a/gl/manage/gl_accounts.php b/gl/manage/gl_accounts.php index 5c88705d..f3e5bc95 100644 --- a/gl/manage/gl_accounts.php +++ b/gl/manage/gl_accounts.php @@ -1,5 +1,14 @@ . +***********************************************************************/ $page_security = 10; $path_to_root="../.."; include($path_to_root . "/includes/session.inc"); @@ -62,12 +71,17 @@ if (isset($_POST['add']) || isset($_POST['update'])) $_POST['account_code'] = strtoupper($_POST['account_code']); if ($selected_account) { - update_gl_account($_POST['account_code'], $_POST['account_name'], $_POST['account_type'], $_POST['account_code2'], $_POST['tax_code']); + 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'); + $Ajax->activate('account_code'); // in case of status change display_notification(_("Account data has been updated.")); } else { - add_gl_account($_POST['account_code'], $_POST['account_name'], $_POST['account_type'], $_POST['account_code2'], $_POST['tax_code']); + add_gl_account($_POST['account_code'], $_POST['account_name'], + $_POST['account_type'], $_POST['account_code2']); $selected_account = $_POST['AccountList'] = $_POST['account_code']; display_notification(_("New account has been added.")); } @@ -173,6 +187,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; } @@ -196,11 +221,17 @@ start_form(); if (db_has_gl_accounts()) { - echo "