Fix clean of contract

This commit is contained in:
Laurent Destailleur 2020-10-30 14:50:38 +01:00
parent f51b02026c
commit d9ca9fe22d

View File

@ -1237,8 +1237,8 @@ class Contrat extends CommonObject
}
}
if (!$error)
{
// Delete lines
if (!$error) {
// Delete contratdet extrafields
$main = MAIN_DB_PREFIX . 'contratdet';
$ef = $main . "_extrafields";
@ -1268,9 +1268,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;