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

Public Member Functions

 __construct ()
 Constructor.
 
 index ($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0, $category=0, $sqlfilters='')
 Get the list of accounts. More...
 
 get ($id)
 Get account by ID. More...
 
 post ($request_data=null)
 Create account object. More...
 
 transfer ($bankaccount_from_id=0, $bankaccount_to_id=0, $date=null, $description="", $amount=0.0, $amount_to=0.0)
 Create an internal wire transfer between two bank accounts. More...
 
 put ($id, $request_data=null)
 Update account. More...
 
 delete ($id)
 Delete account. More...
 
 getLines ($id, $sqlfilters='')
 Get the list of lines of the account. More...
 
 addLine ($id, $date, $type, $label, $amount, $category=0, $cheque_number='', $cheque_writer='', $cheque_bank='', $accountancycode='', $datev=null, $num_releve='')
 Add a line to an account. More...
 
 addLink ($id, $line_id, $url_id, $url, $label, $type)
 Add a link to an account line. More...
 
- Public Member Functions inherited from DolibarrApi
 __construct ($db, $cachedir='', $refreshCache=false)
 Constructor. More...
 

Static Public Attributes

static $FIELDS
 array $FIELDS Mandatory fields, checked when creating an object
 

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 creating an 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_bankaccounts.class.php.

Member Function Documentation

◆ _cleanObjectDatas()

BankAccounts::_cleanObjectDatas (   $object)
protected

Clean sensible object datas.

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

Reimplemented from DolibarrApi.

Definition at line 401 of file api_bankaccounts.class.php.

◆ _validate()

BankAccounts::_validate (   $data)
private

Validate fields before creating an object.

Parameters
array | null$dataData to validate
Returns
array
Exceptions
RestException

Definition at line 382 of file api_bankaccounts.class.php.

◆ addLine()

BankAccounts::addLine (   $id,
  $date,
  $type,
  $label,
  $amount,
  $category = 0,
  $cheque_number = '',
  $cheque_writer = '',
  $cheque_bank = '',
  $accountancycode = '',
  $datev = null,
  $num_releve = '' 
)

Add a line to an account.

Parameters
int$idID of account
string$datePayment date (timestamp) {@from body} {@type timestamp}
string$typePayment mode (TYP,VIR,PRE,LIQ,VAD,CB,CHQ...) {@from body}
string$labelLabel {@from body}
float$amountAmount (may be 0) {@from body}
int$categoryCategory
string$cheque_numberCheque numero {@from body}
string$cheque_writerName of cheque writer {@from body}
string$cheque_bankBank of cheque writer {@from body}
string$accountancycodeAccountancy code {@from body}
string$datevPayment date value (timestamp) {@from body} {@type timestamp}
string$num_releveBank statement numero {@from body}
Returns
int ID of line

@url POST {id}/lines

Definition at line 487 of file api_bankaccounts.class.php.

◆ addLink()

BankAccounts::addLink (   $id,
  $line_id,
  $url_id,
  $url,
  $label,
  $type 
)

Add a link to an account line.

Parameters
int$idID of account
int$line_idID of account line
int$url_idID to set in the URL {@from body}
string$urlURL of the link {@from body}
string$labelLabel {@from body}
string$typeType of link ('payment', 'company', 'member', ...) {@from body}
Returns
int ID of link

@url POST {id}/lines/{line_id}/links

Definition at line 540 of file api_bankaccounts.class.php.

◆ delete()

BankAccounts::delete (   $id)

Delete account.

Parameters
int$idID of account
Returns
array

Definition at line 351 of file api_bankaccounts.class.php.

◆ get()

BankAccounts::get (   $id)

Get account by ID.

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

Definition at line 129 of file api_bankaccounts.class.php.

◆ getLines()

BankAccounts::getLines (   $id,
  $sqlfilters = '' 
)

Get the list of lines of the account.

Parameters
int$idID of account
Returns
array Array of AccountLine objects
Exceptions
RestException@url GET {id}/lines
Parameters
string$sqlfiltersOther criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.import_key:<:'20160101')"

Definition at line 422 of file api_bankaccounts.class.php.

◆ index()

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

Get the list of accounts.

Parameters
string$sortfieldSort field
string$sortorderSort order
int$limitLimit for list
int$pagePage number
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.import_key:<:'20160101')"
Returns
array List of account objects
Exceptions
RestException

Definition at line 65 of file api_bankaccounts.class.php.

◆ post()

BankAccounts::post (   $request_data = null)

Create account object.

Parameters
array$request_dataRequest data
Returns
int ID of account

Definition at line 150 of file api_bankaccounts.class.php.

◆ put()

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

Update account.

Parameters
int$idID of account
array$request_datadata
Returns
Object Object with cleaned properties

Definition at line 319 of file api_bankaccounts.class.php.

◆ transfer()

BankAccounts::transfer (   $bankaccount_from_id = 0,
  $bankaccount_to_id = 0,
  $date = null,
  $description = "",
  $amount = 0.0,
  $amount_to = 0.0 
)

Create an internal wire transfer between two bank accounts.

Parameters
int$bankaccount_from_idBankAccount ID to use as the source of the internal wire transfer {@from body}{@required true}
int$bankaccount_to_idBankAccount ID to use as the destination of the internal wire transfer {@from body}{@required true}
string$dateDate of the internal wire transfer (UNIX timestamp) {@from body}{@required true}{@type timestamp}
string$descriptionDescription of the internal wire transfer {@from body}{@required true}
float$amountAmount to transfer from the source to the destination BankAccount {@from body}{@required true}
float$amount_toAmount to transfer to the destination BankAccount (only when accounts does not share the same currency) {@from body}{@required false}

@url POST /transfer

Returns
array

@status 201

Exceptions
RestException401 Unauthorized: User does not have permission to configure bank accounts
RestException404 Not Found: Either the source or the destination bankaccount for the provided id does not exist
RestException422 Unprocessable Entity: Refer to detailed exception message for the cause
RestException500 Internal Server Error: Error(s) returned by the RDBMS

Creating bank line records

Creating links between bank line record and its source

Definition at line 195 of file api_bankaccounts.class.php.


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