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

Public Member Functions

 __construct ()
 Constructor.
 
 get ($id)
 Get properties of an Expense Report.
 
 index ($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0, $user_ids='', $sqlfilters='', $properties='')
 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.
 
 getAllPayments ($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0)
 Validate an Expense Report.
 
 getPayments ($pid)
 Get a given payment.
 
 addPayment ($id, $request_data=null)
 Create payment of ExpenseReport.
 
 updatePayment ($id, $request_data=null)
 Update a payment of ExpenseReport.
 
- Public Member Functions inherited from DolibarrApi
 __construct ($db, $cachedir='', $refreshCache=false)
 Constructor.
 

Protected Member Functions

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

Referenced by get(), getAllPayments(), getPayments(), 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 780 of file api_expensereports.class.php.

Referenced by post().

◆ _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.

Referenced by addPayment().

◆ 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.

References DolibarrApi\_checkValForAPI(), and _validatepayment().

◆ delete()

ExpenseReports::delete ( $id)

Delete Expense Report.

Parameters
int$idExpense Report ID
Returns
array

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

References DolibarrApi\_checkAccessToResource().

◆ 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.

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

◆ 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.

References _cleanObjectDatas(), and dol_syslog().

◆ 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.

References _cleanObjectDatas().

◆ 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.

References _cleanObjectDatas(), DolibarrApi\_filterObjectProperties(), 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 174 of file api_expensereports.class.php.

References DolibarrApi\_checkValForAPI(), _validate(), and sanitizeVal().

◆ 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.

References DolibarrApi\_checkAccessToResource(), DolibarrApi\_checkValForAPI(), and sanitizeVal().

◆ 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.

References DolibarrApi\_checkValForAPI().


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