X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=gl%2Fmanage%2Fbank_accounts.php;h=5ec75616d7df1d181e5c751def602f260454b5af;hb=edbff365515fbb3a2899ff0b9717c1596496aff0;hp=fb57c0f527c0b08536c9ae712d8728a3a8dde381;hpb=28e7dac267b65d8163ca41c452c42706d0ffb2dd;p=fa-stable.git diff --git a/gl/manage/bank_accounts.php b/gl/manage/bank_accounts.php index fb57c0f5..5ec75616 100644 --- a/gl/manage/bank_accounts.php +++ b/gl/manage/bank_accounts.php @@ -13,7 +13,7 @@ $page_security = 'SA_BANKACCOUNT'; $path_to_root = "../.."; include($path_to_root . "/includes/session.inc"); -page(_("Bank Accounts")); +page(_($help_context = "Bank Accounts")); include($path_to_root . "/includes/ui.inc"); @@ -63,21 +63,16 @@ elseif( $Mode == 'Delete') //the link to delete a selected record was clicked instead of the submit button $cancel_delete = 0; - + $acc = db_escape($selected_id); // PREVENT DELETES IF DEPENDENT RECORDS IN 'bank_trans' - $sql= "SELECT COUNT(*) FROM ".TB_PREF."bank_trans WHERE bank_act='$selected_id'"; - $result = db_query($sql,"check failed"); - $myrow = db_fetch_row($result); - if ($myrow[0] > 0) + if (key_in_foreign_table($acc, 'bank_trans', 'bank_act', true)) { $cancel_delete = 1; display_error(_("Cannot delete this bank account because transactions have been created using this account.")); } - $sql= "SELECT COUNT(*) FROM ".TB_PREF."sales_pos WHERE pos_account='$selected_id'"; - $result = db_query($sql,"check failed"); - $myrow = db_fetch_row($result); - if ($myrow[0] > 0) + + if (key_in_foreign_table($acc, 'sales_pos', 'pos_account', true)) { $cancel_delete = 1; display_error(_("Cannot delete this bank account because POS definitions have been created using this account.")); @@ -99,15 +94,7 @@ if ($Mode == 'RESET') /* Always show the list of accounts */ -$sql = "SELECT account.*, gl_account.account_name - FROM ".TB_PREF."bank_accounts account, ".TB_PREF."chart_master gl_account - WHERE account.account_code = gl_account.account_code"; -if (!check_value('show_inactive')) $sql .= " AND !account.inactive"; -$sql .= " ORDER BY account_code, bank_curr_code"; - -$result = db_query($sql,"could not get bank accounts"); - -check_db_error("The bank accounts set up could not be retreived", $sql); +$result = get_bank_accounts(check_value('show_inactive')); start_form(); start_table("$table_style width='80%'");