dolibarr  19.0.0-dev
Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
Projects Class Reference
Inheritance diagram for Projects:
Inheritance graph
[legend]
Collaboration diagram for Projects:
Collaboration graph
[legend]

Public Member Functions

 __construct ()
 Constructor.
 
 get ($id)
 Get properties of a project object. More...
 
 index ($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0, $thirdparty_ids='', $category=0, $sqlfilters='')
 List projects. More...
 
 post ($request_data=null)
 Create project object. More...
 
 getLines ($id, $includetimespent=0)
 Get tasks of a project. More...
 
 getRoles ($id, $userid=0)
 Get roles a user is assigned to a project with. More...
 
 put ($id, $request_data=null)
 Add a task to given project. More...
 
 delete ($id)
 Delete project. More...
 
 validate ($id, $notrigger=0)
 Validate a project. 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_projects.class.php.

Member Function Documentation

◆ _cleanObjectDatas()

Projects::_cleanObjectDatas (   $object)
protected

Clean sensible object datas.

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

Reimplemented from DolibarrApi.

Definition at line 563 of file api_projects.class.php.

◆ _validate()

Projects::_validate (   $data)
private

Validate fields before create or update object.

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

Definition at line 615 of file api_projects.class.php.

◆ delete()

Projects::delete (   $id)

Delete project.

Parameters
int$idProject ID
Returns
array

Definition at line 481 of file api_projects.class.php.

◆ get()

Projects::get (   $id)

Get properties of a project object.

Return an array with project informations

Parameters
int$idID of project
Returns
Object Object with cleaned properties
Exceptions
RestException

Definition at line 66 of file api_projects.class.php.

◆ getLines()

Projects::getLines (   $id,
  $includetimespent = 0 
)

Get tasks of a project.

See also API /tasks

Parameters
int$idId of project
int$includetimespent0=Return only list of tasks. 1=Include a summary of time spent, 2=Include details of time spent lines
Returns
array

@url GET {id}/tasks

Definition at line 235 of file api_projects.class.php.

◆ getRoles()

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

Get roles a user is assigned to a project with.

Parameters
int$idId of project
int$useridId of user (0 = connected user)
Returns
array

@url GET {id}/roles

Definition at line 273 of file api_projects.class.php.

◆ index()

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

List projects.

Get a list of projects

Parameters
string$sortfieldSort field
string$sortorderSort order
int$limitLimit for list
int$pagePage number
string$thirdparty_idsThirdparty ids to filter projects of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i}
int$categoryUse this param to filter list by category
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 101 of file api_projects.class.php.

◆ post()

Projects::post (   $request_data = null)

Create project object.

Parameters
array$request_dataRequest data
Returns
int ID of project

Definition at line 200 of file api_projects.class.php.

◆ put()

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

Add a task to given project.

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

@url 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

@url PUT {id}/tasks/{taskid}

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

Definition at line 446 of file api_projects.class.php.

◆ validate()

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

Validate a project.

You can test this API with the following input message { "notrigger": 0 }

Parameters
int$idProject 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 525 of file api_projects.class.php.


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