fix: allow saving list-price's price seuil if seuil is unset or 0

This commit is contained in:
Valentin Lab
2025-10-15 12:22:36 +02:00
parent 7e93219774
commit 9ce62e82e5

View File

@@ -46,12 +46,23 @@ class PriceListValues
{
foreach ($values as $value) {
$value['price_list_id'] = $price_list_id;
if ($value['price']) {
if (self::hasPrice($value)) {
self::store($value);
}
}
}
protected static function hasPrice($value): bool
{
if (! array_key_exists('price', $value)) {
return false;
}
$price = $value['price'];
return $price !== null && $price !== '';
}
public static function getModel()
{
return PriceListValue::query();