noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 87/107: Bug : cannot get a message when tryin


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 87/107: Bug : cannot get a message when trying to save a new category of card
Date: Mon, 26 Aug 2019 10:32:06 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 24439d46850bec35b4db418fdef806f231cf0c55
Author: Dany De Bontridder <address@hidden>
Date:   Thu Aug 15 16:57:33 2019 +0200

    Bug : cannot get a message when trying to save a new category of card
---
 html/js/card.js                   |  3 +--
 include/ajax/ajax_card.php        | 42 +++++++++++++++++++++++++++++----------
 include/class/fiche_def.class.php |  2 +-
 3 files changed, 34 insertions(+), 13 deletions(-)

diff --git a/html/js/card.js b/html/js/card.js
index 4ab40df..95b731e 100644
--- a/html/js/card.js
+++ b/html/js/card.js
@@ -838,9 +838,8 @@ function save_card_category(obj)
         alert_box('Erreur pas d\' attribut ipopup '+obj.id);
         return;
     };
-       try {
+try {
                // Data must be taken here
-
     data=$('newcat').serialize(false);
     var dossier=$('gDossier').value;
     var queryString='ctl='+obj.ipopup+'&';
diff --git a/include/ajax/ajax_card.php b/include/ajax/ajax_card.php
index 1e7df81..cf825c1 100644
--- a/include/ajax/ajax_card.php
+++ b/include/ajax/ajax_card.php
@@ -86,7 +86,7 @@ set_language();
  *echo a warning if disconnected
  */
 ajax_disconnected($_REQUEST['ctl']);
-
+$http=new HttpInput();
 $cn=Dossier::connect();
 global $g_user;
 $g_user=new User($cn);
@@ -532,22 +532,40 @@ case 'scc':
      *
      *----------------------------------------------------------------------*/
     $html='';
+    $invalid=0;
     if ( $g_user->check_action(FICCAT) == 1 )
     {
-               $script=create_script("removeDiv('$ctl')");
-               $html.=$script;
-        if ( strlen(trim($_GET['nom_mod'])) != 0 )
+        
+        $html="";
+        $nom_mod=$http->get("nom_mod");
+        $class_base=$http->get("class_base");
+        $fd_description=$http->get("nom_mod");
+        if ( strlen(trim($nom_mod)) != 0 )
         {
             $array=array("FICHE_REF"=>$cat,
-                         "nom_mod"=>$_GET['nom_mod'],
-                         "class_base"=>$_GET['class_base'],
-                          "fd_description"=>$_GET['fd_description']);
+                         "nom_mod"=>$nom_mod,
+                         "class_base"=>$class_base,
+                          "fd_description"=>$fd_description);
+            
             if ( isset ($_POST['create'])) $array['create']=1;
+            
             $catcard=new Fiche_Def($cn);
-            if ( $catcard->Add($array) == -1)
+            
+            ob_start();
+            $result=$catcard->Add($array);
+            
+            $html.=ob_get_contents();
+            ob_end_clean();
+            
+            if (  $result == 1)
+            {
                 $script="alert_box('"._('Catégorie existe déjà')."')";
-            else
-                $script="alert_box('"._('Catégorie sauvée')."')";
+                $invalid=1;
+            }
+            else{
+                $script="alert_box('"._('Catégorie 
sauvée')."');removeDiv('$ctl')";
+            }
+                
             $html.=create_script($script);
         }
         else
@@ -561,6 +579,10 @@ case 'scc':
     else
     {
         $html=alert(_('Action interdite'),true);
+        $invalid=1;
+    }
+    if  ($invalid == 1) {
+        $ctl="info_div";
     }
     break;
 case 'upc':
diff --git a/include/class/fiche_def.class.php 
b/include/class/fiche_def.class.php
index f913ed5..a06ee60 100644
--- a/include/class/fiche_def.class.php
+++ b/include/class/fiche_def.class.php
@@ -233,7 +233,7 @@ $order
         $count=$this->cn->get_value($sql,array(trim($p_nom_mod)));
 
         if ($count != 0 ) {
-                        echo alert (_('Catégorie existante'));
+                        alert (_('Catégorie existante'));
                        return 1;
                }
         // Set the value of fiche_def.fd_create_account



reply via email to

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