dolibarr 21.0.0-alpha
Thirdparties Class Reference
Inheritance diagram for Thirdparties:
Collaboration diagram for Thirdparties:

Public Member Functions

 __construct ()
 Constructor.
 
 get ($id)
 Get properties of a thirdparty object.
 
 getByEmail ($email)
 Get properties of a thirdparty object by email.
 
 getByBarcode ($barcode)
 Get properties of a thirdparty object by barcode.
 
 index ($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0, $mode=0, $category=0, $sqlfilters='', $properties='', $pagination_data=false)
 List thirdparties.
 
 post ($request_data=null)
 Create thirdparty object.
 
 put ($id, $request_data=null)
 Update thirdparty.
 
 merge ($id, $idtodelete)
 Merge a third party into another one.
 
 delete ($id)
 Delete thirdparty.
 
 setThirdpartyPriceLevel ($id, $priceLevel)
 Set new price level for the given thirdparty.
 
 addRepresentative ($id, $representative_id)
 Add a customer representative to a thirdparty.
 
 deleteRepresentative ($id, $representative_id)
 Delete a customer representative to a thirdparty.
 
 getCategories ($id, $sortfield="s.rowid", $sortorder='ASC', $limit=0, $page=0)
 Get customer categories for a thirdparty.
 
 addCategory ($id, $category_id)
 Add a customer category to a thirdparty.
 
 deleteCategory ($id, $category_id)
 Remove the link between a customer category and the thirdparty.
 
 getSupplierCategories ($id, $sortfield="s.rowid", $sortorder='ASC', $limit=0, $page=0)
 Get supplier categories for a thirdparty.
 
 addSupplierCategory ($id, $category_id)
 Add a supplier category to a thirdparty.
 
 deleteSupplierCategory ($id, $category_id)
 Remove the link between a category and the thirdparty.
 
 getOutStandingProposals ($id, $mode='customer')
 Get outstanding proposals of thirdparty.
 
 getOutStandingOrder ($id, $mode='customer')
 Get outstanding orders of thirdparty.
 
 getOutStandingInvoices ($id, $mode='customer')
 Get outstanding invoices of thirdparty.
 
 getSalesRepresentatives ($id, $mode=0)
 Get representatives of thirdparty.
 
 getFixedAmountDiscounts ($id, $filter="none", $sortfield="f.type", $sortorder='ASC')
 Get fixed amount discount of a thirdparty (all sources: deposit, credit note, commercial offers...)
 
 getInvoicesQualifiedForReplacement ($id)
 Return list of invoices qualified to be replaced by another invoice.
 
 getInvoicesQualifiedForCreditNote ($id)
 Return list of invoices qualified to be corrected by a credit note.
 
 getCompanyNotification ($id)
 Get CompanyNotification objects for thirdparty.
 
 createCompanyNotification ($id, $request_data=null)
 Create CompanyNotification object for thirdparty.
 
 createCompanyNotificationByCode ($id, $code, $request_data=null)
 Create CompanyNotification object for thirdparty using action trigger code.
 
 deleteCompanyNotification ($id, $notification_id)
 Delete a CompanyNotification attached to a thirdparty.
 
 updateCompanyNotification ($id, $notification_id, $request_data=null)
 Update CompanyNotification object for thirdparty.
 
 getCompanyBankAccount ($id)
 Get CompanyBankAccount objects for thirdparty.
 
 createCompanyBankAccount ($id, $request_data=null)
 Create CompanyBankAccount object for thirdparty.
 
 updateCompanyBankAccount ($id, $bankaccount_id, $request_data=null)
 Update CompanyBankAccount object for thirdparty.
 
 deleteCompanyBankAccount ($id, $bankaccount_id)
 Delete a bank account attached to a thirdparty.
 
 generateBankAccountDocument ($id, $companybankid=null, $model='sepamandate')
 Generate a Document from a bank account record (like SEPA mandate)
 
 getSocieteAccounts ($id, $site=null)
 Get a specific account attached to a thirdparty (by specifying the site key)
 
 createSocieteAccount ($id, $request_data=null)
 Create and attach a new account to an existing thirdparty.
 
 putSocieteAccount ($id, $site, $request_data=null)
 Create and attach a new (or replace an existing) specific site account to a thirdparty.
 
 patchSocieteAccount ($id, $site, $request_data=null)
 Update specified values of a specific account attached to a thirdparty.
 
 deleteSocieteAccount ($id, $site)
 Delete a specific site account attached to a thirdparty (by account id)
 
 deleteSocieteAccounts ($id)
 Delete all accounts attached to a thirdparty.
 
