Correction bug quand aucun montants indiqués

This commit is contained in:
Rodolphe Quiedeville 2005-07-30 19:42:37 +00:00
parent ef7eec942d
commit 81ac8b1a78

View File

@ -56,6 +56,7 @@ if ($_POST["action"] == 'add_paiement')
$_POST["reyear"])); $_POST["reyear"]));
$paiement_id = 0; $paiement_id = 0;
$total = 0;
$amounts = array(); $amounts = array();
foreach ($_POST as $key => $value) foreach ($_POST as $key => $value)
{ {
@ -64,9 +65,13 @@ if ($_POST["action"] == 'add_paiement')
$other_facid = substr($key,7); $other_facid = substr($key,7);
$amounts[$other_facid] = $_POST[$key]; $amounts[$other_facid] = $_POST[$key];
$total = $total + $amounts[$other_facid];
} }
} }
if ($total > 0)
{
$db->begin(); $db->begin();
// Creation de la ligne paiement // Creation de la ligne paiement
@ -148,13 +153,9 @@ if ($_POST["action"] == 'add_paiement')
if ($error == 0) if ($error == 0)
{ {
$loc = DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$paiement_id; $loc = DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$paiement_id;
$db->commit(); $db->commit();
Header("Location: $loc"); Header("Location: $loc");
} }
else else
{ {
@ -162,7 +163,11 @@ if ($_POST["action"] == 'add_paiement')
$db->rollback(); $db->rollback();
$fiche_erreur_message = $langs->trans("ErrorUnknown"); $fiche_erreur_message = $langs->trans("ErrorUnknown");
} }
}
else
{
$fiche_erreur_message = '<div class="error">Aucun montants indiqués</div>';
}
} }
else else
{ {