dolibarr  9.0.0
Public Member Functions | List of all members
Thirdparties Class Reference
+ Inheritance diagram for Thirdparties:
+ Collaboration diagram for Thirdparties:

Public Member Functions

 __construct ()
 Constructor.
 
 get ($id)
 Get properties of a thirdparty object. More...
 
 index ($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0, $mode=0, $sqlfilters='')
 List thirdparties. More...
 
 post ($request_data=null)
 Create thirdparty object. More...
 
 put ($id, $request_data=null)
 Update thirdparty. More...
 
 merge ($id, $idtodelete)
 Merge a thirdparty into another one. More...
 
 delete ($id)
 Delete thirdparty. More...
 
 getCategories ($id, $sortfield="s.rowid", $sortorder='ASC', $limit=0, $page=0)
 Get customer categories for a thirdparty. More...
 
 addCategory ($id, $category_id)
 Add a customer category to a thirdparty. More...
 
 deleteCategory ($id, $category_id)
 Remove the link between a customer category and the thirdparty. More...
 
 getSupplierCategories ($id, $sortfield="s.rowid", $sortorder='ASC', $limit=0, $page=0)
 Get supplier categories for a thirdparty. More...
 
 addSupplierCategory ($id, $category_id)
 Add a supplier category to a thirdparty. More...
 
 deleteSupplierCategory ($id, $category_id)
 Remove the link between a category and the thirdparty. More...
 
 getOutStandingProposals ($id, $mode='customer')
 Get outstanding proposals of thirdparty. More...
 
 getOutStandingOrder ($id, $mode='customer')
 Get outstanding orders of thirdparty. More...
 
 getOutStandingInvoices ($id, $mode='customer')
 Get outstanding invoices of thirdparty. More...
 
 getFixedAmountDiscounts ($id, $filter="none", $sortfield="f.type", $sortorder='ASC')
 Get fixed amount discount of a thirdparty (all sources: deposit, credit note, commercial offers...) More...
 
 getInvoicesQualifiedForReplacement ($id)
 Return list of invoices qualified to be replaced by another invoice. More...
 
 getInvoicesQualifiedForCreditNote ($id)
 Return list of invoices qualified to be corrected by a credit note. More...
 
 getCompanyBankAccount ($id)
 Get CompanyBankAccount objects for thirdparty. More...
 
 createCompanyBankAccount ($id, $request_data=null)
 Create CompanyBankAccount object for thirdparty. More...
 
 updateCompanyBankAccount ($id, $bankaccount_id, $request_data=null)
 Update CompanyBankAccount object for thirdparty. More...
 
 deleteCompanyBankAccount ($id, $bankaccount_id)
 Delete a bank account attached to a thirdparty. More...
 
 generateBankAccountDocument ($id, $companybankid=null, $model='sepamandate')
 Generate a Document from a bank account record (like SEPA mandate) More...
 
 getSocieteAccounts ($id, $site=null)
 Get a specific gateway attached to a thirdparty (by specifying the site key) More...
 
 createSocieteAccount ($id, $request_data=null)
 Create and attach a new gateway to an existing thirdparty. More...
 
 putSocieteAccount ($id, $site, $request_data=null)
 Create and attach a new (or replace an existing) specific site gateway to a thirdparty. More...
 
 patchSocieteAccount ($id, $site, $request_data=null)
 Update specified values of a specific site gateway attached to a thirdparty. More...
 
 _cleanObjectDatas ($object)
 Clean sensible object datas. More...
 
 _validate ($data)
 Validate fields before create or update object. More...
 
- Public Member Functions inherited from DolibarrApi
 __construct ($db, $cachedir='', $refreshCache=false)
 Constructor. More...
 
 _cleanObjectDatas ($object)
 Executed method when API is called without parameter. More...
 
 _checkFilters ($sqlfilters)
 Return if a $sqlfilters parameter is valid. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from DolibarrApi