- Public Member Functions inherited from DolibarrApi
 __construct ($db, $cachedir='', $refreshCache=false)
 Constructor.
 

Protected Member Functions

 _cleanObjectDatas ($object)
 Clean sensible object datas.
 
- 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.
 
 _fetch ($rowid, $ref='', $ref_ext='', $barcode='', $idprof1='', $idprof2='', $idprof3='', $idprof4='', $idprof5='', $idprof6='', $email='', $ref_alias='')
 Fetch properties of a thirdparty 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 33 of file api_thirdparties.class.php.

Member Function Documentation

◆ _cleanObjectDatas()

Thirdparties::_cleanObjectDatas ( $object)
protected

◆ _fetch()

Thirdparties::_fetch ( $rowid,
$ref = '',
$ref_ext = '',
$barcode = '',
$idprof1 = '',
$idprof2 = '',
$idprof3 = '',
$idprof4 = '',
$idprof5 = '',
$idprof6 = '',
$email = '',
$ref_alias = '' )
private

Fetch properties of a thirdparty object.

Return an array with thirdparty information

Parameters
?int$rowidId of third party to load (Use 0 to get a specimen record, use null to use other search criteria)
string$refReference of third party, name (Warning, this can return several records)
string$ref_extExternal reference of third party (Warning, this information is a free field not provided by Dolibarr)
string$barcodeBarcode of third party to load
string$idprof1Prof id 1 of third party (Warning, this can return several records)
string$idprof2Prof id 2 of third party (Warning, this can return several records)
string$idprof3Prof id 3 of third party (Warning, this can return several records)
string$idprof4Prof id 4 of third party (Warning, this can return several records)
string$idprof5Prof id 5 of third party (Warning, this can return several records)
string$idprof6Prof id 6 of third party (Warning, this can return several records)
string$emailEmail of third party (Warning, this can return several records)
string$ref_aliasName_alias of third party (Warning, this can return several records)
Returns
object cleaned Societe object
Exceptions
RestException

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

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

Referenced by get(), getByBarcode(), and getByEmail().

◆ _validate()

Thirdparties::_validate ( $data)
private

Validate fields before create or update object.

Parameters
array$dataDatas to validate
Returns
array
Exceptions
RestException

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

Referenced by post().

◆ addCategory()

Thirdparties::addCategory ( $id,
$category_id )

Add a customer category to a thirdparty.

Parameters
int$idId of thirdparty
int$category_idId of category
Returns
Object|void

@url PUT {id}/categories/{category_id}

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

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

◆ addRepresentative()

Thirdparties::addRepresentative ( $id,
$representative_id )

Add a customer representative to a thirdparty.

Parameters
int$idId of thirdparty
int$representative_idId of representative
Returns
int Return integer <=0 if KO, >0 if OK

@url POST {id}/representative/{representative_id}

Exceptions
RestException401 Access not allowed for your login
RestException404 User or Thirdparty not found

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

References $id, and DolibarrApi\_checkAccessToResource().

◆ 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

@url PUT {id}/supplier_categories/{category_id}

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

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

◆ createCompanyBankAccount()

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

Create CompanyBankAccount object for thirdparty.

Parameters
int$idID of thirdparty
array$request_dataRequest data
Returns
array|mixed BankAccount of thirdparty

@url POST {id}/bankaccounts

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

References $id, DolibarrApi\_checkValForAPI(), _cleanObjectDatas(), dol_now(), and sanitizeVal().

◆ createCompanyNotification()

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

Create CompanyNotification object for thirdparty.

