noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 03/65: Bug : when trying to access a event th


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 03/65: Bug : when trying to access a event the user can't access, the javascript failed
Date: Wed, 09 Sep 2015 08:26:59 +0000

sparkyx pushed a commit to branch master
in repository noalyss.

commit e289606547ffe8824447fc78a127e1229623c963
Author: Dany De Bontridder <address@hidden>
Date:   Sat Aug 29 23:30:43 2015 +0200

    Bug : when trying to access a event the user can't access, the javascript 
failed
---
 html/js/scripts.js           |    9 +++++++--
 include/ajax_view_action.php |    5 ++++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/html/js/scripts.js b/html/js/scripts.js
index 52d60da..3381729 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -2027,11 +2027,16 @@ function view_action(ag_id, dossier, modify)
                     try {
                         remove_waiting_box();
                         var answer = req.responseXML;
+                        var ctl = answer.getElementsByTagName('ctl');
+                        if ( ctl.length == 0) {
+                            throw 'ajax failed ctl view_action';
+                        }
+                        var ctl_txt=getNodeText(ctl[0]);
                         var html = answer.getElementsByTagName('code');
                         if (html.length === 0)
                         {
                             var rec = req.responseText;
-                            alert_box('erreur :' + rec);
+                            throw 'ajax failed  html view_action';
                         }
                         var code_html = getNodeText(html[0]);
                         code_html = unescape_xml(code_html);
@@ -2043,7 +2048,7 @@ function view_action(ag_id, dossier, modify)
                             style: pos
                         });
                         $(id).innerHTML = code_html;
-                        compute_all_ledger();
+                        if ( ctl_txt == 'ok') { compute_all_ledger();}
                     } catch (e) {
                         alert_box('view_action' + e.message);
                     }
diff --git a/include/ajax_view_action.php b/include/ajax_view_action.php
index a785456..38a1f79 100644
--- a/include/ajax_view_action.php
+++ b/include/ajax_view_action.php
@@ -34,17 +34,20 @@ echo HtmlInput::title_box(_("Détail action"), $div);
 $act = new Follow_Up($cn);
 $act->ag_id = $ag_id;
 $act->get();
+$code='nok';
 if ($g_user->can_write_action($ag_id) == true || 
$g_user->can_read_action($ag_id) == true || $act->ag_dest == -1)
 {   
         $menu=new Default_Menu();
        echo $act->Display('READ', false, "ajax", "");
        //$action=HtmlInput::array_to_string(array("gDossier","ag_id"), 
$_GET)."&ac=FOLLOW&sa=detail";
         $action=  
"do.php?".http_build_query(array("gDossier"=>Dossier::id(),"ag_id"=>$ag_id,"ac"=>$menu->get('code_follow'),"sa"=>"detail"));
+        $code='ok';
        if ( $_GET['mod']== 1) :
             $forbidden=_("Accès interdit : vous n'avez pas accès à cette 
information, contactez votre responsable");
        ?>
 <a href="<?php echo $action?>" target="_blank" class="smallbutton"><?php echo 
_("Modifier")?> </a>
     <?php 
+        $code='nok';
        endif;
 }
 else
@@ -63,7 +66,7 @@ header('Content-type: text/xml; charset=UTF-8');
 echo <<<EOF
 <?xml version="1.0" encoding="UTF-8"?>
 <data>
-<ctl></ctl>
+<ctl>$code</ctl>
 <code>$html</code>
 </data>
 EOF;



reply via email to

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