diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 98e70cf66b7..7f9c87ab7a7 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1806,7 +1806,7 @@ class User extends CommonObject $adh->pass = $this->pass; - $adh->societe = (empty($adh->societe) && $this->societe_id ? $this->societe_id : $adh->societe); + //$adh->societe = (empty($adh->societe) && $this->societe_id ? $this->societe_id : $adh->societe); $adh->address = $this->address; $adh->town = $this->town; diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php index 6fc521a43c7..97b219c7aba 100644 --- a/htdocs/webservices/server_contact.php +++ b/htdocs/webservices/server_contact.php @@ -270,10 +270,10 @@ function getContact($authentication, $id, $ref_ext) if ($result > 0) { // Only internal user who have contact read permission - // Or for external user who have contact read permission, with restrict on societe_id + // Or for external user who have contact read permission, with restrict on socid if ( - $fuser->rights->societe->contact->lire && !$fuser->societe_id - || ($fuser->rights->societe->contact->lire && ($fuser->societe_id == $contact->socid)) + $fuser->rights->societe->contact->lire && !$fuser->socid + || ($fuser->rights->societe->contact->lire && ($fuser->socid == $contact->socid)) ) { $contact_result_fields = array( 'id' => $contact->id, diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 361b2a08f4a..5cc964dde4e 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -367,7 +367,7 @@ function getOrder($authentication, $id = '', $ref = '', $ref_ext = '') $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); - if ($fuser->societe_id) $socid = $fuser->societe_id; + if ($fuser->socid) $socid = $fuser->socid; // Check parameters if (!$error && (($id && $ref) || ($id && $ref_ext) || ($ref && $ref_ext))) @@ -516,7 +516,7 @@ function getOrdersForThirdParty($authentication, $idthirdparty) $error = 0; $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); - if ($fuser->societe_id) $socid = $fuser->societe_id; + if ($fuser->socid) $socid = $fuser->socid; // Check parameters if (!$error && empty($idthirdparty)) diff --git a/htdocs/webservices/server_other.php b/htdocs/webservices/server_other.php index 61f53f7e275..3494f928cde 100644 --- a/htdocs/webservices/server_other.php +++ b/htdocs/webservices/server_other.php @@ -208,7 +208,7 @@ function getDocument($authentication, $modulepart, $file, $refname = '') $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); - if ($fuser->societe_id) $socid = $fuser->societe_id; + if ($fuser->socid) $socid = $fuser->socid; // Check parameters if (!$error && (!$file || !$modulepart)) @@ -234,7 +234,7 @@ function getDocument($authentication, $modulepart, $file, $refname = '') $original_file = $check_access['original_file']; // Basic protection (against external users only) - if ($fuser->societe_id > 0) + if ($fuser->socid > 0) { if ($sqlprotectagainstexternals) { @@ -246,7 +246,7 @@ function getDocument($authentication, $modulepart, $file, $refname = '') while ($i < $num) { $obj = $db->fetch_object($resql); - if ($fuser->societe_id != $obj->fk_soc) + if ($fuser->socid != $obj->fk_soc) { $accessallowed = 0; break; diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index 8619a952ea1..6c4e472d1c7 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -485,7 +485,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser) $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); - if ($fuser->societe_id) $socid = $fuser->societe_id; + if ($fuser->socid) $socid = $fuser->socid; if (!$error && !$thirdpartywithuser) { @@ -502,7 +502,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser) $thirdparty = new Societe($db); // If a contact / company already exists with the email, return the corresponding socid - $sql = "SELECT s.rowid as societe_id FROM ".MAIN_DB_PREFIX."societe as s"; + $sql = "SELECT s.rowid as socid FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON sp.fk_soc = s.rowid"; $sql .= " WHERE s.entity=".$conf->entity; $sql .= " AND s.email='".$db->escape($thirdpartywithuser['email'])."'"; @@ -690,7 +690,7 @@ function setUserPassword($authentication, $shortuser) $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); - if ($fuser->societe_id) $socid = $fuser->societe_id; + if ($fuser->socid) $socid = $fuser->socid; if (!$error && !$shortuser) {