diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 579efd5ddc5..31730353ea1 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1255,8 +1255,8 @@ class Contrat extends CommonObject } } - if (!$error) - { + // Delete lines + if (!$error) { // Delete contratdet extrafields $main = MAIN_DB_PREFIX.'contratdet'; $ef = $main."_extrafields"; @@ -1286,9 +1286,21 @@ class Contrat extends CommonObject } } + // Delete llx_ecm_files + if (!$error) { + $sql = 'DELETE FROM '.MAIN_DB_PREFIX."ecm_files WHERE src_object_type = '".$this->db->escape($this->table_element.(empty($this->module) ? '' : '@'.$this->module))."' AND src_object_id = ".$this->id; + $resql = $this->db->query($sql); + if (!$resql) + { + $this->error = $this->db->lasterror(); + $this->errors[] = $this->error; + $error++; + } + } + + // Delete contract if (!$error) { - // Delete contrat $sql = "DELETE FROM ".MAIN_DB_PREFIX."contrat"; $sql .= " WHERE rowid=".$this->id;