diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 3e10ea82eaa..de19d651ba2 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9472,6 +9472,12 @@ abstract class CommonObject } } + // Delete linked object + $res = $this->deleteObjectLinked(); + if ($res < 0) { + $error++; + } + // Commit or rollback if ($error) { $this->db->rollback(); diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 9aa1ef5bd8e..d186c6e533b 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -744,31 +744,8 @@ class Mo extends CommonObject */ public function delete(User $user, $notrigger = false) { - $this->db->begin(); - - $error = 0; - - // Delete linked object - $res = $this->deleteObjectLinked(); - if ($res < 0) { - $error++; - } - - if(!$error){ - $res = $this->deleteCommon($user, $notrigger); - if($res < 0){ - $error++; - } - } - - if(!$error){ - dol_syslog(get_class($this)."::delete ".$this->id." by ".$user->id, LOG_DEBUG); - $this->db->commit(); - return $res; - } else { - $this->db->rollback(); - return -1; - } + return $this->deleteCommon($user, $notrigger); + //return $this->deleteCommon($user, $notrigger, 1); } /**