Fix: Adding dictionnary is ok for external modules

This commit is contained in:
Laurent Destailleur 2011-12-13 00:30:54 +01:00
parent ba12c25eec
commit df227422ed

View File

@ -856,19 +856,40 @@ function complete_dictionnary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsq
$orders = array(); $orders = array();
$categ = array(); $categ = array();
$dirmod = array(); $dirmod = array();
$modulesdir = array();
$i = 0; // is a sequencer of modules found $i = 0; // is a sequencer of modules found
$j = 0; // j is module number. Automatically affected if module number not defined. $j = 0; // j is module number. Automatically affected if module number not defined.
foreach ($conf->file->dol_document_root as $dirroot)
{
$dir = $dirroot . "/core/modules/";
// Load modules attributes in arrays (name, numero, orders) from dir directory foreach ($conf->file->dol_document_root as $type => $dirroot)
//print $dir."\n<br>"; {
dol_syslog("Scan directory ".$dir." for modules"); $modulesdir[$dirroot . '/core/modules/'] = $dirroot . '/core/modules/';
$handle=@opendir($dirroot);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (is_dir($dirroot.'/'.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS' && $file != 'includes')
{
if (is_dir($dirroot . '/' . $file . '/core/modules/'))
{
$modulesdir[$dirroot . '/' . $file . '/core/modules/'] = $dirroot . '/' . $file . '/core/modules/';
}
}
}
closedir($handle);
}
}
//var_dump($modulesdir);
foreach ($modulesdir as $dir)
{
// Load modules attributes in arrays (name, numero, orders) from dir directory
//print $dir."\n<br>";
dol_syslog("Scan directory ".$dir." for modules");
$handle=@opendir(dol_osencode($dir)); $handle=@opendir(dol_osencode($dir));
if (is_resource($handle)) if (is_resource($handle))
{ {
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
//print "$i ".$file."\n<br>"; //print "$i ".$file."\n<br>";