dolibarr  7.0.0-beta
Public Member Functions | List of all members
Contracts Class Reference
+ Inheritance diagram for Contracts:
+ Collaboration diagram for Contracts:

Public Member Functions

 __construct ()
 Constructor.
 
 get ($id)
 Get properties of a contrat object. 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 an contract. More...
 
 close ($id, $notrigger=0)
 Close all services of a contract. More...
 
 _cleanObjectDatas ($object)
 Clean sensible object datas. More...
 
 _validate ($data)
 Validate fields before create or update object. More...
 
- Public Member Functions inherited from DolibarrApi
 __construct ($db, $cachedir='', $refreshCache=false)
 Constructor. More...
 
 _cleanObjectDatas ($object)
 Executed method when API is called without parameter. More...
 
 _checkFilters ($sqlfilters)
 Return if a $sqlfilters parameter is valid. More...
 

Additional Inherited Members

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

Detailed Description

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

Member Function Documentation

Contracts::_cleanObjectDatas (   $object)

Clean sensible object datas.

Parameters
object$objectObject to clean
Returns
array Array of cleaned object properties

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

Referenced by activateLine(), get(), getLines(), putLine(), and unactivateLine().

Contracts::_validate (   $data)

Validate fields before create or update object.

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

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

Referenced by post().

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{ body} Date start { timestamp}
string$dateend{ body} Date end { timestamp}
string$comment{ body} Comment

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

Returns
object

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

References DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().

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

Close all services of a contract.

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

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 597 of file api_contracts.class.php.

References DolibarrApi\_checkAccessToResource().

Contracts::delete (   $id)

Delete contract.

Parameters
int$idContract ID
Returns
array

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

References DolibarrApi\_checkAccessToResource().

Contracts::deleteLine (   $id,
  $lineid 
)

Delete a line to given contract.

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

DELETE {id}/lines/{lineid}

Returns
int
Exceptions
401
404

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

References DolibarrApi\_checkAccessToResource().

Contracts::get (   $id)

Get properties of a contrat object.

Return an array with contrat informations

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

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

References DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().

Contracts::getLines (   $id)

Get lines of a contract.

Parameters
int$idId of contract

GET {id}/lines

Returns
int

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

References DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().

Contracts::post (   $request_data = NULL)

Create contract object.

Parameters
array$request_dataRequest data
Returns
int ID of contrat

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

References _validate().

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

Add a line to given contract.

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

POST {id}/lines

Returns
int

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

References DolibarrApi\_checkAccessToResource().

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

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

Parameters
int$idId of contrat to update
array$request_dataDatas
Returns
int

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

References DolibarrApi\_checkAccessToResource().

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

PUT {id}/lines/{lineid}

Returns
object

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

References DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().

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{ body} Date start { timestamp}
string$comment{ body} Comment

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

Returns
object

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

References DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().

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

Validate an contract.

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

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 551 of file api_contracts.class.php.

References DolibarrApi\_checkAccessToResource().


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