dolibarr 18.0.6
ExpenseReports Class Reference
Inheritance diagram for ExpenseReports:
Collaboration diagram for ExpenseReports:

Public Member Functions

 __construct ()
 Constructor.
 
 get ($id)
 Get properties of a Expense Report object.
 
 index ($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0, $user_ids=0, $sqlfilters='')
 List Expense Reports.
 
 post ($request_data=null)
 Create Expense Report object.
 
 put ($id, $request_data=null)
 Get lines of an Expense Report.
 
 delete ($id)
 Delete Expense Report.
 
- Public Member Functions inherited from DolibarrApi
 __construct ($db, $cachedir='', $refreshCache=false)
 Constructor.
 

Protected Member Functions

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

Private Member Functions

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

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.
 
static _forge_criteria_callback ($matches)
 Function to forge a SQL criteria from a Generic filter string.
 

Detailed Description

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

Member Function Documentation

◆ _cleanObjectDatas()

ExpenseReports::_cleanObjectDatas ( $object)
protected

Validate an Expense Report.

Parameters
int$idExpense Report ID

@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 { "idwarehouse": 0 } Clean sensible object datas
Parameters
Object$objectObject to clean
Returns
Object Object with cleaned properties

Reimplemented from DolibarrApi.

Definition at line 517 of file api_expensereports.class.php.

Referenced by get(), and index().

◆ _validate()

ExpenseReports::_validate ( $data)
private

Validate fields before create or update object.

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

Definition at line 571 of file api_expensereports.class.php.

Referenced by post().

◆ delete()

ExpenseReports::delete ( $id)

Delete Expense Report.

Parameters
int$idExpense Report ID
Returns
array

Definition at line 440 of file api_expensereports.class.php.

References DolibarrApi\_checkAccessToResource().

◆ get()

ExpenseReports::get ( $id)

Get properties of a Expense Report object.

Return an array with Expense Report informations

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

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

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

◆ index()

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

List Expense Reports.

Get a list of Expense Reports

Parameters
string$sortfieldSort field
string$sortorderSort order
int$limitLimit for list
int$pagePage number
string$user_idsUser ids filter field. 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 Expense Report objects

Definition at line 98 of file api_expensereports.class.php.

References _cleanObjectDatas(), and forgeSQLFromUniversalSearchCriteria().

◆ post()

ExpenseReports::post ( $request_data = null)

Create Expense Report object.

Parameters
array$request_dataRequest data
Returns
int ID of Expense Report

Definition at line 166 of file api_expensereports.class.php.

References _validate().

◆ put()

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

Get lines of an Expense Report.

Parameters
int$idId of Expense Report

@url GET {id}/lines

Returns
int Add a line to given Expense Report
Parameters
int$idId of Expense Report to update
array$request_dataExpense Report data

@url POST {id}/lines

Returns
int Update a line to given Expense Report
Parameters
int$idId of Expense Report to update
int$lineidId of line to update
array$request_dataExpense Report data

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

Returns
object Delete a line of given Expense Report
Parameters
int$idId of Expense Report to update
int$lineidId of line to delete

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

Returns
int Update Expense Report general fields (won't touch lines of expensereport)
Parameters
int$idId of Expense Report to update
array$request_dataDatas
Returns
int
Exceptions
RestException401 Not allowed
RestException404 Expense report not found
RestException500 System error

Definition at line 405 of file api_expensereports.class.php.

References DolibarrApi\_checkAccessToResource().


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