dolibarr  19.0.0-dev
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

◆ __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 125 of file price_parser.class.php.

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

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

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

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

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

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

◆ 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: