dolibarr  7.0.0-beta
Public Member Functions | List of all members
PriceParser Class Reference

Class to parse product price expressions. More...

Public Member Functions

 __construct ($db)
 Constructor. More...
 
 translatedError ()
 Returns translated error. More...
 
 parseExpression ($product, $expression, $values)
 Calculates price based on expression. More...
 
 parseProduct ($product, $extra_values=array())
 Calculates product price based on product id and associated expression. More...
 
 parseProductSupplier ($product_supplier, $extra_values=array())
 Calculates supplier product price based on product supplier price and associated expression. More...
 
 testExpression ($product_id, $expression, $extra_values=array())
 Tests string expression for validity. More...
 

Detailed Description

Class to parse product price expressions.

Definition at line 33 of file price_parser.class.php.

Constructor & Destructor Documentation

PriceParser::__construct (   $db)

Constructor.

Parameters
DoliDB$dbDatabase handler

Definition at line 52 of file price_parser.class.php.

Member Function Documentation

PriceParser::parseExpression (   $product,
  $expression,
  $values 
)

Calculates price based on expression.

Parameters
Product$productThe Product object to get information
String$expressionThe expression to parse
array$valuesStrings to replaces
Returns
int > 0 if OK, < 1 if KO

Definition at line 133 of file price_parser.class.php.

References dol_now().

Referenced by parseProduct(), parseProductSupplier(), and testExpression().

PriceParser::parseProduct (   $product,
  $extra_values = array() 
)

Calculates product price based on product id and associated expression.

Parameters
Product$productThe Product object to get information
array$extra_valuesAny aditional values for expression
Returns
int > 0 if OK, < 1 if KO

Definition at line 252 of file price_parser.class.php.

References parseExpression().

PriceParser::parseProductSupplier (   $product_supplier,
  $extra_values = array() 
)

Calculates supplier product price based on product supplier price and associated expression.

Parameters
ProductFournisseur$product_supplierThe Product supplier object to get information
array$extra_valuesAny aditional values for expression
Returns
int > 0 if OK, < 1 if KO

Definition at line 288 of file price_parser.class.php.

References parseExpression().

PriceParser::testExpression (   $product_id,
  $expression,
  $extra_values = array() 
)

Tests string expression for validity.

Parameters
int$product_idThe Product id to get information
string$expressionThe expression to parse
array$extra_valuesAny aditional values for expression
Returns
int > 0 if OK, < 1 if KO

Definition at line 320 of file price_parser.class.php.

References parseExpression().

PriceParser::translatedError ( )

Returns translated error.

Returns
string Translated error

Definition at line 62 of file price_parser.class.php.


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