dolibarr  7.0.0-beta
Public Member Functions | List of all members
Products Class Reference
+ Inheritance diagram for Products:
+ Collaboration diagram for Products:

Public Member Functions

 __construct ()
 Constructor.
 
 get ($id, $includestockdata=0)
 Get properties of a product object. More...
 
 index ($sortfield="t.ref", $sortorder= 'ASC', $limit=100, $page=0, $mode=0, $category=0, $sqlfilters= '')
 List products. More...
 
 post ($request_data=NULL)
 Create product object. More...
 
 put ($id, $request_data=NULL)
 Update product. More...
 
 delete ($id)
 Delete product. More...
 
 getCategories ($id, $sortfield="s.rowid", $sortorder= 'ASC', $limit=0, $page=0)
 Get categories for a product. More...
 
 getCustomerPricesPerSegment ($id)
 Get prices per segment for a product. More...
 
 getCustomerPricesPerCustomer ($id)
 Get prices per customer for a product. More...
 
 getCustomerPricesPerQuantity ($id)
 Get prices per quantity for a product. More...
 
 _cleanObjectDatas ($object)
 Clean sensible object datas. More...
 
 _validate ($data)
 Validate fields before create or update object. More...
 
- Public Member Functions inherited from DolibarrApi
 __construct ($db, $cachedir='', $refreshCache=false)
 Constructor. More...
 
 _cleanObjectDatas ($object)
 Executed method when API is called without parameter. More...
 
 _checkFilters ($sqlfilters)
 Return if a $sqlfilters parameter is valid. More...
 

Additional Inherited Members

- Static Public 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...
 

Detailed Description

Definition at line 29 of file api_products.class.php.

Member Function Documentation

Products::_cleanObjectDatas (   $object)

Clean sensible object datas.

Parameters
object$objectObject to clean
Returns
array Array of cleaned object properties

Definition at line 419 of file api_products.class.php.

Referenced by get(), and index().

Products::_validate (   $data)

Validate fields before create or update object.

Parameters
array$dataDatas to validate
Returns
array
Exceptions
RestException

Definition at line 444 of file api_products.class.php.

Referenced by post().

Products::delete (   $id)

Delete product.

Parameters
int$idProduct ID
Returns
array

Definition at line 242 of file api_products.class.php.

References DolibarrApi\_checkAccessToResource().

Products::get (   $id,
  $includestockdata = 0 
)

Get properties of a product object.

Return an array with product information. TODO implement getting a product by ref or by $ref_ext

Parameters
int$idID of product
int$includestockdataLoad also information about stock (slower)
Returns
array|mixed data without useless information
Exceptions
RestException
401
404

Definition at line 68 of file api_products.class.php.

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

Products::getCategories (   $id,
  $sortfield = "s.rowid",
  $sortorder = 'ASC',
  $limit = 0,
  $page = 0 
)

Get categories for a product.

Parameters
int$idID of product
string$sortfieldSort field
string$sortorderSort order
int$limitLimit for list
int$pagePage number
Returns
mixed

GET {id}/categories

Definition at line 277 of file api_products.class.php.

Products::getCustomerPricesPerCustomer (   $id)

Get prices per customer for a product.

Parameters
int$idID of product
Returns
mixed

GET {id}/selling_multiprices/per_customer

Definition at line 349 of file api_products.class.php.

Products::getCustomerPricesPerQuantity (   $id)

Get prices per quantity for a product.

Parameters
int$idID of product
Returns
mixed

GET {id}/selling_multiprices/per_quantity

Definition at line 384 of file api_products.class.php.

Products::getCustomerPricesPerSegment (   $id)

Get prices per segment for a product.

Parameters
int$idID of product
Returns
mixed

GET {id}/selling_multiprices/per_segment

Definition at line 307 of file api_products.class.php.

Products::index (   $sortfield = "t.ref",
  $sortorder = 'ASC',
  $limit = 100,
  $page = 0,
  $mode = 0,
  $category = 0,
  $sqlfilters = '' 
)

List products.

Get a list of products

Parameters
string$sortfieldSort field
string$sortorderSort order
int$limitLimit for list
int$pagePage number
int$modeUse this param to filter list (0 for all, 1 for only product, 2 for only service)
int$categoryUse this param to filter list by category
string$sqlfiltersOther criteria to filter answers separated by a comma. Syntax example "(t.tobuy:=:0) and (t.tosell:=:1)"
Returns
array Array of product objects

Definition at line 105 of file api_products.class.php.

References DolibarrApi\_checkFilters(), and _cleanObjectDatas().

Products::post (   $request_data = NULL)

Create product object.

Parameters
array$request_dataRequest data
Returns
int ID of product

Definition at line 181 of file api_products.class.php.

References _validate().

Products::put (   $id,
  $request_data = NULL 
)

Update product.

Parameters
int$idId of product to update
array$request_dataDatas
Returns
int
Exceptions
RestException
401
404

Definition at line 210 of file api_products.class.php.

References DolibarrApi\_checkAccessToResource().


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