|
dolibarr
16.0.1
|
Class for API REST v1. More...
Inheritance diagram for DolibarrApi:Public Member Functions | |
| __construct ($db, $cachedir= '', $refreshCache=false) | |
| Constructor. More... | |
Protected Member Functions | |
| _checkValForAPI ($field, $value, $object) | |
| Check and convert a string depending on its type/name. More... | |
| _cleanObjectDatas ($object) | |
| Clean sensible object datas. More... | |
| _checkFilters ($sqlfilters, &$error= '') | |
| Return if a $sqlfilters parameter is valid. More... | |
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. More... | |
| static | _forge_criteria_callback ($matches) |
| Function to forge a SQL criteria from a Generic filter string. More... | |
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 50 of file api.class.php.
References db.
|
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) |
| RestException |
Definition at line 283 of file api.class.php.
References checkUserAccessToObject().
Referenced by Orders\_fetch(), Proposals\_fetch(), Invoices\_fetch(), Thirdparties\_fetch(), Products\_fetch(), Invoices\_fetchTemplateInvoice(), Contracts\activateLine(), Contacts\addCategory(), Thirdparties\addCategory(), Invoices\addContact(), SupplierInvoices\addPayment(), Invoices\addPayment(), Invoices\addPaymentDistributed(), Products\addPurchasePrice(), Products\addSubproducts(), Thirdparties\addSupplierCategory(), Tasks\addTimeSpent(), SupplierOrders\approve(), Contracts\close(), Receptions\close(), Shipments\close(), Orders\close(), Proposals\close(), Interventions\closeFichinter(), Contacts\createUser(), MembersTypes\delete(), Warehouses\delete(), Donations\delete(), Mos\delete(), Boms\delete(), Categories\delete(), MyModuleApi\delete(), SupplierInvoices\delete(), AgendaEvents\delete(), SupplierOrders\delete(), Interventions\delete(), KnowledgeManagement\delete(), ZapierApi\delete(), Contacts\delete(), Members\delete(), Tickets\delete(), Products\delete(), ExpenseReports\delete(), Receptions\delete(), Shipments\delete(), Tasks\delete(), Projects\delete(), Thirdparties\delete(), Contracts\delete(), Users\delete(), Invoices\delete(), Orders\delete(), Proposals\delete(), Recruitment\deleteCandidature(), Contacts\deleteCategory(), Thirdparties\deleteCategory(), Invoices\deleteContact(), Orders\deleteContact(), Proposals\deleteContact(), Recruitment\deleteJobPosition(), Receptions\deleteLine(), Shipments\deleteLine(), Contracts\deleteLine(), Orders\deleteLine(), Proposals\deleteLine(), Invoices\deleteLine(), SupplierInvoices\deleteLine(), Products\deletePurchasePrice(), Thirdparties\deleteSupplierCategory(), Products\delSubproducts(), MembersTypes\get(), Warehouses\get(), Members\get(), Donations\get(), SupplierOrders\get(), Mos\get(), AgendaEvents\get(), Boms\get(), Supplierproposals\get(), Receptions\get(), Shipments\get(), ExpenseReports\get(), SupplierInvoices\get(), Projects\get(), Contracts\get(), Tasks\get(), MyModuleApi\get(), KnowledgeManagement\get(), Contacts\get(), ZapierApi\get(), Interventions\get(), Categories\get(), Users\get(), Contacts\getByEmail(), Users\getByEmail(), Users\getByLogin(), Members\getByThirdparty(), Members\getByThirdpartyBarcode(), Members\getByThirdpartyEmail(), Recruitment\getCandidature(), Tickets\getCommon(), Thirdparties\getCompanyBankAccount(), Orders\getContacts(), Invoices\getDiscount(), Thirdparties\getFixedAmountDiscounts(), Users\getInfo(), Thirdparties\getInvoicesQualifiedForCreditNote(), Thirdparties\getInvoicesQualifiedForReplacement(), Recruitment\getJobPosition(), Contracts\getLines(), Projects\getLines(), Proposals\getLines(), Orders\getLines(), Invoices\getLines(), SupplierInvoices\getLines(), Categories\getObjects(), Thirdparties\getOutStandingInvoices(), Thirdparties\getOutStandingOrder(), Thirdparties\getOutStandingProposals(), SupplierInvoices\getPayments(), Invoices\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(), Interventions\postLine(), Contracts\postLine(), Orders\postLine(), Proposals\postLine(), SupplierInvoices\postLine(), Invoices\postLine(), Proposals\postLines(), MembersTypes\put(), Warehouses\put(), Donations\put(), Mos\put(), Boms\put(), Categories\put(), MyModuleApi\put(), AgendaEvents\put(), SupplierInvoices\put(), SupplierOrders\put(), KnowledgeManagement\put(), Thirdparties\put(), Contacts\put(), Members\put(), Products\put(), Users\put(), Tickets\put(), ExpenseReports\put(), Receptions\put(), Shipments\put(), Tasks\put(), Projects\put(), Contracts\put(), Invoices\put(), Orders\put(), Proposals\put(), Recruitment\putCandidature(), Recruitment\putJobPosition(), Contracts\putLine(), Orders\putLine(), Invoices\putLine(), Proposals\putLine(), SupplierInvoices\putLine(), SupplierOrders\receiveOrder(), Users\setGroup(), Orders\setinvoiced(), Proposals\setinvoiced(), Thirdparties\setThirdpartyPriceLevel(), Proposals\settodraft(), Invoices\settodraft(), Orders\settodraft(), Invoices\settopaid(), Invoices\settounpaid(), Contracts\unactivateLine(), Invoices\useCreditNote(), Invoices\useDiscount(), Donations\validate(), SupplierInvoices\validate(), SupplierOrders\validate(), Interventions\validate(), Receptions\validate(), Shipments\validate(), Projects\validate(), Contracts\validate(), Orders\validate(), Proposals\validate(), and Invoices\validate().
|
protected |
Return if a $sqlfilters parameter is valid.
| string | $sqlfilters | sqlfilter string |
| string | $error | Error message |
Definition at line 310 of file api.class.php.
References dolCheckFilters().
Referenced by Products\getAttributes(), Setup\getAvailability(), Proposals\getLines(), BankAccounts\getLines(), Setup\getListOfCivilities(), Setup\getListOfContactTypes(), Setup\getListOfCountries(), Setup\getListOfCurrencies(), Setup\getListOfEventTypes(), Setup\getListOfExpenseReportsTypes(), Setup\getListOfExtrafields(), Setup\getListOfLegalForm(), Setup\getListOfMeasuringUnits(), Setup\getListOfsocialNetworks(), Setup\getListOfStaff(), Setup\getListOfStates(), Setup\getListOfTowns(), Setup\getOrderingMethods(), Setup\getOrderingOrigins(), Setup\getPaymentTerms(), Setup\getPaymentTypes(), Setup\getShippingModes(), Products\getSupplierProducts(), Setup\getTicketsCategories(), Setup\getTicketsSeverities(), Setup\getTicketsTypes(), BankAccounts\index(), Users\index(), Subscriptions\index(), MembersTypes\index(), StockMovements\index(), Warehouses\index(), Mos\index(), Supplierproposals\index(), ExpenseReports\index(), Boms\index(), SupplierOrders\index(), SupplierInvoices\index(), Donations\index(), Projects\index(), Receptions\index(), Shipments\index(), Contracts\index(), MyModuleApi\index(), AgendaEvents\index(), Tasks\index(), Interventions\index(), Thirdparties\index(), Categories\index(), KnowledgeManagement\index(), ZapierApi\index(), Proposals\index(), Orders\index(), Contacts\index(), Products\index(), Invoices\index(), Members\index(), Tickets\index(), Recruitment\indexCandidature(), Recruitment\indexJobPosition(), and Users\listGroups().
|
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 |
| string | $value | Value to check/clean |
| stdClass | $object | Object |
Definition at line 86 of file api.class.php.
References sanitizeVal().
Referenced by BankAccounts\post(), MyModuleApi\post(), AgendaEvents\post(), KnowledgeManagement\post(), Recruitment\postCandidature(), Recruitment\postJobPosition(), MyModuleApi\put(), AgendaEvents\put(), KnowledgeManagement\put(), BankAccounts\put(), Recruitment\putCandidature(), and Recruitment\putJobPosition().
|
protected |
Clean sensible object datas.
| Object | $object | Object to clean |
Definition at line 104 of file api.class.php.
Referenced by Subscriptions\get(), and Subscriptions\index().
|
staticprotected |
Function to forge a SQL criteria from a Generic filter string.
| 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 327 of file api.class.php.
References dolForgeCriteriaCallback().