dolibarr  17.0.4
Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
Contracts Class Reference
Inheritance diagram for Contracts:
Inheritance graph
[legend]
Collaboration diagram for Contracts:
Collaboration graph
[legend]

Public Member Functions

 __construct ()
 Constructor.
 
 get ($id)
 Get properties of a contract object. More...
 
 index ($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0, $thirdparty_ids='', $sqlfilters='')
 List contracts. More...
 
 post ($request_data=null)
 Create contract object. More...
 
 getLines ($id)
 Get lines of a contract. More...
 
 postLine ($id, $request_data=null)
 Add a line to given contract. More...
 
 putLine ($id, $lineid, $request_data=null)
 Update a line to given contract. More...
 
 activateLine ($id, $lineid, $datestart, $dateend=null, $comment=null)
 Activate a service line of a given contract. More...
 
 unactivateLine ($id, $lineid, $datestart, $comment=null)
 Unactivate a service line of a given contract. More...
 
 deleteLine ($id, $lineid)
 Delete a line to given contract. More...
 
 put ($id, $request_data=null)
 Update contract general fields (won't touch lines of contract) More...
 
 delete ($id)
 Delete contract. More...
 
 validate ($id, $notrigger=0)
 Validate a contract. More...
 
 close ($id, $notrigger=0)
 Close all services of a contract. More...
 
- Public Member Functions inherited from DolibarrApi
 __construct ($db, $cachedir='', $refreshCache=false)
 Constructor. More...
 

Protected Member Functions

 _cleanObjectDatas ($object)
 Clean sensible object datas. More...
 
- Protected Member Functions inherited from DolibarrApi
 _checkValForAPI ($field, $value, $object)
 Check and convert a string depending on its type/name. More...
 
 _checkFilters ($sqlfilters, &$error='')
 Return if a $sqlfilters parameter is valid Function no more used. More...
 

Private Member Functions

 _validate ($data)
 Validate fields before create or update object. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from DolibarrApi
static _checkAccessToResource ($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid')
 Check access by user to a given resource. More...
 
static _forge_criteria_callback ($matches)
 Function to forge a SQL criteria from a Generic filter string. More...
 

Detailed Description

Definition at line 30 of file api_contracts.class.php.

Member Function Documentation

◆ _cleanObjectDatas()

Contracts::_cleanObjectDatas (   $object)
protected

Clean sensible object datas.

Parameters
Object$objectObject to clean
Returns
Object Object with cleaned properties

Reimplemented from DolibarrApi.

Definition at line 657 of file api_contracts.class.php.

◆ _validate()

Contracts::_validate (   $data)
private

Validate fields before create or update object.

Parameters
array$dataArray with data to verify
Returns
array
Exceptions
RestException

Definition at line 675 of file api_contracts.class.php.

◆ activateLine()

Contracts::activateLine (   $id,
  $lineid,
  $datestart,
  $dateend = null,
  $comment = null 
)

Activate a service line of a given contract.

Parameters
int$idId of contract to activate
int$lineidId of line to activate
string$datestart{@from body} Date start {@type timestamp}
string$dateend{@from body} Date end {@type timestamp}
string$comment{@from body} Comment

@url PUT {id}/lines/{lineid}/activate

Returns
Object|bool

Definition at line 384 of file api_contracts.class.php.

◆ close()

Contracts::close (   $id,
  $notrigger = 0 
)

Close all services of a contract.

Parameters
int$idContract ID
int$notrigger1=Does not execute triggers, 0= execute triggers

@url POST {id}/close

Returns
array FIXME An error 403 is returned if the request has an empty body. Error message: "Forbidden: Content type `text/plain` is not supported." Workaround: send this in the body { "notrigger": 0 }

Definition at line 618 of file api_contracts.class.php.

◆ delete()

Contracts::delete (   $id)

Delete contract.

Parameters
int$idContract ID
Returns
array

Definition at line 530 of file api_contracts.class.php.

◆ deleteLine()

Contracts::deleteLine (   $id,
  $lineid 
)

Delete a line to given contract.

Parameters
int$idId of contract to update
int$lineidId of line to delete

@url DELETE {id}/lines/{lineid}

Returns
array|mixed
Exceptions
RestException401
RestException404

Definition at line 462 of file api_contracts.class.php.

◆ get()

Contracts::get (   $id)

Get properties of a contract object.

Return an array with contract informations

Parameters
int$idID of contract
Returns
array|mixed data without useless information
Exceptions
RestException

Definition at line 68 of file api_contracts.class.php.

◆ getLines()

Contracts::getLines (   $id)

Get lines of a contract.

Parameters
int$idId of contract

@url GET {id}/lines

Returns
array

Definition at line 231 of file api_contracts.class.php.

◆ index()

Contracts::index (   $sortfield = "t.rowid",
  $sortorder = 'ASC',
  $limit = 100,
  $page = 0,
  $thirdparty_ids = '',
  $sqlfilters = '' 
)

List contracts.

Get a list of contracts

Parameters
string$sortfieldSort field
string$sortorderSort order
int$limitLimit for list
int$pagePage number
string$thirdparty_idsThirdparty ids to filter contracts of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i}
string$sqlfiltersOther criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
Returns
array Array of contract objects
Exceptions
RestException404 Not found
RestException503 Error

Definition at line 105 of file api_contracts.class.php.

◆ post()

Contracts::post (   $request_data = null)

Create contract object.

Parameters
array$request_dataRequest data
Returns
int ID of contrat

Definition at line 197 of file api_contracts.class.php.

◆ postLine()

Contracts::postLine (   $id,
  $request_data = null 
)

Add a line to given contract.

Parameters
int$idId of contrat to update
array$request_dataContractline data

@url POST {id}/lines

Returns
int|bool

Definition at line 263 of file api_contracts.class.php.

◆ put()

Contracts::put (   $id,
  $request_data = null 
)

Update contract general fields (won't touch lines of contract)

Parameters
int$idId of contract to update
array$request_dataDatas
Returns
array|mixed

Definition at line 495 of file api_contracts.class.php.

◆ putLine()

Contracts::putLine (   $id,
  $lineid,
  $request_data = null 
)

Update a line to given contract.

Parameters
int$idId of contrat to update
int$lineidId of line to update
array$request_dataContractline data

@url PUT {id}/lines/{lineid}

Returns
Object|bool

Definition at line 321 of file api_contracts.class.php.

◆ unactivateLine()

Contracts::unactivateLine (   $id,
  $lineid,
  $datestart,
  $comment = null 
)

Unactivate a service line of a given contract.

Parameters
int$idId of contract to activate
int$lineidId of line to activate
string$datestart{@from body} Date start {@type timestamp}
string$comment{@from body} Comment

@url PUT {id}/lines/{lineid}/unactivate

Returns
Object|bool

Definition at line 422 of file api_contracts.class.php.

◆ validate()

Contracts::validate (   $id,
  $notrigger = 0 
)

Validate a contract.

Parameters
int$idContract ID
int$notrigger1=Does not execute triggers, 0= execute triggers

@url POST {id}/validate

Returns
array FIXME An error 403 is returned if the request has an empty body. Error message: "Forbidden: Content type `text/plain` is not supported." Workaround: send this in the body { "notrigger": 0 }

Definition at line 572 of file api_contracts.class.php.


The documentation for this class was generated from the following file: