diff --git a/include/form_input.php b/include/form_input.php
index d4da11ea6..269e2cedc 100644
--- a/include/form_input.php
+++ b/include/form_input.php
@@ -1099,7 +1099,7 @@ function RecordAchat($p_cn,$p_array,$p_user,$p_jrn)
* -
* return: string with the form
*/
-function FormFin($p_cn,$p_jrn,$p_user,$p_submit,$p_array=null,$view_only=true,$p_item=4)
+function FormFin($p_cn,$p_jrn,$p_user,$p_submit,$p_array=null,$view_only=true,$p_item=4,$p_save=false)
{
include_once("poste.php");
if ( $p_array != null ) {
@@ -1237,7 +1237,10 @@ function FormFin($p_cn,$p_jrn,$p_user,$p_submit,$p_array=null,$view_only=true,$p
${"e_concerned".$i}=(isset(${"e_concerned".$i}))?${"e_concerned".$i}:"";
$r.=InputType("","js_concerned","e_concerned".$i,${"e_concerned".$i},$view_only);
$r.='';
- if ( $view_only == true ) $new_solde+=$tiers_amount;
+ // if not recorded the new amount must be recalculate
+ // if recorded the old amount is recalculated
+ if ( $view_only == true)
+ $new_solde=($p_save==false)?$new_solde+$tiers_amount:$new_solde-$tiers_amount;
}
$r.="";
@@ -1248,8 +1251,16 @@ $r.="";
// if view_only is true
//Put the new saldo here (old saldo - operation)
if ( $view_only==true) {
- $r.=" Ancien Solde = ".$solde."
";
- $r.=" Nouveau Solde = ".$new_solde."
";
+ // if not recorded the new amount must be recalculate
+ if ( $p_save == false) {
+ $r.=" Ancien Solde = ".$solde."
";
+ $r.=" Nouveau Solde = ".$new_solde."
";
+ }
+ // if recorded the old amount is recalculated
+ if ($p_save == true ) {
+ $r.=" Ancien Solde = ".$new_solde."
";
+ $r.=" Nouveau Solde = ".$solde."
";
+ }
}
return $r;
diff --git a/include/user_action_fin.php b/include/user_action_fin.php
index aa7003b6b..d6050b6ef 100644
--- a/include/user_action_fin.php
+++ b/include/user_action_fin.php
@@ -111,7 +111,7 @@ if ( $action == 'new' ) {
// submit button in the form
$submit='