diff --git a/include/class/acc_ledger_fin.class.php b/include/class/acc_ledger_fin.class.php index de48fcb16..1aea14b4b 100644 --- a/include/class/acc_ledger_fin.class.php +++ b/include/class/acc_ledger_fin.class.php @@ -218,16 +218,23 @@ class Acc_Ledger_Fin extends Acc_Ledger throw new Exception('Il n\'y a aucune opération', 12); /* Check if the last_saldo and first_saldo are correct */ - if (strlen(trim($last_sold)) != 0 && isNumber($last_sold) && - strlen(trim($first_sold)) != 0 && isNumber($first_sold)) + if (strlen(trim($last_sold)) != 0 + && isNumber($last_sold) + && strlen(trim($first_sold)) != 0 + && isNumber($first_sold) + ) { $diff = $last_sold - $first_sold; $diff = round($diff, 2) - round($tot_amount, 2); - if ($first_sold != 0 && $last_sold != 0) + $calc=bcadd($first_sold,$tot_amount,4); + if ($first_sold != 0 || $last_sold != 0) { - if ($diff != 0) - throw new Exception('Le montant de l\'extrait est incorrect' . - $tot_amount . ' extrait ' . $diff, 13); + if ($diff != 0) { + throw new Exception(sprintf( _('Le montant de l\'extrait [%s] est incorrect,'. + " solde calculé [%s] , différence de [%s]") , + $last_sold,$calc,$diff),13); + + } } } } diff --git a/include/compta_fin.inc.php b/include/compta_fin.inc.php index 5a60d628a..c9730f8e1 100644 --- a/include/compta_fin.inc.php +++ b/include/compta_fin.inc.php @@ -28,10 +28,10 @@ require_once NOALYSS_INCLUDE.'/lib/ipopup.class.php'; global $g_user,$g_parameter; $gDossier=dossier::id(); - +$http=new HttpInput(); $cn=Dossier::connect(); -$menu_action="?ledger_type=fin&ac=".$_REQUEST['ac']."&".dossier::get(); +$menu_action="?ledger_type=fin&ac=".$http->request('ac')."&".dossier::get(); $Ledger=new Acc_Ledger_Fin($cn,0); @@ -40,7 +40,9 @@ $Ledger=new Acc_Ledger_Fin($cn,0); //-------------------------------------------------------------------------------- if ( isset($_REQUEST['p_jrn'])) - $Ledger->id=$_REQUEST['p_jrn']; +{ + $Ledger->id=$http->request('p_jrn',"number"); +} else { $def_ledger=$Ledger->get_first('fin'); @@ -137,7 +139,7 @@ if ( $p_msg !="" ) echo ''.$p_msg.''; echo '