$sql = "INSERT INTO ".TB_PREF."quick_entry_lines
(qid, action, dest_id, amount, dimension_id, dimension2_id)
VALUES
- ($qid, ".db_escape($action).",".db_escape($dest_id).",
+ (".db_escape($qid).", ".db_escape($action).",".db_escape($dest_id).",
".db_escape($amount).", ".db_escape($dim).", ".db_escape($dim2).")";
db_query($sql, "could not insert quick entry line for $qid");
return db_fetch($result);
}
+//---------------------------------------------------------------------------------------------
+//
+// This function returns current allowed bank payment limit, or null if limit is not set.
+// As of FA 2.3 check is done only on cash account, for which limit is bank amount as of the date selected.
+//
+function get_bank_account_limit($account, $date, $user=null)
+{
+// $user = current_user();
+
+ $bankacc = get_bank_account($account);
+ if ($bankacc['account_type'] != BT_CASH)
+ return null;
+ return max(0, get_balance_before_for_bank_account($account, add_days($date,1))); // in case of manco made before the check was implemented
+}
+
?>
\ No newline at end of file