diff --git a/lib/base/dao/dao.class.php b/lib/base/dao/dao.class.php index ad118b8f54..2f7ee95be9 100644 --- a/lib/base/dao/dao.class.php +++ b/lib/base/dao/dao.class.php @@ -492,11 +492,11 @@ class baseDAO * Begin Transaction * * @access public - * @return void + * @return bool */ - public function begin() + public function begin(): bool { - if(!$this->dbh->inTransaction()) $this->dbh->beginTransaction(); + return $this->dbh->beginTransaction(); } /** @@ -506,7 +506,7 @@ class baseDAO * @access public * @return bool */ - public function inTransaction() + public function inTransaction(): bool { return $this->dbh->inTransaction(); } @@ -516,11 +516,11 @@ class baseDAO * Roll back * * @access public - * @return void + * @return bool */ - public function rollBack() + public function rollBack(): bool { - if($this->dbh->inTransaction()) $this->dbh->rollBack(); + return $this->dbh->rollBack(); } /** @@ -528,11 +528,11 @@ class baseDAO * Commits a transaction. * * @access public - * @return void + * @return bool */ - public function commit() + public function commit(): bool { - if($this->dbh->inTransaction()) $this->dbh->commit(); + return $this->dbh->commit(); } /** diff --git a/lib/dbh/dbh.class.php b/lib/dbh/dbh.class.php index 89aa19f1b2..c955da0c0b 100644 --- a/lib/dbh/dbh.class.php +++ b/lib/dbh/dbh.class.php @@ -1059,7 +1059,7 @@ class dbh */ public function beginTransaction() { - return $this->pdo->beginTransaction(); + return $this->pdo->inTransaction() ? false : $this->pdo->beginTransaction(); } /** @@ -1081,7 +1081,7 @@ class dbh */ public function rollBack() { - return $this->pdo->rollBack(); + return $this->pdo->inTransaction() ? $this->pdo->rollBack() : false; } /** @@ -1092,7 +1092,7 @@ class dbh */ public function commit() { - return $this->pdo->commit(); + return $this->pdo->inTransaction() ? $this->pdo->commit() : false; } /**