dolibarr 21.0.0-alpha
PriceParser Class Reference

Class to parse product price expressions. More...

Public Member Functions

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

Detailed Description

Class to parse product price expressions.

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

Constructor & Destructor Documentation

◆ __construct()

PriceParser::__construct ( $db)

Constructor.

Parameters
DoliDB$dbDatabase handler

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

Member Function Documentation

◆ parseExpression()

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 124 of file price_parser.class.php.

References dol_now().

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

◆ parseProduct()

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 additional values for expression
Returns
int > 0 if OK, < 1 if KO

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

References parseExpression().

◆ parseProductSupplier()

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 additional values for expression
Returns
int > 0 if OK, < 1 if KO

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

References parseExpression().

◆ testExpression()

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 additional values for expression
Returns
int > 0 if OK, < 1 if KO

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

References parseExpression().

◆ translatedError()

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: