Merged changes from mai trunk up to 2.3.1
[fa-stable.git] / gl / includes / db / gl_db_bank_accounts.inc
index b0423f55827d6ce9bb6dfe3a9bef9bf36781d558..a92195041a9adc3ce3ddb86a57b4e43be10bf888 100644 (file)
@@ -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 get_balance_before_for_bank_account($account, add_days($date,1));
+}
+
 ?>
\ No newline at end of file