diff --git a/lib/base/dao/dao.class.php b/lib/base/dao/dao.class.php index 768a766553..6a804a6fef 100644 --- a/lib/base/dao/dao.class.php +++ b/lib/base/dao/dao.class.php @@ -496,7 +496,7 @@ class baseDAO */ public function begin() { - $this->dbh->beginTransaction(); + if(!$this->dbh->inTransaction()) $this->dbh->beginTransaction(); } /** @@ -520,7 +520,7 @@ class baseDAO */ public function rollBack() { - $this->dbh->rollBack(); + if($this->dbh->inTransaction()) $this->dbh->rollBack(); } /** @@ -532,7 +532,7 @@ class baseDAO */ public function commit() { - $this->dbh->commit(); + if($this->dbh->inTransaction()) $this->dbh->commit(); } /** @@ -1171,8 +1171,7 @@ class baseDAO return 0; } - $inTransaction = $this->inTransaction(); - if(!$inTransaction) $this->begin(); + $this->begin(); foreach($indexes as $fields) { @@ -1191,11 +1190,8 @@ class baseDAO $result = $this->insert($table)->data($processedData)->exec(); - if(!$inTransaction) - { - if(!$result) $this->rollback(); - $this->commit(); - } + if(!$result) $this->rollback(); + $this->commit(); return $result; } diff --git a/module/task/control.php b/module/task/control.php index 7676145466..17129e5df4 100755 --- a/module/task/control.php +++ b/module/task/control.php @@ -90,7 +90,7 @@ class task extends control if(dao::isError()) { - if($this->dao->inTransaction()) $this->dao->rollBack(); + $this->dao->rollBack(); return $this->send(array('result' => 'fail', 'message' => dao::getError())); } diff --git a/module/task/model.php b/module/task/model.php index 4258cf70cf..75c536adfa 100755 --- a/module/task/model.php +++ b/module/task/model.php @@ -1020,7 +1020,7 @@ class taskModel extends model $this->dao->insert(TABLE_TASKSPEC)->data($taskSpec)->autoCheck()->exec(); if(dao::isError()) return false; - if($this->dao->inTransaction()) $this->dao->commit(); + $this->dao->commit(); if($createAction) {