Parameters
int$idID of thirdparty
array$request_dataRequest data
Returns
array|mixed Notification of thirdparty

@url POST {id}/notifications

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

References $id, and _cleanObjectDatas().

◆ createCompanyNotificationByCode()

Thirdparties::createCompanyNotificationByCode ( $id,
$code,
$request_data = null )

Create CompanyNotification object for thirdparty using action trigger code.

Parameters
int$idID of thirdparty
string$codeAction Trigger code
array$request_dataRequest data
Returns
array|mixed Notification of thirdparty @phan-return Notify

@url POST {id}/notificationsbycode/{code}

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

References $id, and _cleanObjectDatas().

◆ createSocieteAccount()

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

Create and attach a new account 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>
Example body payload :

{"key_account": "cus_DAVkLSs1LYyYI", "site": "stripe"}
Parameters
int$idID of thirdparty
array$request_dataRequest data
Returns
array|mixed
Exceptions
RestException401 Unauthorized: User does not have permission to read thirdparties
RestException409 Conflict: An Account already exists for this company and site.
RestException422 Unprocessable Entity: You must pass the site attribute in your request data !
RestException500 Internal Server Error: Error creating SocieteAccount account

@url POST {id}/accounts

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

References $id, DolibarrApi\_checkValForAPI(), _cleanObjectDatas(), and sanitizeVal().

◆ delete()

Thirdparties::delete ( $id)

Delete thirdparty.

Parameters
int$idThirdparty ID
Returns
array

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

References $id, and DolibarrApi\_checkAccessToResource().

◆ 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
Object|void

@url DELETE {id}/categories/{category_id}

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

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

◆ 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

@url DELETE {id}/bankaccounts/{bankaccount_id}

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

References $id.

◆ deleteCompanyNotification()

Thirdparties::deleteCompanyNotification ( $id,
$notification_id )

Delete a CompanyNotification attached to a thirdparty.

Parameters
int$idID of thirdparty
int$notification_idID of CompanyNotification
Returns
int -1 if error 1 if correct deletion

@url DELETE {id}/notifications/{notification_id}

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

References $id.

◆ deleteRepresentative()

Thirdparties::deleteRepresentative ( $id,
$representative_id )

Delete a customer representative to a thirdparty.

Parameters
int$idId of thirdparty
int$representative_idId of representative
Returns
int Return integer <=0 if KO, >0 if OK

@url DELETE {id}/representative/{representative_id}

Exceptions
RestException401 Access not allowed for your login
RestException404 User or Thirdparty not found

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

References $id, and DolibarrApi\_checkAccessToResource().

◆ deleteSocieteAccount()

Thirdparties::deleteSocieteAccount ( $id,
$site )

Delete a specific site account attached to a thirdparty (by account id)

Parameters
int$idID of thirdparty
int$siteSite key
Returns
void
Exceptions
RestException401 Unauthorized: User does not have permission to delete thirdparties accounts
RestException404 Not Found: Specified thirdparty ID does not belongs to an existing thirdparty
RestException500 Internal Server Error: Error deleting SocieteAccount entity

@url DELETE {id}/accounts/{site}

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

◆ deleteSocieteAccounts()

Thirdparties::deleteSocieteAccounts ( $id)

Delete all accounts attached to a thirdparty.

Parameters
int$idID of thirdparty
Returns
void
Exceptions
RestException401 Unauthorized: User does not have permission to delete thirdparties accounts
RestException404 Not Found: Specified thirdparty ID does not belongs to an existing thirdparty
RestException500 Internal Server Error: Error deleting SocieteAccount entity

@url DELETE {id}/accounts

We select all the records that match the socid

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

References $id.

◆ 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

@url DELETE {id}/supplier_categories/{category_id}

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

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

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

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

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

References $id, dol_sanitizeFileName(), and getDolGlobalInt().

◆ get()

Thirdparties::get ( $id)

Get properties of a thirdparty object.

Return an array with thirdparty information

Parameters
int$idId of third party to load
Returns
Object Object with cleaned properties
Exceptions
RestException

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

References $id, and _fetch().

◆ getByBarcode()

Thirdparties::getByBarcode ( $barcode)

Get properties of a thirdparty object by barcode.

Return an array with thirdparty information

Parameters
string$barcodeBarcode of third party to load
Returns
array|mixed Cleaned Societe object

@url GET barcode/{barcode}

Exceptions
RestException

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

References _fetch().

◆ getByEmail()

Thirdparties::getByEmail ( $email)

Get properties of a thirdparty object by email.

Return an array with thirdparty information

Parameters
string$emailEmail of third party to load
Returns
array|mixed Cleaned Societe object

@url GET email/{email}

Exceptions
RestException

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

References _fetch().

◆ 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
array|void

@url GET {id}/categories

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

References $id.

◆ getCompanyBankAccount()

Thirdparties::getCompanyBankAccount ( $id)

Get CompanyBankAccount objects for thirdparty.

Parameters
int$idID of thirdparty
Returns
array

@url GET {id}/bankaccounts

We select all the records that match the socid

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

References $id, $object, and DolibarrApi\_checkAccessToResource().

◆ getCompanyNotification()

Thirdparties::getCompanyNotification ( $id)

Get CompanyNotification objects for thirdparty.

Parameters
int$idID of thirdparty
Returns
array

@url GET {id}/notifications

We select all the records that match the socid

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

References $id, $object, and DolibarrApi\_checkAccessToResource().

◆ 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 {@choice none,available,used}
string$sortfieldSort field
string$sortorderSort order

@url GET {id}/fixedamountdiscounts

Returns
array List of fixed discount of thirdparty
Exceptions
RestException400
RestException401
RestException404
RestException503

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

References $id, and DolibarrApi\_checkAccessToResource().

◆ 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 (paid completely or paid partially) + not already replaced + not already a credit note

Parameters
int$idId of thirdparty

@url GET {id}/getinvoicesqualifiedforcreditnote

Returns
array
Exceptions
RestException400
RestException401
RestException404
RestException405

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

References $id, and DolibarrApi\_checkAccessToResource().

◆ getInvoicesQualifiedForReplacement()

Thirdparties::getInvoicesQualifiedForReplacement ( $id)

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

Parameters
int$idId of thirdparty

@url GET {id}/getinvoicesqualifiedforreplacement

Returns
array
Exceptions
RestException400
RestException401
RestException404
RestException405

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

References $id, and DolibarrApi\_checkAccessToResource().

◆ getOutStandingInvoices()

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

Get outstanding invoices of thirdparty.

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

@url GET {id}/outstandinginvoices

Returns
array List of outstandings invoices of thirdparty
Exceptions
RestException400
RestException401
RestException404

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

References $id, and DolibarrApi\_checkAccessToResource().

◆ getOutStandingOrder()

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

Get outstanding orders of thirdparty.

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

@url GET {id}/outstandingorders

Returns
array List of outstandings orders of thirdparty
Exceptions
RestException400
RestException401
RestException404

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

References $id, and DolibarrApi\_checkAccessToResource().

◆ getOutStandingProposals()

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

Get outstanding proposals of thirdparty.

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

@url GET {id}/outstandingproposals

Returns
array List of outstandings proposals of thirdparty
Exceptions
RestException400
RestException401
RestException404

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

References $id, and DolibarrApi\_checkAccessToResource().

◆ getSalesRepresentatives()

Thirdparties::getSalesRepresentatives ( $id,
$mode = 0 )

Get representatives of thirdparty.

Parameters
int$idID of the thirdparty
int$mode0=Array with properties, 1=Array of id.

@url GET {id}/representatives

Returns
array List of representatives of thirdparty
Exceptions
RestException400
RestException401
RestException404

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

References $id, and DolibarrApi\_checkAccessToResource().

◆ getSocieteAccounts()

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

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

Parameters
int$idID of thirdparty
string$siteSite key
Returns
array|mixed
Exceptions
RestException401 Unauthorized: User does not have permission to read thirdparties
RestException404 Not Found: Specified thirdparty ID does not belongs to an existing thirdparty

