X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;ds=inline;f=gl%2Fmanage%2Fbank_accounts.php;h=97a5dbba252aad596f8e5a37efe76245860f0d9a;hb=1aba32cffc99e8e44ff80534384a8253cc044000;hp=ae1dc41e6f8cc7e924b4a1bc0ef88397afa17286;hpb=ebc600101ceab69c06eac4b1bd4d1782af45de05;p=fa-stable.git diff --git a/gl/manage/bank_accounts.php b/gl/manage/bank_accounts.php index ae1dc41e..97a5dbba 100644 --- a/gl/manage/bank_accounts.php +++ b/gl/manage/bank_accounts.php @@ -25,9 +25,22 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM') //initialise no input errors assumed initially before we test $input_error = 0; - + $curr = get_company_currency(); + if ($curr != $_POST['BankAccountCurrency']) + { + $sql = "SELECT account_code FROM ".TB_PREF."bank_accounts + WHERE account_code = '".$_POST['account_code']."' + AND id <> $selected_id"; + $result = db_query($sql,"could not get bank accounts"); + if (db_num_rows($result) > 0) + { + $input_error = 1; + display_error(_("The GL account is already in use.")); + set_focus('account_code'); + } + } //first off validate inputs sensible - if (strlen($_POST['bank_account_name']) == 0) + if ($input_error == 0 && strlen($_POST['bank_account_name']) == 0) { $input_error = 1; display_error(_("The bank account name cannot be empty.")); @@ -190,9 +203,10 @@ else yesno_list_row(_("Default currency account:"), 'dflt_curr_act'); -if($is_editing) +$curr = get_company_currency(); +if ($is_editing && $curr == $_POST['BankAccountCurrency']) label_row(_("Bank Account GL Code:"), $_POST['account_code']); -else +else gl_all_accounts_list_row(_("Bank Account GL Code:"), 'account_code', null); text_row(_("Bank Name:"), 'bank_name', null, 50, 60);