Allow editing account when editing a row in GL Bank and GL Journal Entry
[fa-stable.git] / gl / includes / db / gl_db_trans.inc
index 31c07899976ce54f038b8d22c949c5e20686bef1..b529bd09a60771ee31569133b149332ac101be07 100644 (file)
@@ -393,7 +393,7 @@ function write_journal_entries(&$cart, $reverse, $use_transaction=true)
                begin_transaction();
        
        if(!$new)
-               void_journal_trans($trans_type, $trans_id, true);
+               void_journal_trans($trans_type, $trans_id, false);
 
        foreach ($cart->gl_items as $journal_item)
        {
@@ -492,15 +492,17 @@ function void_gl_trans($type, $trans_id, $nested=false)
 
 //----------------------------------------------------------------------------------------
 
-function void_journal_trans($type, $type_no)
+function void_journal_trans($type, $type_no, $use_transaction=true)
 {
-       begin_transaction();
+       if ($use_transaction)
+               begin_transaction();
 
        void_bank_trans($type, $type_no, true);
 //     void_gl_trans($type, $type_no, true);    // this is done above
 //     void_trans_tax_details($type, $type_no); // ditto
 
-       commit_transaction();
+       if ($use_transaction)
+               commit_transaction();
 }
 
 ?>
\ No newline at end of file