Correction erreur si pas de prix saisi

This commit is contained in:
Jean-Christophe Engel 2024-03-29 11:57:36 +01:00
parent b0a44b85c6
commit 1d4f17ead6
1 changed files with 103 additions and 99 deletions

View File

@ -74,6 +74,10 @@ $form->runIf(f('save') && !$form->hasErrors(),
{
foreach(f('designation') as $k=>$value)
{
if ($value != '' && f('prix')[$k] == null) {
throw new UserException('Il manque le prix sur la ligne '. $k+1 . ' !!');
}
$data['contenu'][$k]['designation'] = $value;
$data['contenu'][$k]['prix'] = Utils::moneyToInteger(f('prix')[$k]);
$data['toto'] += Utils::moneyToInteger(f('prix')[$k]);