From 30646d860df07c5e55223b0ade4c1418c5cbe270 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Sat, 13 Aug 2005 20:15:35 +0000
Subject: [PATCH] New: N'affiche pas les modules en version 'development'.

---
 htdocs/admin/modules.php | 76 +++++++++++++++++++++-------------------
 1 file changed, 40 insertions(+), 36 deletions(-)

diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php
index 1dc2a00d264..98fcf9a65ec 100644
--- a/htdocs/admin/modules.php
+++ b/htdocs/admin/modules.php
@@ -191,9 +191,12 @@ while (($file = readdir($handle))!==false)
             {
                 $j = 1000 + $i;
             }
-            $modules[$i] = $modName;
-            $numero[$i] = $j;
-            $orders[$i] = "$objMod->family"."_".$j;   // Tri par famille puis numero module
+
+            $modules[$i] = $objMod;
+
+            $nom[$i]     = $modName;
+            $numero[$i]  = $j;
+            $orders[$i]  = "$objMod->family"."_".$j;   // Tri par famille puis numero module
             $j++;
             $i++;
         }
@@ -211,21 +214,23 @@ $familylib=array(
 'other'=>$langs->trans("ModuleFamilyOther"),
 'technic'=>$langs->trans("ModuleFamilyTechnic"),
 'financial'=>$langs->trans("ModuleFamilyFinancial"),
-'experimental'=>$langs->trans("ModuleFamilyExperimental")
 );
 foreach ($orders as $key => $value)
 {
     $tab=split('_',$value);
     $family=$tab[0]; $numero=$tab[1];
 
-    $modName = $modules[$key];
-    if ($modName)
+    $modName = $nom[$key];
+    $objMod  = $modules[$key];
+
+    // On affiche pas module si en version 'development' et que
+    // constante MAIN_SHOW_DEVELOPMENT_MODULES non d�finie
+    if ($objMod->version == 'development' && ! $conf->global->MAIN_SHOW_DEVELOPMENT_MODULES)
     {
-        $objMod = new $modName($db);
+        continue;
     }
-
+    
     $const_name = $objMod->const_name;
-    $const_value = $objMod->const_config;
 
     if ($oldfamily && $family!=$oldfamily && $atleastoneforfamily) {
         print "<tr class=\"liste_titre\">\n  <td colspan=\"9\"></td>\n</tr>\n";
@@ -233,22 +238,22 @@ foreach ($orders as $key => $value)
     }
 
     if((!$objMod->special && !$_GET["spe"] ) or ($objMod->special && $_GET["spe"]))
-      {
+    {
         $atleastoneforfamily=1;
         $var=!$var;
-        
+
         print "<tr $bc[$var]>\n";
-	
+
         print "  <td class=\"body\" valign=\"top\">";
         if ($family!=$oldfamily)
-	  { 
-	    print "<div class=\"titre\">".$familylib[$family]."</div>";
-	    $oldfamily=$family;
-	  }
+        {
+            print "<div class=\"titre\">".$familylib[$family]."</div>";
+            $oldfamily=$family;
+        }
         else
-	  { 
-	    print '&nbsp;';
-	  }
+        {
+            print '&nbsp;';
+        }
         print "</td>\n";
         print '  <td valign="top" width="14" align="center">';
         print $objMod->picto?img_object('',$objMod->picto):img_object('','generic');
@@ -261,24 +266,23 @@ foreach ($orders as $key => $value)
         print $objMod->getDbVersion();
         print "</td>\n  <td align=\"center\">";
 
-        if ($const_value == 1)
-	  {
-    	    print img_tick();
-	  }
+        if ($conf->global->$const_name == 1)
+        {
+            print img_tick();
+        }
         else
-	  {
+        {
             print "&nbsp;";
-	  }
-	
+        }
+
         print "</td>\n  <td align=\"center\">";
-	
 
-        if ($const_value == 1)
-    	{
+        if ($conf->global->$const_name == 1)
+        {
             // Module actif
             print "<a href=\"modules.php?id=".$objMod->numero."&amp;action=reset&amp;value=" . $modName . "&amp;spe=" . $_GET["spe"] . "\">" . $langs->trans("Disable") . "</a></td>\n";
-        
-        
+
+
             if ($objMod->config_page_url)
             {
                 if (is_array($objMod->config_page_url)) {
@@ -308,17 +312,17 @@ foreach ($orders as $key => $value)
             {
                 print "  <td>&nbsp;</td>";
             }
-    
+
         }
         else
-	    {
+        {
             // Module non actif
             print "<a href=\"modules.php?id=".$objMod->numero."&amp;action=set&amp;value=" . $modName . "&amp;spe=" . $_GET["spe"] . "\">" . $langs->trans("Activate") . "</a></td>\n  <td>&nbsp;</td>\n";
-	    }
-	
+        }
+
         print "</tr>\n";
     }
-    
+
 }
 print "</table></div>\n";
 
-- 
GitLab