diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 7ca82a2751e..aef2d5fad3d 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 '
| '.$langs->trans("ActionOnCompany").' | '.($object->societe->id?$object->societe->getNomUrl(1):$langs->trans("None")); - if ($object->societe->id && $object->type_code == 'AC_TEL') + print ' |
| '.$langs->trans("ActionOnCompany").' | '.($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 " ".dol_print_phone($object->societe->phone); + print " ".dol_print_phone($object->thirdparty->phone); } } print ' | ';
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index 7fb6c6e373a..fb7da8636b2 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 5177bb3dbed..72db0966699 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 d5d9c45fa36..2a41a769314 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);