Thirdparties
class Thirdparties extends DolibarrApi (View source)
API class for thirdparties
Properties
| protected DoliDB | $db | from DolibarrApi | |
| Restler | $r | from DolibarrApi | |
| static string[] | $FIELDS | ||
| Societe | $company |
Methods
Constructor
Check and convert a string depending on its type/name.
Filter properties that will be returned on object
Clean sensible object datas
Check access by user to a given resource
Return if a $sqlfilters parameter is valid Function no more used. Kept for backward compatibility with old APIs of modules
Function to forge a SQL criteria from a Generic filter string.
Get a third party
Get properties of a third party by email.
Get a third party by barcode.
List third parties
Create a third party
Update third party
Merge a third party into another third party
Delete a third party
Set a new price level for the given third party
Add a customer representative to a third party
Remove the link between a customer representative and a third party
Get customer categories for a third party
Add a customer category to a third party
Remove the link between a customer category and the third party
Get supplier categories for a third party
Add a supplier category to a third party
Remove the link between a category and the third party
Get outstanding proposals for a third party
Get outstanding orders for a third party
Get outstanding invoices for a third party
Get representatives of a third party
Get fixed amount discount of a third party
Split a discount in 2 smaller discount
Return invoices qualified to be replaced by another invoice
Return invoices qualified to be corrected by a credit note
Get company notifications for a third party
Create a company notification for a third party
Create a company notification for a third party using action trigger code
Delete a company notification attached to a third party
Update a company notification for a third party
Get company bank accounts of a third party
Create a company bank account for a third party
Update a company bank account of a third party
Delete a bank account attached to a third party
Generate a document from a bank account record
Get a specific account attached to a third party
Get a specific third party by account
Create and attach a new account to an existing third party
Create and attach a new (or replace an existing) specific site account for a third party
Update specified values of a specific account attached to a third party
Delete a specific site account attached to a third party
Delete all accounts attached to a third party
Details
__construct()
Constructor
protected string|array<string, mixed>
_checkValForAPI(string $field, string|string[] $value, object $object)
Check and convert a string depending on its type/name.
protected object
_filterObjectProperties(object $object, string $properties)
Filter properties that will be returned on object
protected object
_cleanObjectDatas(object $object)
Clean sensible object datas
static protected bool
_checkAccessToResource(string $resource, int $resource_id = 0, string $dbtablename = '', string $feature2 = '', string $dbt_keyfield = 'fk_soc', string $dbt_select = 'rowid')
Check access by user to a given resource
protected bool|string
_checkFilters(string $sqlfilters, string $error = '')
Return if a $sqlfilters parameter is valid Function no more used. Kept for backward compatibility with old APIs of modules
static protected string
_forge_criteria_callback(string[] $matches)
Function to forge a SQL criteria from a Generic filter string.
Function no more used. Kept for backward compatibility with old APIs of modules
object
get(int $id)
Get a third party
Return the third party object
array|mixed
getByEmail(string $email)
Get properties of a third party by email.
Return an array with third party information
array|mixed
getByBarcode(string $barcode)
Get a third party by barcode.
Return an array with third party information
array
index(string $sortfield = "t.rowid", string $sortorder = 'ASC', int $limit = 100, int $page = 0, int $mode = 0, int $category = 0, string $sqlfilters = '', string $properties = '', bool $pagination_data = false)
List third parties
Get a list of third parties
int
post(array $request_data = null)
Create a third party
object
put(int $id, array $request_data = null)
Update third party
object
merge(int $id, int $idtodelete)
Merge a third party into another third party
Merge content (properties, notes) and objects (like invoices, events, orders, proposals, ...) of a third party into a target third party, then delete the merged third party. If a property has a defined value both in the third party to delete and the third party to keep, the value of the third party to delete will be ignored, the value of the target third party will remain, except for notes (content is concatenated).
array
delete(int $id)
Delete a third party
object
setThirdpartyPriceLevel(int $id, int $priceLevel)
Set a new price level for the given third party
int
addRepresentative(int $id, int $representative_id)
Add a customer representative to a third party
int
deleteRepresentative(int $id, int $representative_id)
Remove the link between a customer representative and a third party
array
getCategories(int $id, string $sortfield = "s.rowid", string $sortorder = 'ASC', int $limit = 0, int $page = 0)
Get customer categories for a third party
object
addCategory(int $id, int $category_id)
Add a customer category to a third party
object
deleteCategory(int $id, int $category_id)
Remove the link between a customer category and the third party
array
getSupplierCategories(int $id, string $sortfield = "s.rowid", string $sortorder = 'ASC', int $limit = 0, int $page = 0)
Get supplier categories for a third party
mixed
addSupplierCategory(int $id, int $category_id)
Add a supplier category to a third party
mixed
deleteSupplierCategory(int $id, int $category_id)
Remove the link between a category and the third party
array
getOutStandingProposals(int $id, string $mode = 'customer')
Get outstanding proposals for a third party
array
getOutStandingOrder(int $id, string $mode = 'customer')
Get outstanding orders for a third party
array
getOutStandingInvoices(int $id, string $mode = 'customer')
Get outstanding invoices for a third party
array
getSalesRepresentatives(int $id, int $mode = 0)
Get representatives of a third party
array
getFixedAmountDiscounts(int $id, string $mode = 'customer', string $filter = "none", string $sortfield = "f.type", string $sortorder = 'ASC')
Get fixed amount discount of a third party
all sources: deposit, credit note, commercial offers, etc.
array
splitdiscount(int $id, int $discountid, float $amount_ttc_1, float $amount_ttc_2)
Split a discount in 2 smaller discount
array
getInvoicesQualifiedForReplacement(int $id)
Return invoices qualified to be replaced by another invoice
array
getInvoicesQualifiedForCreditNote(int $id)
Return invoices qualified to be corrected by a credit note
Invoices matching the following rules are returned (validated + payment on process) or classified (paid completely or paid partially) + not already replaced + not already a credit note
array
getCompanyNotification(int $id)
Get company notifications for a third party
array|mixed
createCompanyNotification(int $id, array $request_data = null)
Create a company notification for a third party
array|mixed
createCompanyNotificationByCode(int $id, string $code, array $request_data = null)
Create a company notification for a third party using action trigger code
int
deleteCompanyNotification(int $id, int $notification_id)
Delete a company notification attached to a third party
array|mixed
updateCompanyNotification(int $id, int $notification_id, array $request_data = null)
Update a company notification for a third party
array
getCompanyBankAccount(int $id)
Get company bank accounts of a third party
array|mixed
createCompanyBankAccount(int $id, array $request_data = null)
Create a company bank account for a third party
array|mixed
updateCompanyBankAccount(int $id, int $bankaccount_id, array $request_data = null)
Update a company bank account of a third party
int
deleteCompanyBankAccount(int $id, int $bankaccount_id)
Delete a bank account attached to a third party
array
generateBankAccountDocument(int $id, int $companybankid = null, string $model = 'sepamandate')
Generate a document from a bank account record
Like SEPA mandate
array|mixed
getSocieteAccounts(int $id, string $site = null)
Get a specific account attached to a third party
Specify the site key
array|mixed
getSocieteByAccounts(string $site, string $key_account)
Get a specific third party by account
array|mixed
createSocieteAccount(int $id, array $request_data = null)
Create and attach a new account to an existing third party
Possible fields for request_data (request body) are specified in llx_societe_account table.
See Table llx_societe_account wiki page for more information
Example body payload :
{"key_account": "cus_DAVkLSs1LYyYI", "site": "stripe"}
array|mixed
postSocieteAccount(int $id, string $site, array $request_data = null)
Create and attach a new (or replace an existing) specific site account for a third party
You MUST pass all values to keep (otherwise, they will be deleted) !
If you just need to update specific fields prefer PUT /thirdparties/{id}/accounts/{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.
array|mixed
putSocieteAccount(int $id, string $site, array $request_data = null)
Update specified values of a specific account attached to a third party
void
deleteSocieteAccount(int $id, string $site)
Delete a specific site account attached to a third party
by account id
void
deleteSocieteAccounts(int $id)
Delete all accounts attached to a third party