Contracts
class Contracts extends DolibarrApi (View source)
API class for contracts
Properties
| protected DoliDB | $db | from DolibarrApi | |
| Restler | $r | from DolibarrApi | |
| static string[] | $FIELDS | ||
| Contrat | $contract |
Methods
Constructor
Check and convert a string depending on its type/name.
Filter properties that will be returned on object
Clean sensible object datas
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 properties of a contract object
List contracts
Create contract object
Get lines of a contract
Add a line to given contract
Update a line to given contract
Activate a service line of a given contract
Unactivate a service line of a given contract
Delete a line to given contract
Update contract general fields (won't touch lines of contract)
Delete contract
Validate a contract
Close all services of a contract
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 datas
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, string $properties = '', bool $withLines = true)
Get properties of a contract object
Return an array with contract information
array
index(string $sortfield = "t.rowid", string $sortorder = 'ASC', int $limit = 100, int $page = 0, string $thirdparty_ids = '', string $sqlfilters = '', string $properties = '', bool $pagination_data = false, bool $withLines = true)
List contracts
Get a list of contracts
int
post(array $request_data = null)
Create contract object
array
getLines(int $id, string $sortfield = "d.rowid", string $sortorder = 'ASC', int $limit = 100, int $page = 0, string $sqlfilters = '', string $properties = '', bool $pagination_data = false)
Get lines of a contract
int|bool
postLine(int $id, array $request_data = null)
Add a line to given contract
object|bool
putLine(int $id, int $lineid, array $request_data = null)
Update a line to given contract
object|bool
activateLine(int $id, int $lineid, string $datestart, string $dateend = null, string $comment = null)
Activate a service line of a given contract
object|bool
unactivateLine(int $id, int $lineid, string $datestart, string $comment = null)
Unactivate a service line of a given contract
array|mixed
deleteLine(int $id, int $lineid)
Delete a line to given contract
object
put(int $id, array $request_data = null)
Update contract general fields (won't touch lines of contract)
array
delete(int $id)
Delete contract
array
validate(int $id, int $notrigger = 0)
Validate a contract
array
close(int $id, int $notrigger = 0)
Close all services of a contract