verify vat change to update multiprice

This commit is contained in:
atm-greg 2021-06-08 11:39:04 +02:00
parent d1d305e470
commit 37433ffee7

View File

@ -349,6 +349,7 @@ if (empty($reshook))
$newprice = price2num($newprice, 'MU'); $newprice = price2num($newprice, 'MU');
$newprice_min = price2num($val['price_min'], 'MU'); $newprice_min = price2num($val['price_min'], 'MU');
$newvattx = price2num($val['vat_tx'], 'MU');
if (!empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE) && $newprice_min < $maxpricesupplier) { if (!empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE) && $newprice_min < $maxpricesupplier) {
setEventMessages($langs->trans("MinimumPriceLimit", price($maxpricesupplier, 0, '', 1, - 1, - 1, 'auto')), null, 'errors'); setEventMessages($langs->trans("MinimumPriceLimit", price($maxpricesupplier, 0, '', 1, - 1, - 1, 'auto')), null, 'errors');
@ -356,11 +357,10 @@ if (empty($reshook))
break; break;
} }
if ($object->multiprices[$key] != $newprice || $object->multiprices_min[$key] != $newprice_min || $object->multiprices_base_type[$key] != $val['price_base_type']) if ($object->multiprices[$key] != $newprice || $object->multiprices_min[$key] != $newprice_min || $object->multiprices_base_type[$key] != $val['price_base_type'] || $object->multiprices_tva_tx[$key] != $newvattx)
$res = $object->updatePrice($newprice, $val['price_base_type'], $user, $val['vat_tx'], $newprice_min, $key, $val['npr'], $psq, 0, $val['localtaxes_array'], $val['default_vat_code']); $res = $object->updatePrice($newprice, $val['price_base_type'], $user, $val['vat_tx'], $newprice_min, $key, $val['npr'], $psq, 0, $val['localtaxes_array'], $val['default_vat_code']);
else $res = 0; else $res = 0;
if ($res < 0) { if ($res < 0) {
$error++; $error++;
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');