[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 01/04: Bug : Bank , no warning if balance inc
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 01/04: Bug : Bank , no warning if balance incorrect when the first amount is 0 Protect $_REQUEST , do no replace the first amount when it is corrected |
Date: |
Tue, 9 Mar 2021 16:47:51 -0500 (EST) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit aab7567c6905198b4da2fcec5b17ed60aa690ae2
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Wed Feb 24 13:37:19 2021 +0100
Bug : Bank , no warning if balance incorrect when the first amount is 0
Protect $_REQUEST , do no replace the first amount when it is corrected
---
include/class/acc_ledger_fin.class.php | 19 +++++++++++++------
include/compta_fin.inc.php | 20 ++++++++++++--------
2 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/include/class/acc_ledger_fin.class.php
b/include/class/acc_ledger_fin.class.php
index de48fcb..1aea14b 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 5a60d62..c9730f8 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 '<span
class="warning">'.$p_msg.'</span>';
echo '<form class="print" name="form_detail" enctype="multipart/form-data"
class="print" METHOD="POST">';
echo HtmlInput::hidden('ledger_type','fin');
-echo HtmlInput::hidden('ac',$_REQUEST['ac']);
+echo HtmlInput::hidden('ac',$http->request("ac"));
$array=( isset($correct))?$_POST:null;
// show select ledger
@@ -149,13 +151,15 @@ try
echo HtmlInput::submit('save',_('Sauve'));
echo HtmlInput::reset(_('Effacer'));
+ $script="update_name();";
if ( ! isset($_REQUEST['e_date'])&& $g_parameter->MY_DATE_SUGGEST=='Y')
{
- echo create_script(" get_last_date();ajax_saldo('first_sold');");
- }else {
- echo create_script(" ajax_saldo('first_sold');");
+ $script.=" get_last_date();";
+ }
+ if ( ! isset ($_REQUEST['first_sold']) ) {
+ $script.=" ajax_saldo('first_sold');";
}
- echo create_script(" update_name()");
+ echo create_script($script);
} catch (Exception $ex) {
echo $ex->getMessage();
}
- [Noalyss-commit] [noalyss] branch master updated (faaeb16 -> f92a724), Dany De Bontridder, 2021/03/09
- [Noalyss-commit] [noalyss] 03/04: Add a new parameter to title_box to enlarge the div, by default for all input dialog box of ManageTable, Dany De Bontridder, 2021/03/09
- [Noalyss-commit] [noalyss] 02/04: Bug limit card, Dany De Bontridder, 2021/03/09
- [Noalyss-commit] [noalyss] 04/04: Fix special char with input-select, Dany De Bontridder, 2021/03/09
- [Noalyss-commit] [noalyss] 01/04: Bug : Bank , no warning if balance incorrect when the first amount is 0 Protect $_REQUEST , do no replace the first amount when it is corrected,
Dany De Bontridder <=