dolibarr  20.0.0-alpha
Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
ExpenseReports Class Reference
Inheritance diagram for ExpenseReports:
Inheritance graph
[legend]
Collaboration diagram for ExpenseReports:
Collaboration graph
[legend]

Public Member Functions

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

Protected Member Functions

 _cleanObjectDatas ($object)
 Delete paymentExpenseReport. More...
 
- Protected Member Functions inherited from DolibarrApi
 _checkValForAPI ($field, $value, $object)
 Check and convert a string depending on its type/name. More...
 
 _filterObjectProperties ($object, $properties)
 Filter properties that will be returned on object. 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...
 
 _validatepayment ($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 32 of file api_expensereports.class.php.

Member Function Documentation

◆ _cleanObjectDatas()

ExpenseReports::_cleanObjectDatas (   $object)
protected

Delete paymentExpenseReport.

Parameters
int$idID of payment ExpenseReport
Returns
array

@url DELETE {id}/payments Clean sensible object datas

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

Reimplemented from DolibarrApi.

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

References $object.

◆ _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 780 of file api_expensereports.class.php.

◆ _validatepayment()

ExpenseReports::_validatepayment (   $data)
private

Validate fields before create or update object.

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

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

◆ addPayment()

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

Create payment of ExpenseReport.

Parameters
int$idID of expense report
array$request_data{@from body} Request data
Returns
int ID of paymentExpenseReport

@url POST {id}/payments

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

◆ delete()

ExpenseReports::delete (   $id)

Delete Expense Report.

Parameters
int$idExpense Report ID
Returns
array

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

◆ get()

ExpenseReports::get (   $id)

Get properties of an Expense Report.

Return an array with Expense Report information

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

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

◆ getAllPayments()

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

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 } Get the list of payments of expensereport.
Parameters
string$sortfieldSort field
string$sortorderSort order
int$limitLimit for list
int$pagePage number
Returns
array List of paymentExpenseReport objects

@url GET /payments

Exceptions
RestException

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

◆ getPayments()

ExpenseReports::getPayments (   $pid)

Get a given payment.

Parameters
int$pidPayment ID
Returns
object PaymentExpenseReport object

@url GET /payments/{pid}

Exceptions
RestException

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

◆ index()

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

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')"
string$propertiesRestrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
Returns
array Array of Expense Report objects

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

◆ post()

ExpenseReports::post (   $request_data = null)

Create Expense Report object.

Parameters
array$request_dataRequest data
Returns
int ID of Expense Report

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

◆ 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
Object Updated object
Exceptions
RestException401 Not allowed
RestException404 Expense report not found
RestException500 System error

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

◆ updatePayment()

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

Update a payment of ExpenseReport.

Parameters
int$idID of paymentExpenseReport
array$request_datadata
Returns
object

@url PUT {id}/payments

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


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