static _checkAccessToResource ($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid')
 Check user access to a resource. More...
 
static _forge_criteria_callback ($matches)
 Function to forge a SQL criteria. More...
 

Detailed Description

Definition at line 29 of file api_thirdparties.class.php.

Member Function Documentation

◆ _cleanObjectDatas()

Thirdparties::_cleanObjectDatas (   $object)

Clean sensible object datas.

Parameters
object$objectObject to clean
Returns
array Array of cleaned object properties

Definition at line 1635 of file api_thirdparties.class.php.

◆ _validate()

Thirdparties::_validate (   $data)

Validate fields before create or update object.

Parameters
array$dataDatas to validate
Returns
array
Exceptions
RestException

Definition at line 1661 of file api_thirdparties.class.php.

◆ addCategory()

Thirdparties::addCategory (   $id,
  $category_id 
)

Add a customer category to a thirdparty.

Parameters
int$idId of thirdparty
int$category_idId of category
Returns
mixed

POST {id}/categories/{category_id}

Definition at line 543 of file api_thirdparties.class.php.

◆ addSupplierCategory()

Thirdparties::addSupplierCategory (   $id,
  $category_id 
)

Add a supplier category to a thirdparty.

Parameters
int$idId of thirdparty
int$category_idId of category
Returns
mixed

POST {id}/supplier_categories/{category_id}

Definition at line 661 of file api_thirdparties.class.php.

◆ createCompanyBankAccount()

Thirdparties::createCompanyBankAccount (   $id,
  $request_data = null 
)

Create CompanyBankAccount object for thirdparty.

Parameters
int$idID of thirdparty
array$request_dataRequest data
Returns
object ID of thirdparty

POST {id}/bankaccounts

Definition at line 1089 of file api_thirdparties.class.php.

◆ createSocieteAccount()

Thirdparties::createSocieteAccount (   $id,
  $request_data = null 
)

Create and attach a new gateway to an existing thirdparty.

Possible fields for request_data (request body) are specified in llx_societe_account table.
See Table llx_societe_account wiki page for more information<br>
<u>Example body payload :</u>

{"key_account": "cus_DAVkLSs1LYyYI", "site": "stripe"}
Parameters
int$idID of thirdparty
array$request_dataRequest data
Returns
SocieteAccount
Exceptions
401Unauthorized: User does not have permission to read thirdparties
409Conflict: A SocieteAccount entity (gateway) already exists for this company and site.
422Unprocessable Entity: You must pass the site attribute in your request data !
500Internal Server Error: Error creating SocieteAccount account 201

POST {id}/gateways

Definition at line 1360 of file api_thirdparties.class.php.

◆ delete()

Thirdparties::delete (   $id)

Delete thirdparty.

Parameters
int$idThirparty ID
Returns
integer

Definition at line 476 of file api_thirdparties.class.php.

◆ deleteCategory()

Thirdparties::deleteCategory (   $id,
  $category_id 
)

Remove the link between a customer category and the thirdparty.

Parameters
int$idId of thirdparty
int$category_idId of category
Returns
mixed

DELETE {id}/categories/{category_id}

Definition at line 581 of file api_thirdparties.class.php.

◆ deleteCompanyBankAccount()

Thirdparties::deleteCompanyBankAccount (   $id,
  $bankaccount_id 
)

Delete a bank account attached to a thirdparty.

Parameters
int$idID of thirdparty
int$bankaccount_idID of CompanyBankAccount
Returns
int -1 if error 1 if correct deletion

DELETE {id}/bankaccounts/{bankaccount_id}

Definition at line 1159 of file api_thirdparties.class.php.

◆ deleteSupplierCategory()

Thirdparties::deleteSupplierCategory (   $id,
  $category_id 
)

Remove the link between a category and the thirdparty.

Parameters
int$idId of thirdparty
int$category_idId of category
Returns
mixed

DELETE {id}/supplier_categories/{category_id}

Definition at line 699 of file api_thirdparties.class.php.

◆ generateBankAccountDocument()

Thirdparties::generateBankAccountDocument (   $id,
  $companybankid = null,
  $model = 'sepamandate' 
)

Generate a Document from a bank account record (like SEPA mandate)

Parameters
int$idThirdparty id
int$companybankidCompanybank id
string$modelModel of document to generate
Returns
void

GET {id}/generateBankAccountDocument/{companybankid}/{model}

Definition at line 1185 of file api_thirdparties.class.php.

◆ get()

Thirdparties::get (   $id)

Get properties of a thirdparty object.

Return an array with thirdparty informations

Parameters
int$idID of thirdparty
Returns
array|mixed data without useless information
Exceptions
RestException

Definition at line 74 of file api_thirdparties.class.php.

◆ getCategories()

Thirdparties::getCategories (   $id,
  $sortfield = "s.rowid",
  $sortorder = 'ASC',
  $limit = 0,
  $page = 0 
)

Get customer categories for a thirdparty.

Parameters
int$idID of thirdparty
string$sortfieldSort field
string$sortorderSort order
int$limitLimit for list
int$pagePage number
Returns
mixed

GET {id}/categories

Definition at line 504 of file api_thirdparties.class.php.

◆ getCompanyBankAccount()

Thirdparties::getCompanyBankAccount (   $id)

Get CompanyBankAccount objects for thirdparty.

Parameters
int$idID of thirdparty
Returns
array

GET {id}/bankaccounts

We select all the records that match the socid

Definition at line 1011 of file api_thirdparties.class.php.

◆ getFixedAmountDiscounts()

Thirdparties::getFixedAmountDiscounts (   $id,
  $filter = "none",
  $sortfield = "f.type",
  $sortorder = 'ASC' 
)

Get fixed amount discount of a thirdparty (all sources: deposit, credit note, commercial offers...)

Parameters
int$idID of the thirdparty
string$filterFilter exceptional discount. "none" will return every discount, "available" returns unapplied discounts, "used" returns applied discounts { none,available,used}
string$sortfieldSort field
string$sortorderSort order

GET {id}/fixedamountdiscounts

Returns
array List of fixed discount of thirdparty
Exceptions
400
401
404
503

Definition at line 875 of file api_thirdparties.class.php.

◆ getInvoicesQualifiedForCreditNote()

Thirdparties::getInvoicesQualifiedForCreditNote (   $id)

Return list of invoices qualified to be corrected by a credit note.

Invoices matching the following rules are returned (validated + payment on process) or classified (payed completely or payed partialy) + not already replaced + not already a credit note

Parameters
int$idId of thirdparty

GET {id}/getinvoicesqualifiedforcreditnote

Returns
array
Exceptions
400
401
404
405

Definition at line 975 of file api_thirdparties.class.php.

◆ getInvoicesQualifiedForReplacement()

Thirdparties::getInvoicesQualifiedForReplacement (   $id)

Return list of invoices qualified to be replaced by another invoice.

Parameters
int$idId of thirdparty

GET {id}/getinvoicesqualifiedforreplacement

Returns
array
Exceptions
400
401
404
405

Definition at line 933 of file api_thirdparties.class.php.

◆ getOutStandingInvoices()

Thirdparties::getOutStandingInvoices (   $id,
  $mode = 'customer' 
)

Get outstanding invoices of thirdparty.

Parameters
int$idID of the thirdparty
string$mode'customer' or 'supplier'

GET {id}/outstandinginvoices

Returns
array List of outstandings invoices of thirdparty
Exceptions
400
401
404

Definition at line 829 of file api_thirdparties.class.php.

◆ getOutStandingOrder()

Thirdparties::getOutStandingOrder (   $id,
  $mode = 'customer' 
)

Get outstanding orders of thirdparty.

Parameters
int$idID of the thirdparty
string$mode'customer' or 'supplier'

GET {id}/outstandingorders

Returns
array List of outstandings orders of thirdparty
Exceptions
400
401
404

Definition at line 786 of file api_thirdparties.class.php.

◆ getOutStandingProposals()

Thirdparties::getOutStandingProposals (   $id,
  $mode = 'customer' 
)

Get outstanding proposals of thirdparty.

Parameters
int$idID of the thirdparty
string$mode'customer' or 'supplier'

GET {id}/outstandingproposals

Returns
array List of outstandings proposals of thirdparty
Exceptions
400
401
404

Definition at line 742 of file api_thirdparties.class.php.

◆ getSocieteAccounts()

Thirdparties::getSocieteAccounts (   $id,
  $site = null 
)

Get a specific gateway attached to a thirdparty (by specifying the site key)

Parameters
int$idID of thirdparty
string$siteSite key
Returns
SocieteAccount[]
Exceptions
401Unauthorized: User does not have permission to read thirdparties
404Not Found: Specified thirdparty ID does not belongs to an existing thirdparty

GET {id}/gateways/

We select all the records that match the socid

Definition at line 1284 of file api_thirdparties.class.php.

◆ getSupplierCategories()

Thirdparties::getSupplierCategories (   $id,
  $sortfield = "s.rowid",
  $sortorder = 'ASC',
  $limit = 0,
  $page = 0 
)

Get supplier categories for a thirdparty.

Parameters
int$idID of thirdparty
string$sortfieldSort field
string$sortorderSort order
int$limitLimit for list
int$pagePage number
Returns
mixed

GET {id}/supplier_categories

Definition at line 622 of file api_thirdparties.class.php.

◆ index()

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

List thirdparties.

Get a list of thirdparties

Parameters
string$sortfieldSort field
string$sortorderSort order
int$limitLimit for list
int$pagePage number
int$modeSet to 1 to show only customers Set to 2 to show only prospects Set to 3 to show only those are not customer neither prospect
string$sqlfiltersOther criteria to filter answers separated by a comma. Syntax example "(t.nom:like:'TheCompany%') and (t.date_creation:<:'20160101')"
Returns
array Array of thirdparty objects

Definition at line 120 of file api_thirdparties.class.php.

◆ merge()

Thirdparties::merge (   $id,
  $idtodelete 
)

Merge a thirdparty into another one.

Merge content (properties, notes) and objects (like invoices, events, orders, proposals, ...) of a thirdparty into a target thirdparty, then delete the merged thirdparty. If a property has a defined value both in thirdparty to delete and thirdparty to keep, the value into the thirdparty to delete will be ignored, the value of target thirdparty will remain, except for notes (content is concatenated).

Parameters
int$idID of thirdparty to keep (the target thirdparty)
int$idtodeleteID of thirdparty to remove (the thirdparty to delete), once data has been merged into the target thirdparty.
Returns
int

PUT {id}/merge/{idtodelete}

Definition at line 270 of file api_thirdparties.class.php.

◆ patchSocieteAccount()

Thirdparties::patchSocieteAccount (   $id,
  $site,
  $request_data = null 
)

Update specified values of a specific site gateway attached to a thirdparty.

Parameters
int$idId of thirdparty
string$siteSite key
array$request_dataRequest data
Returns
SocieteAccount
Exceptions
401Unauthorized: User does not have permission to read thirdparties
404Not Found: Specified thirdparty ID does not belongs to an existing thirdparty
409Conflict: Another SocieteAccount entity already exists for this thirdparty with this site key.
500Internal Server Error: Error updating SocieteAccount entity

PATCH {id}/gateways/{site}

Definition at line 1500 of file api_thirdparties.class.php.

◆ post()

Thirdparties::post (   $request_data = null)

Create thirdparty object.

Parameters
array$request_dataRequest datas
Returns
int ID of thirdparty

Definition at line 206 of file api_thirdparties.class.php.

◆ put()

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

Update thirdparty.

Parameters
int$idId of thirdparty to update
array$request_dataDatas
Returns
int

Definition at line 230 of file api_thirdparties.class.php.

◆ putSocieteAccount()

Thirdparties::putSocieteAccount (   $id,
  $site,
  $request_data = null 
)

Create and attach a new (or replace an existing) specific site gateway to a thirdparty.

You MUST pass all values to keep (otherwise, they will be deleted) !
If you just need to update specific fields prefer PATCH /thirdparties/{id}/gateways/{site} endpoint.

When a SocieteAccount entity does not exist for the id and site supplied, a new one will be created. In that case fk_soc and site members form request body payload will be ignored and id and site query strings parameters will be used instead.

Parameters
int$idID of thirdparty
string$siteSite key
array$request_dataRequest data
Returns
SocieteAccount
Exceptions
401Unauthorized: User does not have permission to read thirdparties
422Unprocessable Entity: You must pass the site attribute in your request data !
500Internal Server Error: Error updating SocieteAccount entity
RestExceptionPUT {id}/gateways/{site}

Definition at line 1419 of file api_thirdparties.class.php.

◆ updateCompanyBankAccount()

Thirdparties::updateCompanyBankAccount (   $id,
  $bankaccount_id,
  $request_data = null 
)

Update CompanyBankAccount object for thirdparty.

Parameters
int$idID of thirdparty
int$bankaccount_idID of CompanyBankAccount
array$request_dataRequest data
Returns
object ID of thirdparty

PUT {id}/bankaccounts/{bankaccount_id}

Definition at line 1124 of file api_thirdparties.class.php.


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