X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=gl%2Fmanage%2Fbank_accounts.php;h=634283b421d52a46c65be3eb70b8be49e0ea45b9;hb=bac6bc5d595dab716bb3c65e451e81d724b8de2d;hp=64a96f8f0f5245c36a141378ec3c7f57ff3a5c81;hpb=0bf933423b9645bcb57390c478d4fdaf0c895049;p=fa-stable.git diff --git a/gl/manage/bank_accounts.php b/gl/manage/bank_accounts.php index 64a96f8f..634283b4 100644 --- a/gl/manage/bank_accounts.php +++ b/gl/manage/bank_accounts.php @@ -66,13 +66,13 @@ elseif( $Mode == 'Delete') $acc = db_escape($selected_id); // PREVENT DELETES IF DEPENDENT RECORDS IN 'bank_trans' - if (bank_account_in_transactions($acc)) + 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.")); } - if (bank_account_in_sales_pos($acc)) + 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.")); @@ -97,7 +97,7 @@ if ($Mode == 'RESET') $result = get_bank_accounts(check_value('show_inactive')); start_form(); -start_table("$table_style width='80%'"); +start_table(TABLESTYLE, "width='80%'"); $th = array(_("Account Name"), _("Type"), _("Currency"), _("GL Account"), _("Bank"), _("Number"), _("Bank Address"), _("Dflt"), '',''); @@ -131,11 +131,11 @@ while ($myrow = db_fetch($result)) inactive_control_row($th); end_table(1); -$is_editing = $selected_id != -1; +$is_used = $selected_id != -1 && key_in_foreign_table($selected_id, 'bank_trans', 'bank_act', true); -start_table($table_style2); +start_table(TABLESTYLE2); -if ($is_editing) +if ($selected_id != -1) { if ($Mode == 'Edit') { $myrow = get_bank_account($selected_id); @@ -158,7 +158,7 @@ if ($is_editing) text_row(_("Bank Account Name:"), 'bank_account_name', null, 50, 100); -if ($is_editing) +if ($is_used) { label_row(_("Account Type:"), $bank_account_types[$_POST['account_type']]); } @@ -166,7 +166,7 @@ else { bank_account_types_list_row(_("Account Type:"), 'account_type', null); } -if ($is_editing) +if ($is_used) { label_row(_("Bank Account Currency:"), $_POST['BankAccountCurrency']); } @@ -177,7 +177,7 @@ else yesno_list_row(_("Default currency account:"), 'dflt_curr_act'); -if($is_editing) +if($is_used) label_row(_("Bank Account GL Code:"), $_POST['account_code']); else gl_all_accounts_list_row(_("Bank Account GL Code:"), 'account_code', null);