From 503435689974ad2a2fc9491cb96aac3922808590 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Ferry?= <jfefe@aternatik.fr>
Date: Sun, 16 Mar 2014 16:06:32 +0100
Subject: [PATCH] Manage extrafields deletion on categories

---
 htdocs/categories/class/categorie.class.php | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index f645739d25e..4c15c006cab 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -402,6 +402,19 @@ class Categorie extends CommonObject
 			}
 			else
 			{
+				// Removed extrafields
+				if (! $error)
+				{
+					if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
+					{
+						$result=$this->deleteExtraFields();
+						if ($result < 0)
+						{
+							$error++;
+							dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
+						}
+					}
+				}
 				// Appel des triggers
 				include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
 				$interface=new Interfaces($this->db);
-- 
GitLab