Update api_contacts.class.php
This commit is contained in:
parent
c1ba61e548
commit
0d50402803
@ -63,13 +63,13 @@ class Contacts extends DolibarrApi
|
|||||||
* Return an array with contact informations
|
* Return an array with contact informations
|
||||||
*
|
*
|
||||||
* @param int $id ID of contact
|
* @param int $id ID of contact
|
||||||
* @param int $includeroles Includes roles of the contact
|
|
||||||
* @param int $includecount Count and return also number of elements the contact is used as a link for
|
* @param int $includecount Count and return also number of elements the contact is used as a link for
|
||||||
|
* @param int $includeroles Includes roles of the contact
|
||||||
* @return array|mixed data without useless information
|
* @return array|mixed data without useless information
|
||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
public function get($id, $includeroles = 0, $includecount = 0)
|
public function get($id, $includecount = 0, $includeroles = 0)
|
||||||
{
|
{
|
||||||
if (!DolibarrApiAccess::$user->rights->societe->contact->lire)
|
if (!DolibarrApiAccess::$user->rights->societe->contact->lire)
|
||||||
{
|
{
|
||||||
@ -91,15 +91,15 @@ class Contacts extends DolibarrApi
|
|||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($includeroles)
|
|
||||||
{
|
|
||||||
$this->contact->fetchRoles();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($includecount)
|
if ($includecount)
|
||||||
{
|
{
|
||||||
$this->contact->load_ref_elements();
|
$this->contact->load_ref_elements();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($includeroles)
|
||||||
|
{
|
||||||
|
$this->contact->fetchRoles();
|
||||||
|
}
|
||||||
|
|
||||||
return $this->_cleanObjectDatas($this->contact);
|
return $this->_cleanObjectDatas($this->contact);
|
||||||
}
|
}
|
||||||
@ -108,8 +108,8 @@ class Contacts extends DolibarrApi
|
|||||||
* Get properties of a contact object by Email
|
* Get properties of a contact object by Email
|
||||||
*
|
*
|
||||||
* @param string $email Email of contact
|
* @param string $email Email of contact
|
||||||
* @param int $includeroles Includes roles of the contact
|
|
||||||
* @param int $includecount Count and return also number of elements the contact is used as a link for
|
* @param int $includecount Count and return also number of elements the contact is used as a link for
|
||||||
|
* @param int $includeroles Includes roles of the contact
|
||||||
* @return array|mixed data without useless information
|
* @return array|mixed data without useless information
|
||||||
*
|
*
|
||||||
* @url GET email/{email}
|
* @url GET email/{email}
|
||||||
@ -117,7 +117,7 @@ class Contacts extends DolibarrApi
|
|||||||
* @throws RestException 401 Insufficient rights
|
* @throws RestException 401 Insufficient rights
|
||||||
* @throws RestException 404 User or group not found
|
* @throws RestException 404 User or group not found
|
||||||
*/
|
*/
|
||||||
public function getByEmail($email, $includeroles = 0, $includecount = 0)
|
public function getByEmail($email, $includecount = 0, $includeroles = 0)
|
||||||
{
|
{
|
||||||
if (!DolibarrApiAccess::$user->rights->societe->contact->lire)
|
if (!DolibarrApiAccess::$user->rights->societe->contact->lire)
|
||||||
{
|
{
|
||||||
@ -140,16 +140,16 @@ class Contacts extends DolibarrApi
|
|||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($includeroles)
|
|
||||||
{
|
|
||||||
$this->contact->fetchRoles();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($includecount)
|
if ($includecount)
|
||||||
{
|
{
|
||||||
$this->contact->load_ref_elements();
|
$this->contact->load_ref_elements();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($includeroles)
|
||||||
|
{
|
||||||
|
$this->contact->fetchRoles();
|
||||||
|
}
|
||||||
|
|
||||||
return $this->_cleanObjectDatas($this->contact);
|
return $this->_cleanObjectDatas($this->contact);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,13 +165,13 @@ class Contacts extends DolibarrApi
|
|||||||
* @param string $thirdparty_ids Thirdparty ids to filter contacts of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i}
|
* @param string $thirdparty_ids Thirdparty ids to filter contacts of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i}
|
||||||
* @param int $category Use this param to filter list by category
|
* @param int $category Use this param to filter list by category
|
||||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
|
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
|
||||||
* @param int $includeroles Includes roles of the contact
|
|
||||||
* @param int $includecount Count and return also number of elements the contact is used as a link for
|
* @param int $includecount Count and return also number of elements the contact is used as a link for
|
||||||
|
* @param int $includeroles Includes roles of the contact
|
||||||
* @return array Array of contact objects
|
* @return array Array of contact objects
|
||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $category = 0, $sqlfilters = '', $includeroles = 0, $includecount = 0)
|
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $category = 0, $sqlfilters = '', $includecount = 0, $includeroles = 0)
|
||||||
{
|
{
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
@ -256,14 +256,15 @@ class Contacts extends DolibarrApi
|
|||||||
if ($contact_static->fetch($obj->rowid))
|
if ($contact_static->fetch($obj->rowid))
|
||||||
{
|
{
|
||||||
$contact_static->fetchRoles();
|
$contact_static->fetchRoles();
|
||||||
|
if ($includecount)
|
||||||
|
{
|
||||||
|
$contact_static->load_ref_elements();
|
||||||
|
}
|
||||||
if ($includeroles)
|
if ($includeroles)
|
||||||
{
|
{
|
||||||
$contact_static->fetchRoles();
|
$contact_static->fetchRoles();
|
||||||
}
|
}
|
||||||
if ($includecount)
|
|
||||||
{
|
|
||||||
$contact_static->load_ref_elements();
|
|
||||||
}
|
|
||||||
$obj_ret[] = $this->_cleanObjectDatas($contact_static);
|
$obj_ret[] = $this->_cleanObjectDatas($contact_static);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user