diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 7ca82a2751e8b88d1ce9c03684c66670923ffbe7..aef2d5fad3d27572886774283ed3aa844e3d4905 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -240,12 +240,15 @@ if ($action == 'add')
 	}
 
 	$object->note = trim($_POST["note"]);
+
 	if (isset($_POST["contactid"])) $object->contact = $contact;
+
 	if (GETPOST('socid','int') > 0)
 	{
 		$societe = new Societe($db);
 		$societe->fetch(GETPOST('socid','int'));
-		$object->societe = $societe;
+		$object->societe = $societe;	// deprecated
+		$object->thirdparty = $societe;
 	}
 
 	// Special for module webcal and phenix
@@ -359,8 +362,10 @@ if ($action == 'update')
 		$object->priority    = $_POST["priority"];
         $object->fulldayevent= $_POST["fullday"]?1:0;
 		$object->location    = GETPOST('location');
-		$object->societe->id = $_POST["socid"];
-		$object->contact->id = $_POST["contactid"];
+		$object->socid       = $_POST["socid"];
+		$object->contactid   = $_POST["contactid"];
+		$object->societe->id = $_POST["socid"];			// deprecated
+		$object->contact->id = $_POST["contactid"];		// deprecated
 		$object->fk_project  = $_POST["projectid"];
 		$object->note        = $_POST["note"];
 		$object->pnote       = $_POST["note"];
@@ -795,22 +800,16 @@ if ($action == 'create')
 if ($id > 0)
 {
 	$result1=$object->fetch($id);
-	$result2=$object->fetch_userassigned();
-	$result3=$object->fetch_optionals($id,$extralabels);
+	$result2=$object->fetch_thirdparty();
+	$result3=$object->fetch_userassigned();
+	$result4=$object->fetch_optionals($id,$extralabels);
 
-	if ($result1 < 0 || $result2 < 0 || $result3 < 0)
+	if ($result1 < 0 || $result2 < 0 || $result3 < 0 || $result4 < 0)
 	{
 		dol_print_error($db,$object->error);
 		exit;
 	}
 
-	$societe = new Societe($db);
-	if ($object->societe->id)
-	{
-		$result=$societe->fetch($object->societe->id);
-	}
-	$object->societe = $societe;
-
 	if ($object->author->id > 0)   { $tmpuser=new User($db); $res=$tmpuser->fetch($object->author->id); $object->author=$tmpuser; }
 	if ($object->usermod->id > 0)  { $tmpuser=new User($db); $res=$tmpuser->fetch($object->usermod->id); $object->usermod=$tmpuser; }
 	if ($object->usertodo->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->usertodo->id); $object->usertodo=$tmpuser; }
@@ -959,12 +958,12 @@ if ($id > 0)
 			print '<td>';
 			$events=array();
 			$events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
-			print $form->select_company($object->societe->id,'socid','',1,1,0,$events);
+			print $form->select_company($object->thirdparty->id,'socid','',1,1,0,$events);
 			print '</td>';
 
 			// Contact
 			print '<td>'.$langs->trans("Contact").'</td><td width="30%">';
-			$form->select_contacts($object->societe->id, $object->contact->id,'contactid',1);
+			$form->select_contacts($object->thirdparty->id, $object->contact->id,'contactid',1);
 			print '</td></tr>';
 		}
 
@@ -978,7 +977,7 @@ if ($id > 0)
 			$langs->load("project");
 
 			print '<tr><td width="30%" valign="top">'.$langs->trans("Project").'</td><td colspan="3">';
