Amélioration contrôles saisie facture

This commit is contained in:
Jean-Christophe Engel 2025-02-26 11:02:45 +01:00
parent 6e2ee31670
commit f63f3b6ecd
2 changed files with 52 additions and 39 deletions

View file

@ -144,10 +144,13 @@ class Facture
unset($datas[$k]['prix']);
continue;
}
elseif (empty($r['prix']))
elseif (! is_numeric($r['prix']) && empty($r['prix']))
{
$datas[$k]['prix'] = 0;
}
elseif (empty($r['designation'])) {
throw new UserException("Une au moins des désignations est absente.");
}
if (!is_int($r['prix']))
{
@ -157,7 +160,7 @@ class Facture
$total += $r['prix'];
}
if($fac && !$total)
if ($fac && count($datas['contenu']) == 0)
{
throw new UserException("Toutes les désignations/prix sont vides.");
}