diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index f503ea8afe643e79fe08591bae3c32992126f706..d3fa93e170210644a5695464c08057e7381308f3 100755 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -244,6 +244,6 @@ MinimumPriceLimit=Minimum price can't be lower that %s MinimumRecommendedPrice=Minimum recommended price is : %s PriceExpressionEditor=Price expression editor PriceExpressionSelected=Selected price expression -PriceExpressionEditorHelp="price = 2 + 2" or "2 + 2" for setting the price<br>ExtraFields are variables like "#options_myextrafieldkey# * 2"<br>There are special variables like #quantity# and #tva_tx# +PriceExpressionEditorHelp="price = 2 + 2" or "2 + 2" for setting the price<br>ExtraFields are variables like "#options_myextrafieldkey# * 2"<br>There are special variables like #quantity# and #tva_tx#<br>Use ; to separate expressions PriceMode=Price mode PriceNumeric=Number diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index bf5a268f22a600f40090b61995fe3cb6c61498c7..b0d07587996988f1d48f81c681583f4c803b75de 100755 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -107,6 +107,7 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel")) $npr = preg_match('/\*/', $_POST['tva_tx']) ? 1 : 0 ; $tva_tx = str_replace('*','', GETPOST('tva_tx','alpha')); $tva_tx = price2num($tva_tx); + $price_expression = GETPOST('eid', 'int') == 0 ? 'NULL' : GETPOST('eid', 'int'); //Discard expression if not in expression mode if ($tva_tx == '') { @@ -130,8 +131,14 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel")) } if ($_POST["price"] < 0 || $_POST["price"] == '') { - $error++; - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Price")), 'errors'); + if ($price_expression == 'NULL') { //This is not because of using expression instead of numeric price + $error++; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Price")), 'errors'); + } + else + { + $_POST["price"] = 0; + } } $product = new ProductFournisseur($db); @@ -180,7 +187,6 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel")) } else { - $price_expression = GETPOST('eid', 'int') == 0 ? 'NULL' : GETPOST('eid', 'int'); //Discard expression if not in expression mode if ($price_expression != 'NULL') { //Check the expression validity by parsing it $priceparser = new PriceParser($db);