Merge pull request #11807 from bafbes/abb90174

fix: convert posted price formatted values to numeric
This commit is contained in:
Laurent Destailleur 2019-09-03 12:55:34 +02:00 committed by GitHub
commit b7232fde80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -196,7 +196,7 @@ if (empty($reshook))
$langs->load("errors");
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Supplier")), null, 'errors');
}
if ($_POST["price"] < 0 || $_POST["price"] == '')
if (price2num($_POST["price"]) < 0 || $_POST["price"] == '')
{
if ($price_expression === '') // Return error of missing price only if price_expression not set
{
@ -215,12 +215,12 @@ if (empty($reshook))
$langs->load("errors");
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Currency")), null, 'errors');
}
if ($_POST["multicurrency_tx"] <= 0 || $_POST["multicurrency_tx"] == '') {
if (price2num($_POST["multicurrency_tx"]) <= 0 || $_POST["multicurrency_tx"] == '') {
$error++;
$langs->load("errors");
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("CurrencyRate")), null, 'errors');
}
if ($_POST["multicurrency_price"] < 0 || $_POST["multicurrency_price"] == '') {
if (price2num($_POST["multicurrency_price"]) < 0 || $_POST["multicurrency_price"] == '') {
$error++;
$langs->load("errors");
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("PriceCurrency")), null, 'errors');