Merge pull request #7917 from IonAgorria/fix-7914

FIX #7914: More informative error message in dynamics prices
This commit is contained in:
Laurent Destailleur 2017-12-08 10:41:06 +01:00 committed by GitHub
commit f0bdf3a537
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -156,6 +156,7 @@ ErrorPriceExpression20=Empty expression
ErrorPriceExpression21=Empty result '%s'
ErrorPriceExpression22=Negative result '%s'
ErrorPriceExpression23=Unknown or non set variable '%s' in %s
ErrorPriceExpression24=Variable '%s' exists but has no value
ErrorPriceExpressionInternal=Internal error '%s'
ErrorPriceExpressionUnknown=Unknown error '%s'
ErrorSrcAndTargetWarehouseMustDiffers=Source and target warehouses must differs

View File

@ -82,6 +82,7 @@ class PriceParser
17, undefined variable '%s'
21, empty result '%s'
22, negative result '%s'
24, variable '%s' exists but has no value
-2 Args
6, wrong number of arguments (%s given, %s expected)
@ -192,9 +193,12 @@ class PriceParser
$expression = str_replace("\n", $this->separator_chr, $expression);
foreach ($values as $key => $value)
{
if ($value === null) $value = "NULL";
$expression = str_replace($this->special_chr.$key.$this->special_chr, strval($value), $expression);
}
if ($value === null && strpos($expression, $key) !== false) {
$this->error_parser = array(24, $key);
return -7;
}
$expression = str_replace($this->special_chr.$key.$this->special_chr, strval($value), $expression);
}
//Check if there is unfilled variable
if (strpos($expression, $this->special_chr) !== false)