@url GET {id}/accounts/

We select all the records that match the socid

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

References $id, $object, and DolibarrApi\_checkAccessToResource().

◆ 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

@url GET {id}/supplier_categories

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

References $id.

◆ index()

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

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 Set to 4 to show only suppliers
int$categoryUse this param to filter list by category
string$sqlfiltersOther criteria to filter answers separated by a comma. Syntax example "((t.nom:like:'TheCompany%') or (t.name_alias:like:'TheCompany%')) and (t.datec:<:'20160101')"
string$propertiesRestrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
bool$pagination_dataIf this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0*
Returns
array Array of thirdparty objects

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

References _cleanObjectDatas(), DolibarrApi\_filterObjectProperties(), and forgeSQLFromUniversalSearchCriteria().

◆ merge()

Thirdparties::merge ( $id,
$idtodelete )

Merge a third party into another one.

Merge content (properties, notes) and objects (like invoices, events, orders, proposals, ...) of a thirdparty into a target third party, then delete the merged third party. If a property has a defined value both in third party to delete and third party to keep, the value into the third party 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 third party)
int$idtodeleteID of thirdparty to remove (the thirdparty to delete), once data has been merged into the target third party.
Returns
Object Return the resulted third party.

@url PUT {id}/merge/{idtodelete}

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

References $id, and DolibarrApi\_checkAccessToResource().

◆ patchSocieteAccount()

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

Update specified values of a specific account attached to a thirdparty.

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

@url PATCH {id}/accounts/{site}

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

References $id, DolibarrApi\_checkValForAPI(), _cleanObjectDatas(), and sanitizeVal().

◆ post()

Thirdparties::post ( $request_data = null)

Create thirdparty object.

Parameters
array$request_dataRequest datas
Returns
int ID of thirdparty

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

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

◆ put()

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

Update thirdparty.

Parameters
int$idId of thirdparty to update
array$request_dataDatas
Returns
Object|false Updated object
Exceptions
RestException401
RestException404
RestException500

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

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

◆ putSocieteAccount()

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

Create and attach a new (or replace an existing) specific site account 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}/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.

Parameters
int$idID of thirdparty
string$siteSite key
array$request_dataRequest data
Returns
array|mixed
Exceptions
RestException401 Unauthorized: User does not have permission to read thirdparties
RestException422 Unprocessable Entity: You must pass the site attribute in your request data !
RestException500 Internal Server Error: Error updating SocieteAccount entity

@url PUT {id}/accounts/{site}

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

References $id, DolibarrApi\_checkValForAPI(), _cleanObjectDatas(), and sanitizeVal().

◆ setThirdpartyPriceLevel()

Thirdparties::setThirdpartyPriceLevel ( $id,
$priceLevel )

Set new price level for the given thirdparty.

Parameters
int$idID of thirdparty
int$priceLevelPrice level to apply to thirdparty
Returns
Object Thirdparty data without useless information

@url PUT {id}/setpricelevel/{priceLevel}

Exceptions
RestException400 Price level out of bounds
RestException401 Access not allowed for your login
RestException404 Thirdparty not found
RestException500 Error fetching/setting price level
RestException501 Request needs modules "Thirdparties" and "Products" and setting Multiprices activated

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

References $id, DolibarrApi\_checkAccessToResource(), _cleanObjectDatas(), and getDolGlobalString().

◆ 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
array|mixed BankAccount of thirdparty

@url PUT {id}/bankaccounts/{bankaccount_id}

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

References $id, DolibarrApi\_checkValForAPI(), _cleanObjectDatas(), dol_now(), and sanitizeVal().

◆ updateCompanyNotification()

Thirdparties::updateCompanyNotification ( $id,
$notification_id,
$request_data = null )

Update CompanyNotification object for thirdparty.

Parameters
int$idID of thirdparty
int$notification_idID of CompanyNotification
array$request_dataRequest data
Returns
array|mixed Notification of thirdparty

@url PUT {id}/notifications/{notification_id}

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

References $id, and _cleanObjectDatas().


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