Contacts
class Contacts extends DolibarrApi (View source)
API class for contacts
Properties
| protected DoliDB | $db | from DolibarrApi | |
| Restler | $r | from DolibarrApi | |
| static string[] | $FIELDS | ||
| Contact | $contact |
Methods
Constructor
Check and convert a string depending on its type/name.
Filter properties that will be returned on object
Clean sensible object data
Check access by user to a given resource
Return if a $sqlfilters parameter is valid Function no more used. Kept for backward compatibility with old APIs of modules
Function to forge a SQL criteria from a Generic filter string.
Get a contact
Get a contact by Email
List contacts
Create a contact
Update a contact
Delete a contact
Create a user account object from contact (external user)
Get categories of a contact
Add a category to a contact
Remove the link between a category and a contact
Details
__construct()
Constructor
protected string|array<string, mixed>
_checkValForAPI(string $field, string|string[] $value, object $object)
Check and convert a string depending on its type/name.
protected object
_filterObjectProperties(object $object, string $properties)
Filter properties that will be returned on object
protected object
_cleanObjectDatas(object $object)
Clean sensible object data
static protected bool
_checkAccessToResource(string $resource, int $resource_id = 0, string $dbtablename = '', string $feature2 = '', string $dbt_keyfield = 'fk_soc', string $dbt_select = 'rowid')
Check access by user to a given resource
protected bool|string
_checkFilters(string $sqlfilters, string $error = '')
Return if a $sqlfilters parameter is valid Function no more used. Kept for backward compatibility with old APIs of modules
static protected string
_forge_criteria_callback(string[] $matches)
Function to forge a SQL criteria from a Generic filter string.
Function no more used. Kept for backward compatibility with old APIs of modules
object
get(int $id, int $includecount = 0, int $includeroles = 0)
Get a contact
Return an array with contact information
array|mixed
getByEmail(string $email, int $includecount = 0, int $includeroles = 0)
Get a contact by Email
Contact[]
index(string $sortfield = "t.rowid", string $sortorder = 'ASC', int $limit = 100, int $page = 0, string $thirdparty_ids = '', int $category = 0, string $sqlfilters = '', int $includecount = 0, int $includeroles = 0, string $properties = '', bool $pagination_data = false)
List contacts
Get a list of contacts
int
post(array $request_data = null)
Create a contact
object|false
put(int $id, array $request_data = null)
Update a contact
array[]
delete(int $id)
Delete a contact
int
createUser(int $id, array $request_data = null)
Create a user account object from contact (external user)
mixed
getCategories(int $id, string $sortfield = "s.rowid", string $sortorder = 'ASC', int $limit = 0, int $page = 0)
Get categories of a contact
mixed
addCategory(int $id, int $category_id)
Add a category to a contact
mixed
deleteCategory(int $id, int $category_id)
Remove the link between a category and a contact