Customer Payment, Supplier Payment: early discount support.
[fa-stable.git] / gl / includes / db / gl_db_bank_trans.inc
index 8c63f64573bf3bdfd5ac7f1f1e76a22d7177c5d4..e8d8190552051b7b6bf51e698245de56f014cb72 100644 (file)
@@ -16,7 +16,7 @@
 // $date_ is display date (non-sql)
 
 function add_bank_trans($type, $trans_no, $bank_act, $ref, $date_,
-       $amount, $person_type_id, $person_id, $currency="", $err_msg="", $rate=0)
+       $amount, $person_type_id, $person_id, $currency="", $rate=0)
 {
        $sqlDate = date2sql($date_);
 
@@ -41,10 +41,7 @@ function add_bank_trans($type, $trans_no, $bank_act, $ref, $date_,
                ".db_escape($amount_bank).", ".db_escape($person_type_id)
                .", ". db_escape($person_id).")";
 
-       if ($err_msg == "")
-               $err_msg = "The bank transaction could not be inserted";
-
-       db_query($sql, $err_msg);
+       db_query($sql, "The bank transaction could not be inserted");
 }
 
 //----------------------------------------------------------------------------------------
@@ -143,7 +140,7 @@ function void_bank_trans($type, $type_no, $nested=false)
 {
 
        if (!$nested)
-               begin_transaction();
+               begin_transaction(__FUNCTION__, func_get_args());
 
        $sql = "UPDATE ".TB_PREF."bank_trans 
                        SET amount=0
@@ -226,3 +223,10 @@ function check_void_bank_trans($type, $type_no)
        return true;
 }
 
+function update_reconcile_date($type, $trans_no, $date=NULL)
+{
+       $sql = "UPDATE ".TB_PREF."bank_trans SET reconciled=".($date ? "'".date2sql($date)."'" : 'NULL')
+               ." WHERE type=" . db_escape($type). " AND trans_no=".db_escape($trans_no);
+
+       db_query($sql, "Can't change reconciliation status");
+}