diff --git a/build/makepack-dolibarrmodule.pl b/build/makepack-dolibarrmodule.pl
index f366f18c0a31a3b9ec29a9e217b9eff8f576488d..ff86aad195e5e6bd9287b1d27f4ea4db0015cbe0 100644
--- a/build/makepack-dolibarrmodule.pl
+++ b/build/makepack-dolibarrmodule.pl
@@ -103,7 +103,7 @@ if (-d "/usr/src/RPM") {
     $RPMDIR="/usr/src/RPM";
 }
 
-$SOURCE="$DIR/../../dolibarr";
+$SOURCE="$DIR/..";
 $DESTI="$SOURCE/build";
 
 
diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php
index 086650f3b7fe7eb4f51d627345ff27745a6c09df..80ff2417da0096a8a00c31b938ebb3cf3be85356 100644
--- a/htdocs/admin/modules.php
+++ b/htdocs/admin/modules.php
@@ -161,63 +161,72 @@ llxHeader("","");
 print_fiche_titre($langs->trans("ModulesSetup"),'','setup');
 
 
-// Recherche les modules
-$dir = DOL_DOCUMENT_ROOT . "/includes/modules/";
+// Search modules
+$dirlist=array();
+$dirlist[]=DOL_DOCUMENT_ROOT;
+if (defined('DOL_DOCUMENT_ROOT_BIS')) $dirlist[]=DOL_DOCUMENT_ROOT_BIS;
 
-// Charge tableaux modules, nom, numero, orders depuis r�pertoire dir
-$handle=opendir($dir);
 $filename = array();
 $modules = array();
 $orders = array();
 $categ = array();
