moved commit_transaction and added a default use_transaction param in write_journal_e...
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Tue, 6 Oct 2009 11:47:08 +0000 (11:47 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Tue, 6 Oct 2009 11:47:08 +0000 (11:47 +0000)
CHANGELOG.txt
gl/includes/db/gl_db_trans.inc

index 7fda7e2397e9a4e2ee8a41a2d5d087dc65045930..e43ae66cb9f6c998afea52cbb86c2320cbbc2db5 100644 (file)
@@ -19,6 +19,10 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+06-Oct-2009 Tom Hallman
+# moved commit_transaction and added a default use_transaction param in write_journal_entries
+$ /gl/include/db/gl_db_trans.inc
+
 03-Oct-2009 Joe Hunt
 # Bad conversion of timestamp value in report audit trail.
 $ /reporting/rep710.php
index 3776a0f07ee12ca687adddcabfea5da5a18b4bd0..f4096b7b8dbeb07e515d1e6184d885a5c9e7604f 100644 (file)
@@ -354,7 +354,7 @@ function get_tax_summary($from, $to)
 //--------------------------------------------------------------------------------
 // Write/update journal entries.
 //
-function write_journal_entries(&$cart, $reverse)
+function write_journal_entries(&$cart, $reverse, $use_transaction=true)
 {
        global $Refs;
 
@@ -365,7 +365,8 @@ function write_journal_entries(&$cart, $reverse)
        $trans_type = $cart->trans_type;
        $trans_id = $new ? get_next_trans_no($trans_type) : $cart->order_id;
 
-       begin_transaction();
+       if ($use_transaction)
+               begin_transaction();
        
        if($new) {
                $cart->order_id = $trans_id;
@@ -401,8 +402,6 @@ function write_journal_entries(&$cart, $reverse)
 
        add_audit_trail($trans_type, $trans_id, $date_);
 
-       commit_transaction();
-
        if ($reverse)
        {
        //$reversingDate = date(user_date_display(),
@@ -436,6 +435,9 @@ function write_journal_entries(&$cart, $reverse)
                add_audit_trail($trans_type, $trans_id_reverse, $reversingDate);
        }
 
+       if ($use_transaction)
+               commit_transaction();
+
        return $trans_id;
 }