noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 13/33: Compute.php it happens that the argume


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 13/33: Compute.php it happens that the argument are not numeric
Date: Thu, 11 Nov 2021 06:02:46 -0500 (EST)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 9556840daeac1a9a1d2f321093aec513b54e095b
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Sat Oct 2 16:49:16 2021 +0200

    Compute.php it happens that the argument are not numeric
---
 html/compute.php | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/html/compute.php b/html/compute.php
index f6f0880..c75b708 100644
--- a/html/compute.php
+++ b/html/compute.php
@@ -48,6 +48,10 @@ foreach (array('t','c','p','q','n','gDossier') as $a)
     }
 
 }
+// sometime number uses coma instead of dot for dec
+$p=str_replace(",",".",$p);
+$q=str_replace(",",".",$q);
+
 $cn=Dossier::connect();
 $User=new User($cn);
 $User->Check();
@@ -69,7 +73,11 @@ if ( $t != -1 && isNumber($t) == 1 )
 
 $total=new Acc_Compute();
 bcscale(4);
-$amount=round(bcmul($p,$q),2);
+if ( isNUmber($p) && isNumber($q)) {
+    $amount=round(bcmul($p,$q,4),2);
+} else {
+    $amount = 0;
+}
 $total->set_parameter('amount',$amount);
 if ( $t != -1 && isNumber($t) == 1 )
 {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]