-			$numprojet=$formproject->select_projects($object->societe->id,$object->fk_project,'projectid');
+			$numprojet=$formproject->select_projects($object->thirdparty->id,$object->fk_project,'projectid');
 			if ($numprojet==0)
 			{
 				print ' &nbsp; <a href="../../projet/card.php?socid='.$societe->id.'&action=create">'.$langs->trans("AddProject").'</a>';
@@ -1152,12 +1151,12 @@ if ($id > 0)
 		// Third party - Contact
 		if ($conf->societe->enabled)
 		{
-			print '<tr><td width="30%">'.$langs->trans("ActionOnCompany").'</td><td>'.($object->societe->id?$object->societe->getNomUrl(1):$langs->trans("None"));
-			if ($object->societe->id && $object->type_code == 'AC_TEL')
+			print '<tr><td width="30%">'.$langs->trans("ActionOnCompany").'</td><td>'.($object->thirdparty->id?$object->thirdparty->getNomUrl(1):$langs->trans("None"));
+			if (is_object($object->thirdparty) && $object->thirdparty->id > 0 && $object->type_code == 'AC_TEL')
 			{
-				if ($object->societe->fetch($object->societe->id))
+				if ($object->thirdparty->fetch($object->thirdparty->id))
 				{
-					print "<br>".dol_print_phone($object->societe->phone);
+					print "<br>".dol_print_phone($object->thirdparty->phone);
 				}
 			}
 			print '</td>';
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index ffe07614b7df40ad425eb7ec71106bd162be9f88..1d7cf0efd6893b89e06b394d24a8a4bf4822c2bb 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -192,10 +192,10 @@ class ActionComm extends CommonObject
         $sql.= (isset($this->durationp) && $this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null").",";	// deprecated
         $sql.= (isset($this->type_id)?$this->type_id:"null").",";
         $sql.= (isset($this->code)?" '".$this->code."'":"null").",";
-        $sql.= (isset($this->societe->id) && $this->societe->id > 0?" '".$this->societe->id."'":"null").",";
+        $sql.= (isset($this->socid) && $this->socid > 0?" '".$this->socid."'":"null").",";
         $sql.= (isset($this->fk_project) && $this->fk_project > 0?" '".$this->fk_project."'":"null").",";
         $sql.= " '".$this->db->escape($this->note)."',";
-        $sql.= (isset($this->contact->id) && $this->contact->id > 0?"'".$this->contact->id."'":"null").",";
+        $sql.= (isset($this->contactid) && $this->contactid > 0?"'".$this->contactid."'":"null").",";
         $sql.= (isset($user->id) && $user->id > 0 ? "'".$user->id."'":"null").",";
         $sql.= (isset($this->usertodo->id) && $this->usertodo->id > 0?"'".$this->usertodo->id."'":"null").",";
         $sql.= (isset($this->userdone->id) && $this->userdone->id > 0?"'".$this->userdone->id."'":"null").",";
@@ -358,10 +358,12 @@ class ActionComm extends CommonObject
                 $this->location				= $obj->location;
                 $this->transparency			= $obj->transparency;
 
-                $this->socid				= $obj->fk_soc;	// To have fetch_thirdparty method working
-                $this->societe->id			= $obj->fk_soc;
-                $this->contact->id			= $obj->fk_contact;
-                $this->fk_project			= $obj->fk_project;
+                $this->socid				= $obj->fk_soc;			// To have fetch_thirdparty method working
+                $this->contactid			= $obj->fk_contact;
+                $this->fk_project			= $obj->fk_project;		// To have fetch_project method working
+
+                $this->societe->id			= $obj->fk_soc;			// For backward compatibility
+                $this->contact->id			= $obj->fk_contact;		// For backward compatibility
 
                 $this->fk_element			= $obj->fk_element;
                 $this->elementtype			= $obj->elementtype;
diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php
index b000d2017d747a2238303def934690b269362a63..0556e532f35ae96e5908af8a6b2a5df7aa95531d 100644
--- a/htdocs/comm/action/document.php
+++ b/htdocs/comm/action/document.php
@@ -60,12 +60,7 @@ $object = new ActionComm($db);
 if ($objectid > 0)
 {
 	$ret = $object->fetch($objectid);
-	if ($ret > 0) {
-		$company=new Societe($db);
-		$company->fetch($object->societe->id);
-		$object->societe=$company; // For backward compatibility
-		$object->thirdparty=$company;
-	}
+	$object->fetch_thirdparty();
 }
 
 // Get parameters
@@ -112,7 +107,7 @@ if ($object->id > 0)
 
 	$now=dol_now();
 	$delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60;
-	
+
 	dol_fiche_head($head, 'documents', $langs->trans("Action"),0,'action');
 
 	// Affichage fiche action en mode visu
@@ -202,17 +197,17 @@ if ($object->id > 0)
 	print '<tr><td width="30%" class="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td>';
 	if ($object->usertodo->id > 0) print $object->usertodo->getNomUrl(1);
 	print '</td></tr>';
-	
+
 	print '</table><br><br><table class="border" width="100%">';
 
 
 	// Third party - Contact
-	print '<tr><td width="30%">'.$langs->trans("ActionOnCompany").'</td><td>'.($object->societe->id?$object->societe->getNomUrl(1):$langs->trans("None"));
-	if ($object->societe->id && $object->type_code == 'AC_TEL')
+	print '<tr><td width="30%">'.$langs->trans("ActionOnCompany").'</td><td>'.($object->thirdparty->id?$object->thirdparty->getNomUrl(1):$langs->trans("None"));
+	if (is_object($object->thirdparty) && $object->thirdparty->id > 0 && $object->type_code == 'AC_TEL')
 	{
-		if ($object->societe->fetch($object->societe->id))
+		if ($object->thirdparty->fetch($object->thirdparty->id))
 		{
-			print "<br>".dol_print_phone($object->societe->phone);
+			print "<br>".dol_print_phone($object->thirdparty->phone);
 		}
 	}
 	print '</td>';
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index 7fb6c6e373a6728615a27a59f0d35afb20443861..fb7da8636b274c518f889cfa0a40fd260089eefe 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -323,8 +323,6 @@ class Project extends CommonObject
                 $this->note_private = $obj->note_private;
                 $this->note_public = $obj->note_public;
                 $this->socid = $obj->fk_soc;
-                $this->societe=(object)array();// To avoid warning on next line
-                $this->societe->id = $obj->fk_soc; // TODO For backward compatibility
                 $this->user_author_id = $obj->fk_user_creat;
                 $this->public = $obj->public;
                 $this->statut = $obj->fk_statut;
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index 5177bb3dbede1b9f7d329784cb95f5dfcc8f47e5..72db0966699ffa80e6dc4968da9060619a6ab7ba 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -72,8 +72,10 @@ class User extends CommonObject
 	var $datem;
 
 	//! If this is defined, it is an external user
-	var $societe_id;
-	var $contact_id;
+	var $societe_id;	// deprecated
+	var $contact_id;	// deprecated
+	var $socid;
+	var $contactid;
 
 	var $fk_member;
 	var $fk_user;
@@ -237,8 +239,10 @@ class User extends CommonObject
 				$this->datelastlogin		= $this->db->jdate($obj->datel);
 				$this->datepreviouslogin	= $this->db->jdate($obj->datep);
 
-				$this->societe_id           = $obj->fk_societe;
-				$this->contact_id           = $obj->fk_socpeople;
+				$this->societe_id           = $obj->fk_societe;		// deprecated
+				$this->contact_id           = $obj->fk_socpeople;	// deprecated
+				$this->socid                = $obj->fk_societe;
+				$this->contactid            = $obj->fk_socpeople;
 				$this->fk_member            = $obj->fk_member;
 				$this->fk_user        		= $obj->fk_user;
 
diff --git a/htdocs/webservices/server_actioncomm.php b/htdocs/webservices/server_actioncomm.php
index d5d9c45fa362c71e66c885a1a3cbb691eea0b421..2a41a7693142ec34a8d99569233233cce5ca1f41 100644
--- a/htdocs/webservices/server_actioncomm.php
+++ b/htdocs/webservices/server_actioncomm.php
@@ -433,10 +433,10 @@ function createActionComm($authentication,$actioncomm)
 		$newobject->datep=$actioncomm['datep'];
 		$newobject->datef=$actioncomm['datef'];
 		$newobject->type_code=$actioncomm['type_code'];
-		$newobject->societe->id=$actioncomm['socid'];
+		$newobject->socid=$actioncomm['socid'];
 		$newobject->fk_project=$actioncomm['projectid'];
 		$newobject->note=$actioncomm['note'];
-		$newobject->contact->id=$actioncomm['contactid'];
+		$newobject->contactid=$actioncomm['contactid'];
 		$newobject->usertodo->id=$actioncomm['usertodo'];
 		$newobject->userdone->id=$actioncomm['userdone'];
 		$newobject->label=$actioncomm['label'];
@@ -517,21 +517,21 @@ function updateActionComm($authentication,$actioncomm)
 	if (! $error)
 	{
 		$objectfound=false;
-		
+
 		$object=new ActionComm($db);
 		$result=$object->fetch($actioncomm['id']);
-		
+
 		if (!empty($object->id)) {
-		
+
 			$objectfound=true;
 
 			$object->datep=$actioncomm['datep'];
 			$object->datef=$actioncomm['datef'];
 			$object->type_code=$actioncomm['type_code'];
-			$object->societe->id=$actioncomm['socid'];
+			$object->socid=$actioncomm['socid'];
+			$object->contactid=$actioncomm['contactid'];
 			$object->fk_project=$actioncomm['projectid'];
 			$object->note=$actioncomm['note'];
-			$object->contact->id=$actioncomm['contactid'];
 			$object->usertodo->id=$actioncomm['usertodo'];
 			$object->userdone->id=$actioncomm['userdone'];
 			$object->label=$actioncomm['label'];
@@ -541,7 +541,7 @@ function updateActionComm($authentication,$actioncomm)
 			$object->location=$actioncomm['location'];
 			$object->fk_element=$actioncomm['fk_element'];
 			$object->elementtype=$actioncomm['elementtype'];
-	
+
 			//Retreive all extrafield for actioncomm
 			// fetch optionals attributes and labels
 			$extrafields=new ExtraFields($db);
@@ -551,7 +551,7 @@ function updateActionComm($authentication,$actioncomm)
 				$key='options_'.$key;
 				$object->array_options[$key]=$actioncomm[$key];
 			}
-	
+
 			$db->begin();
 
 			$result=$object->update($fuser);