diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index f43556a8b85..09c006f6f35 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -604,6 +604,17 @@ class Don extends CommonObject if (!$resql) { $this->errors[] = $this->db->lasterror(); $error++; + } else { + // we delete file with dol_delete_dir_recursive + $this->deleteEcmFiles(1); + + $dir = DOL_DATA_ROOT.'/'.$this->element.'/'.$this->ref; + // For remove dir + if (dol_is_dir($dir)) { + if (!dol_delete_dir_recursive($dir)) { + $this->errors[] = $this->error; + } + } } } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index f0e86924b74..f74a93df598 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1221,6 +1221,17 @@ class Ticket extends CommonObject if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); + } else { + // we delete file with dol_delete_dir_recursive + $this->deleteEcmFiles(1); + + $dir = DOL_DATA_ROOT.'/'.$this->element.'/'.$this->ref; + // For remove dir + if (dol_is_dir($dir)) { + if (!dol_delete_dir_recursive($dir)) { + $this->errors[] = $this->error; + } + } } } @@ -2932,7 +2943,7 @@ class Ticket extends CommonObject if (!empty($object->origin_replyto)) { $sendto[$object->origin_replyto] = $object->origin_replyto; - } else if (!empty($object->origin_email)) { + } elseif (!empty($object->origin_email)) { $sendto[$object->origin_email] = $object->origin_email; }