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

Public Member Functions

 __construct ()
 Constructor.
 
 get ($id, $includetimespent=0)
 Get properties of a task object. More...
 
 index ($sortfield="t.rowid", $sortorder= 'ASC', $limit=100, $page=0, $sqlfilters= '')
 List tasks. More...
 
 post ($request_data=NULL)
 Create task object. More...
 
 getRoles ($id, $userid=0)
 Get time spent of a task. More...
 
 put ($id, $request_data=NULL)
 Add a task to given project. More...
 
 delete ($id)
 Delete task. More...
 
 addTimeSpent ($id, $date, $duration, $user_id=0, $note='')
 Add time spent to a task of a project. 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 30 of file api_tasks.class.php.

Member Function Documentation

Tasks::_cleanObjectDatas (   $object)

Clean sensible object datas.

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

Definition at line 553 of file api_tasks.class.php.

Referenced by get(), getRoles(), and index().

Tasks::_validate (   $data)

Validate fields before create or update object.

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

Definition at line 600 of file api_tasks.class.php.

Referenced by post().

Tasks::addTimeSpent (   $id,
  $date,
  $duration,
  $user_id = 0,
  $note = '' 
)

Add time spent to a task of a project.

You can test this API with the following input message { "date": "2016-12-31 23:15:00", "duration": 1800, "user_id": 1, "note": "My time test" }

Parameters
int$idTask ID
datetime$dateDate (YYYY-MM-DD HH:MI:SS in GMT)
int$durationDuration in seconds (3600 = 1h)
int$user_idUser (Use 0 for connected user)
string$noteNote

POST {id}/addtimespent

Returns
array

Definition at line 503 of file api_tasks.class.php.

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

Tasks::delete (   $id)

Delete task.

Parameters
int$idTask ID
Returns
array

Definition at line 460 of file api_tasks.class.php.

References DolibarrApi\_checkAccessToResource().

Tasks::get (   $id,
  $includetimespent = 0 
)

Get properties of a task object.

Return an array with task informations

Parameters
int$idID of task
int$includetimespent0=Return only task. 1=Include a summary of time spent, 2=Include details of time spent lines (2 is no implemented yet)
Returns
array|mixed data without useless information
Exceptions
RestException

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

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

Tasks::getRoles (   $id,
  $userid = 0 
)

Get time spent of a task.

Parameters
int$idId of task
Returns
int

GET {id}/tasks Get roles a user is assigned to a task with

Parameters
int$idId of task
int$useridId of user (0 = connected user)

GET {id}/roles

Returns
int

Definition at line 266 of file api_tasks.class.php.

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

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

List tasks.

Get a list of tasks

Parameters
string$sortfieldSort field
string$sortorderSort order
int$limitLimit for list
int$pagePage number
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 project objects

Definition at line 109 of file api_tasks.class.php.

References DolibarrApi\_checkFilters(), _cleanObjectDatas(), and dol_syslog().

Tasks::post (   $request_data = NULL)

Create task object.

Parameters
array$request_dataRequest data
Returns
int ID of project

Definition at line 190 of file api_tasks.class.php.

References _validate().

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

Add a task to given project.

Parameters
int$idId of project to update
array$request_dataProjectline data

POST {id}/tasks

Returns
int Update a task to given project
Parameters
int$idId of project to update
int$taskidId of task to update
array$request_dataProjectline data

PUT {id}/tasks/{taskid}

Returns
object Update task general fields (won't touch time spent of task)
Parameters
int$idId of task to update
array$request_dataDatas
Returns
int

Definition at line 425 of file api_tasks.class.php.

References DolibarrApi\_checkAccessToResource().


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