$myrow = db_fetch_row($result);
return ($myrow[0] > 0);
}
+
+function gl_account_in_bank_accounts($acc)
+{
+ $sql= "SELECT COUNT(*) FROM ".TB_PREF."bank_accounts WHERE
+ account_code=".db_escape($acc);
+ $result = db_query($sql,"Couldn't test bank account GL codes");
+
+ $myrow = db_fetch_row($result);
+ return ($myrow[0] > 0);
+}
?>
\ No newline at end of file
display_error(_("The bank account name cannot be empty."));
set_focus('bank_account_name');
}
-
+ if ($Mode=='ADD_ITEM' && (gl_account_in_bank_accounts(get_post('account_code'))
+ || key_in_foreign_table(get_post('account_code'), 'gl_trans', 'account', true))) {
+ $input_error = 1;
+ display_error(_("The GL account selected is already in use. Select another GL account."));
+ set_focus('account_code');
+ }
if ($input_error != 1)
{
if ($selected_id != -1)