|
dolibarr
13.0.2
|
Inheritance diagram for Thirdparties:
Collaboration diagram for Thirdparties:Public Member Functions | |
| __construct () | |
| Constructor. | |
| get ($id) | |
| Get properties of a thirdparty object. More... | |
| getByEmail ($email) | |
| Get properties of a thirdparty object by email. More... | |
| getByBarcode ($barcode) | |
| Get properties of a thirdparty object by barcode. More... | |
| index ($sortfield="t.rowid", $sortorder= 'ASC', $limit=100, $page=0, $mode=0, $category=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... | |
| setThirdpartyPriceLevel ($id, $priceLevel) | |
| Set new price level for the given 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... | |
| getSalesRepresentatives ($id, $mode=0) | |
| Get representatives 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... | |
| deleteSocieteAccount ($id, $site) | |
| Delete a specific site gateway attached to a thirdparty (by gateway id) More... | |
| deleteSocieteAccounts ($id) | |
| Delete all gateways attached to a thirdparty. More... | |
Public Member Functions inherited from DolibarrApi | |
| __construct ($db, $cachedir= '', $refreshCache=false) | |
| Constructor. More... | |
Protected Member Functions | |
| _cleanObjectDatas ($object) | |
| Clean sensible object datas. More... | |
Protected Member Functions inherited from DolibarrApi | |
| _cleanObjectDatas ($object) | |
| Executed method when API is called without parameter. More... | |
| _checkFilters ($sqlfilters) | |
| Return if a $sqlfilters parameter is valid. More... | |
Private Member Functions | |
| _validate ($data) | |
| Validate fields before create or update object. More... | |
| _fetch ($rowid, $ref= '', $ref_ext= '', $barcode= '', $idprof1= '', $idprof2= '', $idprof3= '', $idprof4= '', $idprof5= '', $idprof6= '', $email= '', $ref_alias= '') | |
| Fetch properties of a thirdparty 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 user access to a resource. More... | |
| static | _forge_criteria_callback ($matches) |
| Function to forge a SQL criteria. More... | |
Definition at line 30 of file api_thirdparties.class.php.
|
protected |
Clean sensible object datas.
| Object | $object | Object to clean |
Definition at line 1737 of file api_thirdparties.class.php.
Referenced by _fetch(), addCategory(), addSupplierCategory(), createCompanyBankAccount(), createSocieteAccount(), deleteCategory(), deleteSupplierCategory(), index(), patchSocieteAccount(), putSocieteAccount(), setThirdpartyPriceLevel(), and updateCompanyBankAccount().
|
private |
Fetch properties of a thirdparty object.
Return an array with thirdparty informations
| int | $rowid | Id of third party to load (Use 0 to get a specimen record, use null to use other search criterias) |
| string | $ref | Reference of third party, name (Warning, this can return several records) |
| string | $ref_ext | External reference of third party (Warning, this information is a free field not provided by Dolibarr) |
| string | $barcode | Barcode of third party to load |
| string | $idprof1 | Prof id 1 of third party (Warning, this can return several records) |
| string | $idprof2 | Prof id 2 of third party (Warning, this can return several records) |
| string | $idprof3 | Prof id 3 of third party (Warning, this can return several records) |
| string | $idprof4 | Prof id 4 of third party (Warning, this can return several records) |
| string | $idprof5 | Prof id 5 of third party (Warning, this can return several records) |
| string | $idprof6 | Prof id 6 of third party (Warning, this can return several records) |
| string | Email of third party (Warning, this can return several records) | |
| string | $ref_alias | Name_alias of third party (Warning, this can return several records) |
| RestException |
Definition at line 1812 of file api_thirdparties.class.php.
References DolibarrApi\_checkAccessToResource(), _cleanObjectDatas(), and price2num().
Referenced by get(), getByBarcode(), and getByEmail().
|
private |
Validate fields before create or update object.
| array | $data | Datas to validate |
| RestException |
Definition at line 1780 of file api_thirdparties.class.php.
Referenced by post().
| Thirdparties::addCategory | ( | $id, | |
| $category_id | |||
| ) |
Add a customer category to a thirdparty.
| int | $id | Id of thirdparty |
| int | $category_id | Id of category |
POST {id}/categories/{category_id}
Definition at line 619 of file api_thirdparties.class.php.
References DolibarrApi\_checkAccessToResource(), _cleanObjectDatas(), and db.
| Thirdparties::addSupplierCategory | ( | $id, | |
| $category_id | |||
| ) |
Add a supplier category to a thirdparty.
| int | $id | Id of thirdparty |
| int | $category_id | Id of category |
POST {id}/supplier_categories/{category_id}
Definition at line 737 of file api_thirdparties.class.php.
References DolibarrApi\_checkAccessToResource(), _cleanObjectDatas(), and db.
| Thirdparties::createCompanyBankAccount | ( | $id, | |
$request_data = null |
|||
| ) |
Create CompanyBankAccount object for thirdparty.
| int | $id | ID of thirdparty |
| array | $request_data | Request data |
POST {id}/bankaccounts
Definition at line 1196 of file api_thirdparties.class.php.
References _cleanObjectDatas(), db, and dol_now().
| 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"}| int | $id | ID of thirdparty |
| array | $request_data | Request data |
| RestException | 401 Unauthorized: User does not have permission to read thirdparties |
| RestException | 409 Conflict: A SocieteAccount entity (gateway) already exists for this company and site. |
| RestException | 422 Unprocessable Entity: You must pass the site attribute in your request data ! |
| RestException | 500 Internal Server Error: Error creating SocieteAccount account |
POST {id}/gateways
Definition at line 1472 of file api_thirdparties.class.php.
References _cleanObjectDatas(), and db.
| Thirdparties::delete | ( | $id | ) |
Delete thirdparty.
| int | $id | Thirparty ID |
Definition at line 491 of file api_thirdparties.class.php.
References DolibarrApi\_checkAccessToResource().
| Thirdparties::deleteCategory | ( | $id, | |
| $category_id | |||
| ) |
Remove the link between a customer category and the thirdparty.
| int | $id | Id of thirdparty |
| int | $category_id | Id of category |
DELETE {id}/categories/{category_id}
Definition at line 657 of file api_thirdparties.class.php.
References DolibarrApi\_checkAccessToResource(), _cleanObjectDatas(), and db.
| Thirdparties::deleteCompanyBankAccount | ( | $id, | |
| $bankaccount_id | |||
| ) |
Delete a bank account attached to a thirdparty.
| int | $id | ID of thirdparty |
| int | $bankaccount_id | ID of CompanyBankAccount |
DELETE {id}/bankaccounts/{bankaccount_id}
Definition at line 1283 of file api_thirdparties.class.php.
References db.
| Thirdparties::deleteSocieteAccount | ( | $id, | |
| $site | |||
| ) |
Delete a specific site gateway attached to a thirdparty (by gateway id)
| int | $id | ID of thirdparty |
| int | $site | Site key |
| RestException | 401 Unauthorized: User does not have permission to delete thirdparties gateways |
| RestException | 404 Not Found: Specified thirdparty ID does not belongs to an existing thirdparty |
| RestException | 500 Internal Server Error: Error deleting SocieteAccount entity |
DELETE {id}/gateways/{site}
Definition at line 1661 of file api_thirdparties.class.php.
References db.
| Thirdparties::deleteSocieteAccounts | ( | $id | ) |
Delete all gateways attached to a thirdparty.
| int | $id | ID of thirdparty |
| RestException | 401 Unauthorized: User does not have permission to delete thirdparties gateways |
| RestException | 404 Not Found: Specified thirdparty ID does not belongs to an existing thirdparty |
| RestException | 500 Internal Server Error: Error deleting SocieteAccount entity |
DELETE {id}/gateways
We select all the records that match the socid
Definition at line 1695 of file api_thirdparties.class.php.
References db.
| Thirdparties::deleteSupplierCategory | ( | $id, | |
| $category_id | |||
| ) |
Remove the link between a category and the thirdparty.
| int | $id | Id of thirdparty |
| int | $category_id | Id of category |
DELETE {id}/supplier_categories/{category_id}
Definition at line 775 of file api_thirdparties.class.php.
References DolibarrApi\_checkAccessToResource(), _cleanObjectDatas(), and db.
| Thirdparties::generateBankAccountDocument | ( | $id, | |
$companybankid = null, |
|||
$model = 'sepamandate' |
|||
| ) |
Generate a Document from a bank account record (like SEPA mandate)
| int | $id | Thirdparty id |
| int | $companybankid | Companybank id |
| string | $model | Model of document to generate |
GET {id}/generateBankAccountDocument/{companybankid}/{model}
Definition at line 1309 of file api_thirdparties.class.php.
References db, and dol_sanitizeFileName().
| Thirdparties::get | ( | $id | ) |
Get properties of a thirdparty object.
Return an array with thirdparty informations
| int | $id | Id of third party to load |
| RestException |
Definition at line 75 of file api_thirdparties.class.php.
References _fetch().
| Thirdparties::getByBarcode | ( | $barcode | ) |
Get properties of a thirdparty object by barcode.
Return an array with thirdparty informations
| string | $barcode | Barcode of third party to load |
GET barcode/{barcode}
| RestException |
Definition at line 109 of file api_thirdparties.class.php.
References _fetch().
| Thirdparties::getByEmail | ( | ) |
Get properties of a thirdparty object by email.
Return an array with thirdparty informations
| string | Email of third party to load |
GET email/{email}
| RestException |
Definition at line 92 of file api_thirdparties.class.php.
References _fetch().
| Thirdparties::getCategories | ( | $id, | |
$sortfield = "s.rowid", |
|||
$sortorder = 'ASC', |
|||
$limit = 0, |
|||
$page = 0 |
|||
| ) |
Get customer categories for a thirdparty.
| int | $id | ID of thirdparty |
| string | $sortfield | Sort field |
| string | $sortorder | Sort order |
| int | $limit | Limit for list |
| int | $page | Page number |
GET {id}/categories
Definition at line 580 of file api_thirdparties.class.php.
References db.
| Thirdparties::getCompanyBankAccount | ( | $id | ) |
Get CompanyBankAccount objects for thirdparty.
| int | $id | ID of thirdparty |
GET {id}/bankaccounts
We select all the records that match the socid
Definition at line 1120 of file api_thirdparties.class.php.
References DolibarrApi\_checkAccessToResource(), and db.
| Thirdparties::getFixedAmountDiscounts | ( | $id, | |
$filter = "none", |
|||
$sortfield = "f.type", |
|||
$sortorder = 'ASC' |
|||
| ) |
Get fixed amount discount of a thirdparty (all sources: deposit, credit note, commercial offers...)
| int | $id | ID of the thirdparty |
| string | $filter | Filter exceptional discount. "none" will return every discount, "available" returns unapplied discounts, "used" returns applied discounts { none,available,used} |
| string | $sortfield | Sort field |
| string | $sortorder | Sort order |
GET {id}/fixedamountdiscounts
| RestException | 400 |
| RestException | 401 |
| RestException | 404 |
| RestException | 503 |
Definition at line 983 of file api_thirdparties.class.php.
References DolibarrApi\_checkAccessToResource(), and db.
| 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 partialy) + not already replaced + not already a credit note
| int | $id | Id of thirdparty |
GET {id}/getinvoicesqualifiedforcreditnote
| RestException | 400 |
| RestException | 401 |
| RestException | 404 |
| RestException | 405 |
Definition at line 1084 of file api_thirdparties.class.php.
References DolibarrApi\_checkAccessToResource(), and db.
| Thirdparties::getInvoicesQualifiedForReplacement | ( | $id | ) |
Return list of invoices qualified to be replaced by another invoice.
| int | $id | Id of thirdparty |
GET {id}/getinvoicesqualifiedforreplacement
| RestException | 400 |
| RestException | 401 |
| RestException | 404 |
| RestException | 405 |
Definition at line 1041 of file api_thirdparties.class.php.
References DolibarrApi\_checkAccessToResource(), and db.
| Thirdparties::getOutStandingInvoices | ( | $id, | |
$mode = 'customer' |
|||
| ) |
Get outstanding invoices of thirdparty.
| int | $id | ID of the thirdparty |
| string | $mode | 'customer' or 'supplier' |
GET {id}/outstandinginvoices
| RestException | 400 |
| RestException | 401 |
| RestException | 404 |
Definition at line 901 of file api_thirdparties.class.php.
References DolibarrApi\_checkAccessToResource().
| Thirdparties::getOutStandingOrder | ( | $id, | |
$mode = 'customer' |
|||
| ) |
Get outstanding orders of thirdparty.
| int | $id | ID of the thirdparty |
| string | $mode | 'customer' or 'supplier' |
GET {id}/outstandingorders
| RestException | 400 |
| RestException | 401 |
| RestException | 404 |
Definition at line 860 of file api_thirdparties.class.php.
References DolibarrApi\_checkAccessToResource().
| Thirdparties::getOutStandingProposals | ( | $id, | |
$mode = 'customer' |
|||
| ) |
Get outstanding proposals of thirdparty.
| int | $id | ID of the thirdparty |
| string | $mode | 'customer' or 'supplier' |
GET {id}/outstandingproposals
| RestException | 400 |
| RestException | 401 |
| RestException | 404 |
Definition at line 818 of file api_thirdparties.class.php.
References DolibarrApi\_checkAccessToResource().
| Thirdparties::getSalesRepresentatives | ( | $id, | |
$mode = 0 |
|||
| ) |
Get representatives of thirdparty.
| int | $id | ID of the thirdparty |
| string | $mode | 0=Array with properties, 1=Array of id. |
GET {id}/representatives
| RestException | 400 |
| RestException | 401 |
| RestException | 404 |
Definition at line 942 of file api_thirdparties.class.php.
References DolibarrApi\_checkAccessToResource().
| Thirdparties::getSocieteAccounts | ( | $id, | |
$site = null |
|||
| ) |
Get a specific gateway attached to a thirdparty (by specifying the site key)
| int | $id | ID of thirdparty |
| string | $site | Site key |
| RestException | 401 Unauthorized: User does not have permission to read thirdparties |
| RestException | 404 Not 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 1397 of file api_thirdparties.class.php.
References DolibarrApi\_checkAccessToResource(), and db.
| Thirdparties::getSupplierCategories | ( | $id, | |
$sortfield = "s.rowid", |
|||
$sortorder = 'ASC', |
|||
$limit = 0, |
|||
$page = 0 |
|||
| ) |
Get supplier categories for a thirdparty.
| int | $id | ID of thirdparty |
| string | $sortfield | Sort field |
| string | $sortorder | Sort order |
| int | $limit | Limit for list |
| int | $page | Page number |
GET {id}/supplier_categories
Definition at line 698 of file api_thirdparties.class.php.
References db.
| Thirdparties::index | ( | $sortfield = "t.rowid", |
|
$sortorder = 'ASC', |
|||
$limit = 100, |
|||
$page = 0, |
|||
$mode = 0, |
|||
$category = 0, |
|||
$sqlfilters = '' |
|||
| ) |
List thirdparties.
Get a list of thirdparties
| string | $sortfield | Sort field |
| string | $sortorder | Sort order |
| int | $limit | Limit for list |
| int | $page | Page number |
| int | $mode | Set 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 | $category | Use this param to filter list by category |
| string | $sqlfilters | Other criteria to filter answers separated by a comma. Syntax example "(t.nom:like:'TheCompany%') and (t.date_creation:<:'20160101')" |
Definition at line 131 of file api_thirdparties.class.php.
References DolibarrApi\_checkFilters(), _cleanObjectDatas(), and db.
| 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).
| int | $id | ID of thirdparty to keep (the target thirdparty) |
| int | $idtodelete | ID of thirdparty to remove (the thirdparty to delete), once data has been merged into the target thirdparty. |
PUT {id}/merge/{idtodelete}
Definition at line 292 of file api_thirdparties.class.php.
References DolibarrApi\_checkAccessToResource(), db, dol_concatdesc(), and dol_syslog().
| Thirdparties::patchSocieteAccount | ( | $id, | |
| $site, | |||
$request_data = null |
|||
| ) |
Update specified values of a specific site gateway attached to a thirdparty.
| int | $id | Id of thirdparty |
| string | $site | Site key |
| array | $request_data | Request data |
| RestException | 401 Unauthorized: User does not have permission to read thirdparties |
| RestException | 404 Not Found: Specified thirdparty ID does not belongs to an existing thirdparty |
| RestException | 409 Conflict: Another SocieteAccount entity already exists for this thirdparty with this site key. |
| RestException | 500 Internal Server Error: Error updating SocieteAccount entity |
PATCH {id}/gateways/{site}
Definition at line 1610 of file api_thirdparties.class.php.
References _cleanObjectDatas(), and db.
| Thirdparties::post | ( | $request_data = null | ) |
Create thirdparty object.
| array | $request_data | Request datas |
Definition at line 227 of file api_thirdparties.class.php.
References _validate().
| Thirdparties::put | ( | $id, | |
$request_data = null |
|||
| ) |
Update thirdparty.
| int | $id | Id of thirdparty to update |
| array | $request_data | Datas |
Definition at line 251 of file api_thirdparties.class.php.
References DolibarrApi\_checkAccessToResource().
| 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.
| int | $id | ID of thirdparty |
| string | $site | Site key |
| array | $request_data | Request data |
| RestException | 401 Unauthorized: User does not have permission to read thirdparties |
| RestException | 422 Unprocessable Entity: You must pass the site attribute in your request data ! |
| RestException | 500 Internal Server Error: Error updating SocieteAccount entity |
PUT {id}/gateways/{site}
Definition at line 1529 of file api_thirdparties.class.php.
References _cleanObjectDatas(), and db.
| Thirdparties::setThirdpartyPriceLevel | ( | $id, | |
| $priceLevel | |||
| ) |
Set new price level for the given thirdparty.
| int | $id | ID of thirdparty |
| int | $priceLevel | Price level to apply to thirdparty |
PUT {id}/setpricelevel
| RestException | 400 Price level out of bounds |
| RestException | 401 Access not allowed for your login |
| RestException | 404 Thirdparty not found |
| RestException | 500 Error fetching/setting price level |
| RestException | 501 Request needs modules "Thirdparties" and "Products" and setting Multiprices activated |
Definition at line 522 of file api_thirdparties.class.php.
References DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().
| Thirdparties::updateCompanyBankAccount | ( | $id, | |
| $bankaccount_id, | |||
$request_data = null |
|||
| ) |
Update CompanyBankAccount object for thirdparty.
| int | $id | ID of thirdparty |
| int | $bankaccount_id | ID of CompanyBankAccount |
| array | $request_data | Request data |
PUT {id}/bankaccounts/{bankaccount_id}
Definition at line 1239 of file api_thirdparties.class.php.
References _cleanObjectDatas(), db, and dol_now().