noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 18/73: Direct Access with a Single AC (withou


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 18/73: Direct Access with a Single AC (without the full path)
Date: Fri, 28 May 2021 05:26:24 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 7810af1295efb975fb890922660f608cbf1510e9
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Sun Apr 11 12:51:53 2021 +0200

    Direct Access with a Single AC (without the full path)
---
 html/do.php | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/html/do.php b/html/do.php
index 471e89c..b75a754 100644
--- a/html/do.php
+++ b/html/do.php
@@ -266,7 +266,35 @@ if (isset($_REQUEST['ac']))
             array($AC,$user_profile));
 
     try {        
-        if (count($amenu_id) == 0 ) { throw new Exception(_('Erreur 
menu'),10);}
+        if (count($amenu_id) == 0 ) { 
+            // if only an Access Direct is asked without the full path
+            
+            $aAccess=[];
+            // Find the possible path pm_id_v3 / pm_id_v2 / pm_id_v1
+            $direct_ac=$cn->get_array("select 
me_file,me_parameter,me_javascript  from profile_menu 
+                    join menu_ref using (me_code)
+                    where 
+                    p_id=$2 
+                    and me_code=$1", [strtoupper($AC),$user_profile]);
+            
+            // if the me_code is available for user, find all the possible path
+            if (!empty($direct_ac)) {
+               $aAccess=$cn->get_array("select code, me_code from 
v_menu_description where me_code=$1 and p_id=$2",
+                       [strtoupper($AC),$user_profile]);
+            }
+            
+            if (empty($aAccess)) {
+                throw new Exception(_('Erreur menu'),10);
+            }
+            
+            // retrieve the element path 
+            $amenu_id=$cn->get_array('select 
+                      pm_id_v3,pm_id_v2,pm_id_v1
+                        from v_menu_profile 
+                        where code= upper($1)  and p_id=$2',
+            array($aAccess[0]['code'],$user_profile));
+            
+        }
         if ( count($amenu_id)> 1)     {
             $tmp=$amenu_id[0];
             $amenu_id=[];



reply via email to

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