function check_trans()
{
- global $Refs;
+ global $Refs, $systypes_array;
$input_error = 0;
}
if ($trans = check_bank_account_history($amnt_chg, $_POST['bank_account'], $_POST['date_'])) {
- display_error(sprintf(_("The bank transaction would result in exceed of authorized overdraft limit for transaction: %s #%s on %s."),
- $systypes_array[$trans['type']], $trans['trans_no'], sql2date($trans['trans_date'])));
- set_focus('amount');
- $input_error = 1;
+ if (isset($trans['trans_no'])) {
+ display_error(sprintf(_("The bank transaction would result in exceed of authorized overdraft limit for transaction: %s #%s on %s."),
+ $systypes_array[$trans['type']], $trans['trans_no'], sql2date($trans['trans_date'])));
+ set_focus('amount');
+ $input_error = 1;
+ }
}
if (!check_reference($_POST['ref'], $_SESSION['pay_items']->trans_type, $_SESSION['pay_items']->order_id))
{
$balance += $delta_amount;
- $sql = "SELECT sum(amount) as amount, trans_date
+ $sql = "SELECT sum(amount) as amount, trans_date, trans_no, type
FROM ".TB_PREF."bank_trans
WHERE bank_act=".db_escape($bank_account);
if ($date)
while ($trans = db_fetch($history)) {
$balance += $trans['amount'];
- if ($balance < 0)
+ if (round2($balance, user_price_dec()) < 0)
{
$trans['amount'] = $balance;
return $trans;