FIX Must delete extrafields before main table on product deletion.

This commit is contained in:
Laurent Destailleur 2020-12-23 15:00:25 +01:00
parent 33f8c53cca
commit 8658f903fa

View File

@ -1241,6 +1241,16 @@ class Product extends CommonObject
}
}
// Remove extrafields
if (!$error)
{
$result = $this->deleteExtraFields();
if ($result < 0) {
$error++;
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
}
}
// Delete product
if (!$error) {
$sqlz = "DELETE FROM ".MAIN_DB_PREFIX."product";
@ -1268,16 +1278,6 @@ class Product extends CommonObject
}
}
// Remove extrafields
if (!$error)
{
$result = $this->deleteExtraFields();
if ($result < 0) {
$error++;
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
}
}
if (!$error) {
$this->db->commit();
return 1;