From: Joe Hunt Date: Sun, 27 Dec 2009 08:44:25 +0000 (+0000) Subject: Minor fix X-Git-Tag: 2.3-final~1071 X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;ds=inline;h=1b1cd2a1d25f90b1b19aaf5b0383e7afb63a3e41;p=fa-stable.git Minor fix --- diff --git a/gl/manage/bank_accounts.php b/gl/manage/bank_accounts.php index 97a5dbba..09f07b04 100644 --- a/gl/manage/bank_accounts.php +++ b/gl/manage/bank_accounts.php @@ -26,19 +26,18 @@ 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']."'"; + if ($curr == $_POST['BankAccountCurrency']) + $sql .= " AND bank_curr_code <> '".$_POST['BankAccountCurrency']."'"; + $sql .= " AND id <> $selected_id"; + $result = db_query($sql,"could not get bank accounts"); + if (db_num_rows($result) > 0) { - $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'); - } - } + $input_error = 1; + display_error(_("The GL account is already in use.")); + set_focus('account_code'); + } //first off validate inputs sensible if ($input_error == 0 && strlen($_POST['bank_account_name']) == 0) {