noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] branch devel updated: Improve Manage_Table_SQ


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] branch devel updated: Improve Manage_Table_SQL for numeric input
Date: Mon, 06 Feb 2023 13:19:53 -0500

This is an automated email from the git hooks/post-receive script.

sparkyx pushed a commit to branch devel
in repository noalyss.

The following commit(s) were added to refs/heads/devel by this push:
     new a3238a22f Improve Manage_Table_SQL for numeric input
a3238a22f is described below

commit a3238a22f99b07d908b544543205fb77fb568fda
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Mon Feb 6 19:19:41 2023 +0100

    Improve Manage_Table_SQL for numeric input
---
 include/lib/manage_table_sql.class.php | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/include/lib/manage_table_sql.class.php 
b/include/lib/manage_table_sql.class.php
index 8e405ef64..75d82beb3 100644
--- a/include/lib/manage_table_sql.class.php
+++ b/include/lib/manage_table_sql.class.php
@@ -443,12 +443,12 @@ function check()
             throw new Exception("invalid key $p_key");
 
         if (!in_array($p_value,
-                        array("text", "numeric", "date", "select", 
"timestamp","custom")))
+                        array("text", "numeric", "numeric4","numeric6","date", 
"select", "timestamp","custom")))
             throw new Exception("invalid type $p_value");
 
         $this->a_type[$p_key]=$p_value;
         $this->a_select[$p_key]=$p_array;
-        if ( $p_value == "numeric" && $this->a_col_option[$p_key]=="") {
+        if ( in_array($p_value ,array("numeric","numeric4","numeric6")) && 
$this->a_col_option[$p_key]=="") {
             $this->a_col_option[$p_key]=' class="num" ';
         }
          
@@ -1027,7 +1027,9 @@ function check()
                 if (  $this->get_col_type($v) == 'text') {
                     echo td($p_row[$v],sprintf(' sorttable_customkey="X%s" 
',$p_row[$v]));
                 } elseif ( $this->get_col_type($v) == 'numeric') {
-                    echo td($p_row[$v],$this->a_col_option[$v],$p_row[$v]);
+                    echo td(nbm($p_row[$v],2),$this->a_col_option[$v]);
+                } elseif ( $this->get_col_type($v) == 'numeric4') {
+                    echo td(nbm($p_row[$v],4),$this->a_col_option[$v]);
                 }  elseif ($this->get_col_type($v)=="custom") {
                     // For custom col
                     echo $this->display_row_custom($v,$p_row[$v],$pk_id);
@@ -1071,6 +1073,12 @@ function check()
                 } elseif ($this->get_col_type($v)=="custom") {
                     // For custom col
                     echo $this->display_row_custom($v,$p_row[$v],$pk_id);
+                } elseif ( $this->get_col_type($v) == 'numeric') {
+                    echo td(nbm($p_row[$v],2),$this->a_col_option[$v]);
+                } elseif ( $this->get_col_type($v) == 'numeric4') {
+                    echo td(nbm($p_row[$v],4),$this->a_col_option[$v]);
+                }elseif ( $this->get_col_type($v) == 'numeric6') {
+                    echo td(nbm($p_row[$v],6),$this->a_col_option[$v]);
                 }
                 else {
                     echo td($p_row[$v],  $this->a_col_option[$v]);
@@ -1177,7 +1185,8 @@ function check()
                     elseif ($this->a_type[$key]=="numeric") // number 2 
decimale
                     {
                         $text=new INum($key);
-                        $text->value=$value;
+                        $text->prec=2;
+                        $text->value=round($value??"0",2);
                         
$min_size=(noalyss_strlen($value)<10)?10:strlen($value)+1;
                         $text->size=$min_size;
                         echo $text->input();
@@ -1186,7 +1195,7 @@ function check()
                     {
                         $text=new INum($key);
                         $text->prec=4;
-                        $text->value=$value;
+                        $text->value=round($value??"0",4);;
                         
$min_size=(noalyss_strlen($value)<10)?10:strlen($value)+1;
                         $text->size=$min_size;
                         echo $text->input();
@@ -1195,7 +1204,7 @@ function check()
                     {
                         $text=new INum($key);
                         $text->prec=6;
-                        $text->value=$value;
+                        $text->value=round($value??"0",6);
                         
$min_size=(noalyss_strlen($value)<10)?10:strlen($value)+1;
                         $text->size=$min_size;
                         echo $text->input();



reply via email to

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