diff --git a/htdocs/categories/admin/categorie_extrafields.php b/htdocs/categories/admin/categorie_extrafields.php
index 6291d2065c258ea59469ba82f7b59de1ae5b5b63..c72ef73e970819049ada6316f08fa0a91759699a 100644
--- a/htdocs/categories/admin/categorie_extrafields.php
+++ b/htdocs/categories/admin/categorie_extrafields.php
@@ -41,7 +41,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
 
 $action=GETPOST('action', 'alpha');
 $attrname=GETPOST('attrname', 'alpha');
-$elementtype='categories'; //Must be the $element of the class that manage extrafield
+$elementtype='categorie'; //Must be the $element of the class that manage extrafield
 
 if (!$user->admin) accessforbidden();
 
diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index 1b292b9e4703d56f13ecaab9be22b9d7fd97d623..ecf95c5096db35c3a6cca6e39be33046140b0e89 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -51,7 +51,7 @@ class Categorie extends CommonObject
 	const TYPE_USER = 4;       // categorie contact and user are same !   TODO Replace this value with 'user'
 
     const TYPE_ACCOUNT = 5;    // TODO Replace this value with 'bank_account'
-	const TYPE_PROJECT = 6;
+	const TYPE_PROJECT = 6;    // TODO Replace this value with 'project'
     const TYPE_BANK_LINE = 'bank_line';
 	public $picto = 'category';
 
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 1a26fba6b23fa6fa534a6299ad148c96b244c859..ab6013b74eef6a59750d8b5b5bbdc7256521f870 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -4169,6 +4169,9 @@ abstract class CommonObject
             $optionsArray = $extrafields->attributes[$this->table_element]['label'];
         }
 
+        $table_element = $this->table_element;
+        if ($table_element == 'categorie') $table_element = 'categories'; // For compatibility
+
         // Request to get complementary values
         if (count($optionsArray) > 0)
         {
@@ -4180,7 +4183,7 @@ abstract class CommonObject
                     $sql.= ", ".$name;
                 }
             }
-            $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields";
+            $sql.= " FROM ".MAIN_DB_PREFIX.$table_element."_extrafields";
             $sql.= " WHERE fk_object = ".$rowid;
 
             dol_syslog(get_class($this)."::fetch_optionals get extrafields data for ".$this->table_element, LOG_DEBUG);
@@ -4335,11 +4338,14 @@ abstract class CommonObject
             }
             $this->db->begin();
 
-            $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id;
+            $table_element = $this->table_element;
+            if ($table_element == 'categorie') $table_element = 'categories'; // For compatibility
+
+            $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$table_element."_extrafields WHERE fk_object = ".$this->id;
             dol_syslog(get_class($this)."::insertExtraFields delete", LOG_DEBUG);
             $this->db->query($sql_del);
 
-            $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object";
+            $sql = "INSERT INTO ".MAIN_DB_PREFIX.$table_element."_extrafields (fk_object";
             foreach($new_array_options as $key => $value)
             {
             	$attributeKey = substr($key,8);   // Remove 'options_' prefix
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index 4b5f151ec72500430b49f49fd0959b69cac81f17..e44fa8a5aeccfb531067db7c30a8e67602cfb992 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -197,6 +197,7 @@ class ExtraFields
 		if ($elementtype == 'contact') $elementtype='socpeople';
 
 		$table=$elementtype.'_extrafields';
+		if ($elementtype == 'categorie') $table='categories_extrafields';
 
 		if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9_]*$/",$attrname) && ! is_numeric($attrname))
 		{
@@ -350,6 +351,7 @@ class ExtraFields
 		if ($elementtype == 'contact') $elementtype='socpeople';
 
 		$table=$elementtype.'_extrafields';
+		if ($elementtype == 'categorie') $table='categories_extrafields';
 
 		$error=0;
 
@@ -460,6 +462,7 @@ class ExtraFields
 		if ($elementtype == 'contact') $elementtype='socpeople';
 
 		$table=$elementtype.'_extrafields';
+		if ($elementtype == 'categorie') $table='categories_extrafields';
 
 		if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
 		{
diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql
index edb63662e65a613878a4b61a5b712bdfbaff48e5..721e35505bb7c07e6ed4e483dc6bfa321eb56696 100644
--- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql
+++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql
@@ -519,6 +519,9 @@ ALTER TABLE llx_website_page ADD UNIQUE INDEX uk_website_page_url (fk_website,pa
 ALTER TABLE llx_website_page ADD CONSTRAINT fk_website_page_website FOREIGN KEY (fk_website) REFERENCES llx_website (rowid);
 
 
+UPDATE llx_extrafields set elementtype='categorie' where elementtype='categories';
+
+
 -- For new module blockedlog
 
 CREATE TABLE llx_blockedlog