From: Joe Hunt Date: Tue, 6 Oct 2009 11:47:08 +0000 (+0000) Subject: moved commit_transaction and added a default use_transaction param in write_journal_e... X-Git-Tag: v2.4.2~19^2~1162 X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=6ab1f5d6a2cb8e7d8538d37758e41c39e798c632;p=fa-stable.git moved commit_transaction and added a default use_transaction param in write_journal_entries --- diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 7fda7e23..e43ae66c 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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 diff --git a/gl/includes/db/gl_db_trans.inc b/gl/includes/db/gl_db_trans.inc index 3776a0f0..f4096b7b 100644 --- a/gl/includes/db/gl_db_trans.inc +++ b/gl/includes/db/gl_db_trans.inc @@ -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; }