dolibarr 19.0.3
|
Class for API REST v1. More...
Public Member Functions | |
__construct ($db, $cachedir='', $refreshCache=false) | |
Constructor. | |
Protected Member Functions | |
_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. | |
_cleanObjectDatas ($object) | |
Clean sensible object datas. | |
_checkFilters ($sqlfilters, &$error='') | |
Return if a $sqlfilters parameter is valid Function no more used. | |
Static Protected Member Functions | |
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. | |
Class for API REST v1.
Definition at line 30 of file api.class.php.
DolibarrApi::__construct | ( | $db, | |
$cachedir = '', | |||
$refreshCache = false ) |
Constructor.
DoliDb | $db | Database handler |
string | $cachedir | Cache dir |
boolean | $refreshCache | Update cache |
Definition at line 49 of file api.class.php.
References getDolGlobalString().
|
staticprotected |
Check access by user to a given resource.
string | $resource | element to check |
int | $resource_id | Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional). |
string | $dbtablename | 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity. Not used if objectid is null (optional) |
string | $feature2 | Feature to check, second level of permission (optional). Can be or check with 'level1|level2'. |
string | $dbt_keyfield | Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional) |
string | $dbt_select | Field name for select if not rowid. Not used if objectid is null (optional) |
Definition at line 305 of file api.class.php.
References checkUserAccessToObject().
Referenced by Invoices\_fetch(), Orders\_fetch(), Products\_fetch(), Proposals\_fetch(), Thirdparties\_fetch(), Invoices\_fetchTemplateInvoice(), Contracts\activateLine(), Contacts\addCategory(), Thirdparties\addCategory(), Invoices\addContact(), Invoices\addPayment(), SupplierInvoices\addPayment(), Invoices\addPaymentDistributed(), Products\addPurchasePrice(), Products\addSubproducts(), Thirdparties\addSupplierCategory(), Tasks\addTimeSpent(), SupplierOrders\approve(), Contracts\close(), Orders\close(), Proposals\close(), Receptions\close(), Shipments\close(), Interventions\closeFichinter(), Contacts\createUser(), AgendaEvents\delete(), Boms\delete(), Categories\delete(), Contacts\delete(), Contracts\delete(), Donations\delete(), ExpenseReports\delete(), Interventions\delete(), Invoices\delete(), KnowledgeManagement\delete(), Members\delete(), MembersTypes\delete(), Mos\delete(), MyModuleApi\delete(), Orders\delete(), Partnerships\delete(), Products\delete(), Projects\delete(), Proposals\delete(), Receptions\delete(), Shipments\delete(), SupplierInvoices\delete(), SupplierOrders\delete(), Tasks\delete(), Thirdparties\delete(), Tickets\delete(), Users\delete(), Warehouses\delete(), Zapier\delete(), Recruitments\deleteCandidature(), Contacts\deleteCategory(), Thirdparties\deleteCategory(), Invoices\deleteContact(), Orders\deleteContact(), Proposals\deleteContact(), SupplierOrders\deleteContact(), Recruitments\deleteJobPosition(), Boms\deleteLine(), Contracts\deleteLine(), Invoices\deleteLine(), Orders\deleteLine(), Proposals\deleteLine(), Receptions\deleteLine(), Shipments\deleteLine(), SupplierInvoices\deleteLine(), Products\deletePurchasePrice(), Thirdparties\deleteSupplierCategory(), Tasks\deleteTimeSpent(), Products\delSubproducts(), AgendaEvents\get(), Boms\get(), Categories\get(), Contacts\get(), Contracts\get(), Donations\get(), ExpenseReports\get(), Interventions\get(), KnowledgeManagement\get(), Members\get(), MembersTypes\get(), Mos\get(), MyModuleApi\get(), Partnerships\get(), Projects\get(), Receptions\get(), Shipments\get(), SupplierInvoices\get(), SupplierOrders\get(), SupplierProposals\get(), Tasks\get(), Users\get(), Warehouses\get(), Zapier\get(), Contacts\getByEmail(), Users\getByEmail(), Users\getByLogin(), Members\getByThirdparty(), Members\getByThirdpartyBarcode(), Members\getByThirdpartyEmail(), Recruitments\getCandidature(), Tickets\getCommon(), Thirdparties\getCompanyBankAccount(), Orders\getContacts(), SupplierOrders\getContacts(), Invoices\getDiscount(), Thirdparties\getFixedAmountDiscounts(), Users\getInfo(), Thirdparties\getInvoicesQualifiedForCreditNote(), Thirdparties\getInvoicesQualifiedForReplacement(), Recruitments\getJobPosition(), Boms\getLines(), Contracts\getLines(), Invoices\getLines(), Orders\getLines(), Projects\getLines(), Proposals\getLines(), SupplierInvoices\getLines(), Categories\getObjects(), Thirdparties\getOutStandingInvoices(), Thirdparties\getOutStandingOrder(), Thirdparties\getOutStandingProposals(), Invoices\getPayments(), SupplierInvoices\getPayments(), Products\getPurchasePrices(), Projects\getRoles(), Tasks\getRoles(), Thirdparties\getSalesRepresentatives(), Thirdparties\getSocieteAccounts(), Products\getStock(), Products\getSubproducts(), SupplierOrders\makeOrder(), Invoices\markAsCreditAvailable(), Thirdparties\merge(), Invoices\postContact(), Orders\postContact(), Proposals\postContact(), SupplierOrders\postContact(), Boms\postLine(), Contracts\postLine(), Interventions\postLine(), Invoices\postLine(), Orders\postLine(), Proposals\postLine(), SupplierInvoices\postLine(), Proposals\postLines(), AgendaEvents\put(), Boms\put(), Categories\put(), Contacts\put(), Contracts\put(), Donations\put(), ExpenseReports\put(), Invoices\put(), KnowledgeManagement\put(), Members\put(), MembersTypes\put(), Mos\put(), MyModuleApi\put(), Orders\put(), Partnerships\put(), Products\put(), Projects\put(), Proposals\put(), Receptions\put(), Shipments\put(), SupplierInvoices\put(), SupplierOrders\put(), Tasks\put(), Thirdparties\put(), Tickets\put(), Users\put(), Warehouses\put(), Recruitments\putCandidature(), Recruitments\putJobPosition(), Boms\putLine(), Contracts\putLine(), Invoices\putLine(), Orders\putLine(), Proposals\putLine(), SupplierInvoices\putLine(), Tasks\putTimeSpent(), SupplierOrders\receiveOrder(), Users\setGroup(), Orders\setinvoiced(), Proposals\setinvoiced(), Thirdparties\setThirdpartyPriceLevel(), Invoices\settodraft(), Orders\settodraft(), Proposals\settodraft(), Invoices\settopaid(), Invoices\settounpaid(), Contracts\unactivateLine(), Invoices\useCreditNote(), Invoices\useDiscount(), Contracts\validate(), Donations\validate(), Interventions\validate(), Invoices\validate(), Orders\validate(), Projects\validate(), Proposals\validate(), Receptions\validate(), Shipments\validate(), SupplierInvoices\validate(), and SupplierOrders\validate().
|
protected |
Return if a $sqlfilters parameter is valid Function no more used.
Kept for backward compatibility with old APIs of modules
string | $sqlfilters | sqlfilter string |
string | $error | Error message |
Definition at line 333 of file api.class.php.
References dolCheckFilters().
Referenced by Setup\getListOfIncoterms(), Setup\getListOfRegions(), and MultiCurrencies\index().
|
protected |
Check and convert a string depending on its type/name.
Display a short message an return a http code 200
string | $field | Field name |
mixed | $value | Value to check/clean |
Object | $object | Object |
Definition at line 85 of file api.class.php.
References sanitizeVal().
Referenced by AgendaEvents\post(), BankAccounts\post(), Contacts\post(), KnowledgeManagement\post(), MyModuleApi\post(), Partnerships\post(), SupplierInvoices\post(), SupplierOrders\post(), Thirdparties\post(), Recruitments\postCandidature(), Recruitments\postJobPosition(), AgendaEvents\put(), BankAccounts\put(), Contacts\put(), KnowledgeManagement\put(), MyModuleApi\put(), Partnerships\put(), SupplierInvoices\put(), SupplierOrders\put(), Thirdparties\put(), Recruitments\putCandidature(), and Recruitments\putJobPosition().
|
protected |
Clean sensible object datas.
Object | $object | Object to clean |
Reimplemented in AgendaEvents, BankAccounts, Boms, Categories, Contacts, Contracts, Donations, ExpenseReports, Interventions, Invoices, KnowledgeManagement, Members, MembersTypes, Mos, MultiCurrencies, MyModuleApi, Orders, Partnerships, Products, Projects, Proposals, Receptions, Recruitments, Setup, Shipments, StockMovements, SupplierInvoices, SupplierOrders, SupplierProposals, Tasks, Thirdparties, Tickets, Users, Warehouses, and Zapier.
Definition at line 132 of file api.class.php.
References _cleanObjectDatas().
Referenced by _cleanObjectDatas(), Subscriptions\get(), and Subscriptions\index().
|
protected |
Filter properties that will be returned on object.
Object | $object | Object to clean |
String | $properties | Comma separated list of properties names |
Definition at line 110 of file api.class.php.
Referenced by Products\getAttributes(), AgendaEvents\index(), BankAccounts\index(), Boms\index(), Categories\index(), Contacts\index(), Contracts\index(), Donations\index(), ExpenseReports\index(), Interventions\index(), Invoices\index(), KnowledgeManagement\index(), Members\index(), MembersTypes\index(), Mos\index(), MultiCurrencies\index(), MyModuleApi\index(), Orders\index(), Partnerships\index(), Products\index(), Projects\index(), Proposals\index(), Receptions\index(), Shipments\index(), StockMovements\index(), Subscriptions\index(), SupplierInvoices\index(), SupplierOrders\index(), SupplierProposals\index(), Tasks\index(), Thirdparties\index(), Tickets\index(), Users\index(), Warehouses\index(), Zapier\index(), Recruitments\indexJobPosition(), and Users\listGroups().
|
staticprotected |
Function to forge a SQL criteria from a Generic filter string.
Function no more used. Kept for backward compatibility with old APIs of modules
array | $matches | Array of found string by regex search. Each entry is 1 and only 1 criteria. Example: "t.ref:like:'SO-%'", "t.date_creation:<:'20160101'", "t.date_creation:<:'2016-01-01 12:30:00'", "t.nature:is:NULL", "t.field2:isnot:NULL" |
Definition at line 351 of file api.class.php.
References dolForgeCriteriaCallback().