From 8658f903fa633174050e80efcdd49c06ef476493 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Dec 2020 15:00:25 +0100 Subject: [PATCH] FIX Must delete extrafields before main table on product deletion. --- htdocs/product/class/product.class.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index ccca1a85f47..0ec669afad8 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -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;