noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 05/33: IMPROVE #0002362: CCARDAT : Attribut d


From: dwm
Subject: [Noalyss-commit] [noalyss] 05/33: IMPROVE #0002362: CCARDAT : Attribut de fiche Add control for element (choice) and allow to use VALUE(1, 1), (2, 2)
Date: Thu, 18 Jul 2024 12:24:43 -0400 (EDT)

sparkyx pushed a commit to branch unstable
in repository noalyss.

commit f7ea77efb3c968eed86d63cca44497788a9ac834
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Sat Jun 15 13:07:34 2024 +0200

    IMPROVE #0002362: CCARDAT : Attribut de fiche Add control for element 
(choice) and allow to use VALUE(1,1), (2,2)
---
 include/class/card_attribut_mtable.class.php | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/include/class/card_attribut_mtable.class.php 
b/include/class/card_attribut_mtable.class.php
index 76ef2ffa2..80e7996fb 100644
--- a/include/class/card_attribut_mtable.class.php
+++ b/include/class/card_attribut_mtable.class.php
@@ -68,7 +68,7 @@ class Card_Attribut_MTable extends Manage_Table_SQL
     }
 
     /**
-     * Display row of table attr_def
+     * @brief Display row of table attr_def
      * @param array $row 
      */
     function display_row($row)
@@ -89,7 +89,7 @@ class Card_Attribut_MTable extends Manage_Table_SQL
     }
 
     /**
-     * For the type custom , we can call a function to display properly the 
value
+     * @brief For the type custom , we can call a function to display properly 
the value
      * @param $p_key string key name
      * @param $p_value string value
      * @see input_custom
@@ -125,7 +125,7 @@ class Card_Attribut_MTable extends Manage_Table_SQL
     }
 
     /**
-     * For the type custom , we can call a function to display properly the 
value
+     * @brief For the type custom , we can call a function to display properly 
the value
      * @param $p_key string key name
      * @param $p_value string value
      * @see input_custom
@@ -214,9 +214,29 @@ class Card_Attribut_MTable extends Manage_Table_SQL
 
                 $this->set_error("ad_extra", _("La requête SQL est vide "));
             }
+            $cn= $this->get_table()->cn;
+            $cn->start();
+            try {
+                // remove SQL command like insert , delete , update, truncate 
, drop
+                $sql=$object_sql->ad_extra;
+                $sql=str_ireplace("delete", "del.ete", $sql);
+                $sql=str_ireplace("insert", "del.ete", $sql);
+                $sql=str_ireplace("update", "del.ete", $sql);
+                $sql=str_ireplace("truncate", "del.ete", $sql);
+                $sql=str_ireplace("drop", "del.ete", $sql);
+                $cn->exec_sql($sql);
+
+            } catch (\Exception $e) {
+                $this->set_error("ad_extra", _("ERREUR SQL : ")
+                        .$object_sql->ad_extra);
+            } finally {
+                $cn->rollback();
+            }
+
+
             if (preg_match('/^\h*select/i', $object_sql->ad_extra)==0)
             {
-                $this->set_error("ad_extra", _("La requête SQL doit commencer 
par SELECT "));
+
             }
         }
         if ( $object_sql->ad_default_order < 11 || 
$object_sql->ad_default_order > 9998) {



reply via email to

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