-$i = 0;
-$j = 0;
-while (($file = readdir($handle))!==false)
+$dirmod = array();
+foreach ($dirlist as $dirroot)
 {
-    if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod'  && substr($file, strlen($file) - 10) == '.class.php')
-    {
-        $modName = substr($file, 0, strlen($file) - 10);
-
-        if ($modName)
-        {
-            include_once($dir.$file);
-            $objMod = new $modName($db);
+	$dir = $dirroot . "/includes/modules/";
 
-            if ($objMod->numero > 0)
-            {
-                $j = $objMod->numero;
-            }
-            else
-            {
-                $j = 1000 + $i;
-            }
-
-			$modulequalified=1;
-
-			// We discard modules that does not respect constraint on menu handlers
-			if ($objMod->needleftmenu && sizeof($objMod->needleftmenu) && ! in_array($conf->left_menu,$objMod->needleftmenu)) $modulequalified=0;
-			if ($objMod->needtopmenu  && sizeof($objMod->needtopmenu)  && ! in_array($conf->top_menu,$objMod->needtopmenu))   $modulequalified=0;
-
-			// We dsicard modules according to features level (if active we always show them)
-			$const_name = $objMod->const_name;
-			if ($objMod->version == 'development'  && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0;
-			if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0;
-
-			if ($modulequalified)
-			{
-	            $modules[$i] = $objMod;
-	            $filename[$i]= $modName;
-	            $orders[$i]  = "$objMod->family"."_".$j;   // Tri par famille puis numero module
-				$categ[$objMod->special]++;					// Array of all different modules categories
-	            $j++;
-	            $i++;
-			}
-        }
-    }
+	// Charge tableaux modules, nom, numero, orders depuis r�pertoire dir
+	$handle=opendir($dir);
+	$i = 0;
+	$j = 0;
+	while (($file = readdir($handle))!==false)
+	{
+	    if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod'  && substr($file, strlen($file) - 10) == '.class.php')
+	    {
+	        $modName = substr($file, 0, strlen($file) - 10);
+
+	        if ($modName)
+	        {
+	            include_once($dir.$file);
+	            $objMod = new $modName($db);
+
+	            if ($objMod->numero > 0)
+	            {
+	                $j = $objMod->numero;
+	            }
+	            else
+	            {
+	                $j = 1000 + $i;
+	            }
+
+				$modulequalified=1;
+
+				// We discard modules that does not respect constraint on menu handlers
+				if ($objMod->needleftmenu && sizeof($objMod->needleftmenu) && ! in_array($conf->left_menu,$objMod->needleftmenu)) $modulequalified=0;
+				if ($objMod->needtopmenu  && sizeof($objMod->needtopmenu)  && ! in_array($conf->top_menu,$objMod->needtopmenu))   $modulequalified=0;
+
+				// We dsicard modules according to features level (if active we always show them)
+				$const_name = $objMod->const_name;
+				if ($objMod->version == 'development'  && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0;
+				if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0;
+
+				if ($modulequalified)
+				{
+		            $modules[$i] = $objMod;
+		            $filename[$i]= $modName;
+		            $orders[$i]  = "$objMod->family"."_".$j;   // Tri par famille puis numero module
+					$categ[$objMod->special]++;					// Array of all different modules categories
+		            $dirmod[$i] = $dirroot;
+					$j++;
+		            $i++;
+				}
+	        }
+	    }
+	}
 }
 
-asort($orders);
 
+asort($orders);
 
 // Affichage debut page
 
@@ -368,15 +377,16 @@ foreach ($orders as $key => $value)
                     $i=0;
                     foreach ($objMod->config_page_url as $page)
                     {
+						$urlpage=$page;
                         if ($i++)
                         {
-                            print '<a href="'.$page.'" alt="'.$langs->trans($page).'">'.img_picto(ucfirst($page),"setup").'</a>&nbsp;';
+                            print '<a href="'.$urlpage.'" alt="'.$langs->trans($page).'">'.img_picto(ucfirst($page),"setup").'</a>&nbsp;';
                         //    print '<a href="'.$page.'">'.ucfirst($page).'</a>&nbsp;';
                         }
                         else
                         {
                             //print '<a href="'.$page.'">'.$langs->trans("Setup").'</a>&nbsp;';
-                            print '<a href="'.$page.'" alt="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup").'</a>&nbsp;';
+                            print '<a href="'.$urlpage.'" alt="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup").'</a>&nbsp;';
                         }
                     }
                     print "</td>\n";
diff --git a/htdocs/admin/pre.inc.php b/htdocs/admin/pre.inc.php
index e23cb921251d20424cf2bfd3b9d1ff1c62f18973..51b77b8185487e4bf24f1f6906c6773b9b6ccafe 100644
--- a/htdocs/admin/pre.inc.php
+++ b/htdocs/admin/pre.inc.php
@@ -16,18 +16,17 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * $Id$
- * $Source$
  */
 
 /**
    \file       htdocs/admin/pre.inc.php
    \brief      Fichier gestionnaire du menu de gauche de l'espace configuration
-   \version    $Revision$
+   \version    $Id$
 */
 
-require("../main.inc.php");
+$res=@include("../main.inc.php");
+if (! $res) include("../../../dolibarr/htdocs/main.inc.php");	// Used on dev env only
+
 
 $langs->load("admin");
 
diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php
index 99c3a033898cecb826d45a2de932e3f3b616ede2..7229b3ae8340c5b102fb464fd6650b8c1b76651d 100644
--- a/htdocs/master.inc.php
+++ b/htdocs/master.inc.php
@@ -78,7 +78,7 @@ if (! isset($dolibarr_main_db_type))
 {	
   $dolibarr_main_db_type='mysql';   // Pour compatibilite avec anciennes configs, si non defini, on prend 'mysql'
 }
-if (! $dolibarr_main_data_root) {
+if (empty($dolibarr_main_data_root)) {
   // Si repertoire documents non defini, on utilise celui par defaut
   $dolibarr_main_data_root=ereg_replace("/htdocs","",$dolibarr_main_document_root);
   $dolibarr_main_data_root.="/documents";
@@ -91,6 +91,9 @@ $pos = strstr ($uri, '/');      // $pos contient alors url sans nom domaine
 if ($pos == '/') $pos = '';     // si $pos vaut /, on le met a ''
 define('DOL_URL_ROOT', $pos);								// URL racine relative
 
+// Special code for alternate dev directories (Used on dev env only)
+if (! empty($dolibarr_main_document_root_bis)) define('DOL_DOCUMENT_ROOT_BIS', $dolibarr_main_document_root_bis);
+
 
 /*
  * Controle validite fichier conf