From d9e59b0c03aa4325cf800b54112e9cb47d3aeb37 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 17 Jul 2010 12:14:02 +0000 Subject: [PATCH] Fix: Value of amount must not be modified during confirm process. --- htdocs/compta/paiement.php | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 8390e21644a..f84f698eac2 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -50,7 +50,7 @@ $addwarning=0; /* * Action add_paiement et confirm_paiement */ -if ($_POST['action'] == 'add_paiement' || $_POST['action'] == 'confirm_paiement') +if ($_POST['action'] == 'add_paiement' || ($_POST['action'] == 'confirm_paiement' && $_POST['confirm']=='yes')) { $error = 0; @@ -81,7 +81,7 @@ if ($_POST['action'] == 'add_paiement' || $_POST['action'] == 'confirm_paiement' } } - // Effectue les verifications des parametres + // Check parameters if ($_POST['paiementid'] <= 0) { $fiche_erreur_message = '
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('PaymentMode')).'
'; @@ -400,13 +400,21 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'confirm_paiement' || $_P if ($deposits) print '+'.price($deposits); print ''; - // Reste a payer + // Remain to pay print ''.price(price2num($objp->total_ttc - $paiement - $creditnotes - $deposits,'MT')).''; - // Montant + // Amount print ''; $namef = 'amount_'.$objp->facid; - print ''; + if ($_POST["action"] != 'add_paiement') + { + print ''; + } + else + { + print ''; + print ''; + } print ""; // Warning @@ -469,12 +477,14 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'confirm_paiement' || $_P print $fiche_erreur_message; } - // Formulaire confirmation + // Form to confirm payment if ($_POST["action"] == 'add_paiement') { + $preselectedchoice=$addwarning?'no':'yes'; + print '
'; $text=$langs->trans('ConfirmCustomerPayment',$totalpaiement,$langs->trans("Currency".$conf->monnaie)); - $html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$facture->id.'&socid='.$facture->socid.'&type='.$facture->type,$langs->trans('ReceivedCustomersPayments'),$text,'confirm_paiement',$formquestion); + $html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$facture->id.'&socid='.$facture->socid.'&type='.$facture->type,$langs->trans('ReceivedCustomersPayments'),$text,'confirm_paiement',$formquestion,$preselectedchoice); } print "\n";