fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [11316] property: fix nested transaction


From: Sigurd Nes
Subject: [Fmsystem-commits] [11316] property: fix nested transaction
Date: Tue, 24 Sep 2013 10:05:32 +0000

Revision: 11316
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11316
Author:   sigurdne
Date:     2013-09-24 10:05:31 +0000 (Tue, 24 Sep 2013)
Log Message:
-----------
property: fix nested transaction

Modified Paths:
--------------
    trunk/controller/inc/class.socase.inc.php

Modified: trunk/controller/inc/class.socase.inc.php
===================================================================
--- trunk/controller/inc/class.socase.inc.php   2013-09-24 09:25:21 UTC (rev 
11315)
+++ trunk/controller/inc/class.socase.inc.php   2013-09-24 10:05:31 UTC (rev 
11316)
@@ -35,6 +35,7 @@
        class controller_socase extends controller_socommon
        {
                protected static $so;
+               protected $global_lock = false;
 
                /**
                 * Get a static reference to the storage object associated with 
this model object
@@ -250,7 +251,14 @@
                */
                function update($case)
                {
-                       $this->db->transaction_begin();
+                       if ( $this->db->get_transaction() )
+                       {
+                               $this->global_lock = true;
+                       }
+                       else
+                       {
+                               $this->db->transaction_begin();
+                       }
 
                        $id = (int) $case->get_id();
                        
@@ -270,10 +278,15 @@
 
                        $result = $this->db->query('UPDATE 
controller_check_item_case SET ' . join(',', $values) . " WHERE id=$id", 
__LINE__,__FILE__);
 
-                       
$this->update_cases_on_check_list($case->get_check_item_id());
+                       $ok = 
$this->update_cases_on_check_list($case->get_check_item_id());
 
-                       if($this->db->transaction_commit())
+                       if ( !$this->global_lock )
                        {
+                               $this->db->transaction_commit();
+                       }
+
+                       if($ok)
+                       {
                                return $id;
                        }
                        else




reply via email to

[Prev in Thread] Current Thread [Next in Thread]