Merge branch 'patch-77' of https://github.com/defrance/dolibarr into
defrance-patch-77 Conflicts: htdocs/core/lib/admin.lib.php
This commit is contained in:
commit
9cce56895c
@ -34,6 +34,7 @@ require '../main.inc.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
|
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
@ -465,6 +466,9 @@ if ($id == 11)
|
|||||||
'fichinter' => $langs->trans('InterventionCard')
|
'fichinter' => $langs->trans('InterventionCard')
|
||||||
);
|
);
|
||||||
if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty');
|
if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty');
|
||||||
|
|
||||||
|
complete_elementList_with_modules($elementList);
|
||||||
|
|
||||||
asort($elementList);
|
asort($elementList);
|
||||||
$sourceList = array(
|
$sourceList = array(
|
||||||
'internal' => $langs->trans('Internal'),
|
'internal' => $langs->trans('Internal'),
|
||||||
|
|||||||
@ -678,9 +678,11 @@ function activateModule($value,$withdeps=1)
|
|||||||
$ret='';
|
$ret='';
|
||||||
$modName = $value;
|
$modName = $value;
|
||||||
$modFile = $modName . ".class.php";
|
$modFile = $modName . ".class.php";
|
||||||
$modulesdir = dolGetModulesDirs();
|
|
||||||
|
|
||||||
// Loop on each directory
|
// Loop on each directory to fill $modulesdir
|
||||||
|
$modulesdir = dolGetModulesDirs();
|
||||||
|
|
||||||
|
// Loop on each modulesdir directories
|
||||||
$found=false;
|
$found=false;
|
||||||
foreach ($modulesdir as $dir)
|
foreach ($modulesdir as $dir)
|
||||||
{
|
{
|
||||||
@ -775,9 +777,11 @@ function unActivateModule($value, $requiredby=1)
|
|||||||
$ret='';
|
$ret='';
|
||||||
$modName = $value;
|
$modName = $value;
|
||||||
$modFile = $modName . ".class.php";
|
$modFile = $modName . ".class.php";
|
||||||
$modulesdir = dolGetModulesDirs();
|
|
||||||
|
|
||||||
// Loop on each directory
|
// Loop on each directory to fill $modulesdir
|
||||||
|
$modulesdir = dolGetModulesDirs();
|
||||||
|
|
||||||
|
// Loop on each modulesdir directories
|
||||||
$found=false;
|
$found=false;
|
||||||
foreach ($modulesdir as $dir)
|
foreach ($modulesdir as $dir)
|
||||||
{
|
{
|
||||||
@ -887,13 +891,13 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql
|
|||||||
if ($modulequalified)
|
if ($modulequalified)
|
||||||
{
|
{
|
||||||
// Load languages files of module
|
// Load languages files of module
|
||||||
if (isset($objMod->langfiles) && is_array($objMod->langfiles))
|
if (isset($objMod->langfiles) && is_array($objMod->langfiles))
|
||||||
{
|
{
|
||||||
foreach($objMod->langfiles as $langfile)
|
foreach($objMod->langfiles as $langfile)
|
||||||
{
|
{
|
||||||
$langs->load($langfile);
|
$langs->load($langfile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Complete arrays
|
// Complete arrays
|
||||||
//&$tabname,&$tablib,&$tabsql,&$tabsqlsort,&$tabfield,&$tabfieldvalue,&$tabfieldinsert,&$tabrowid,&$tabcond
|
//&$tabname,&$tablib,&$tabsql,&$tabsqlsort,&$tabfield,&$tabfieldvalue,&$tabfieldinsert,&$tabrowid,&$tabcond
|
||||||
@ -943,6 +947,107 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add external modules to list of contact element
|
||||||
|
*
|
||||||
|
* @param array $elementList elementList
|
||||||
|
* @return int 1
|
||||||
|
*/
|
||||||
|
function complete_elementList_with_modules(&$elementList)
|
||||||
|
{
|
||||||
|
global $db, $modules, $conf, $langs;
|
||||||
|
|
||||||
|
// Search modules
|
||||||
|
$filename = array();
|
||||||
|
$modules = array();
|
||||||
|
$orders = array();
|
||||||
|
$categ = array();
|
||||||
|
$dirmod = array();
|
||||||
|
|
||||||
|
$i = 0; // is a sequencer of modules found
|
||||||
|
$j = 0; // j is module number. Automatically affected if module number not defined.
|
||||||
|
|
||||||
|
$modulesdir = dolGetModulesDirs();
|
||||||
|
|
||||||
|
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));
|
||||||
|
if (is_resource($handle))
|
||||||
|
{
|
||||||
|
while (($file = readdir($handle))!==false)
|
||||||
|
{
|
||||||
|
//print "$i ".$file."\n<br>";
|
||||||
|
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
|
||||||
|
{
|
||||||
|
$modName = substr($file, 0, dol_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 according to features level (PS: if module is activated we always show it)
|
||||||
|
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod)));
|
||||||
|
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 module is not activated disqualified
|
||||||
|
if (empty($conf->global->$const_name)) $modulequalified=0;
|
||||||
|
|
||||||
|
if ($modulequalified)
|
||||||
|
{
|
||||||
|
// Load languages files of module
|
||||||
|
if (isset($objMod->langfiles) && is_array($objMod->langfiles))
|
||||||
|
{
|
||||||
|
foreach($objMod->langfiles as $langfile)
|
||||||
|
{
|
||||||
|
$langs->load($langfile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$modules[$i] = $objMod;
|
||||||
|
$filename[$i]= $modName;
|
||||||
|
$orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module
|
||||||
|
//print "x".$modName." ".$orders[$i]."\n<br>";
|
||||||
|
if (isset($categ[$objMod->special])) $categ[$objMod->special]++; // Array of all different modules categories
|
||||||
|
else $categ[$objMod->special]=1;
|
||||||
|
$dirmod[$i] = $dirroot;
|
||||||
|
if (! empty($objMod->module_parts['contactelement']))
|
||||||
|
{
|
||||||
|
$elementList[$objMod->name] = $langs->trans($objMod->name);
|
||||||
|
//exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$j++;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
else dol_syslog("Module ".get_class($objMod)." not qualified");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir($handle);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_syslog("htdocs/admin/modules.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show array with constants to edit
|
* Show array with constants to edit
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user