X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=gl%2Fincludes%2Fdb%2Fgl_db_bank_accounts.inc;h=0850dfe01a8c577cd6e5f45a7adafdf85e065aae;hb=79e9eb93c8f4f1cde88161253494626466ba7a50;hp=b0423f55827d6ce9bb6dfe3a9bef9bf36781d558;hpb=46c5f7a65a7659a44ae8254c63152074363d3987;p=fa-stable.git diff --git a/gl/includes/db/gl_db_bank_accounts.inc b/gl/includes/db/gl_db_bank_accounts.inc index b0423f55..0850dfe0 100644 --- a/gl/includes/db/gl_db_bank_accounts.inc +++ b/gl/includes/db/gl_db_bank_accounts.inc @@ -139,7 +139,7 @@ function add_quick_entry_line($qid, $action, $dest_id, $amount, $dim, $dim2) $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"); @@ -315,4 +315,19 @@ function get_default_bank_account($curr) 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