Merge branch '3.2' of ssh://git@github.com/Dolibarr/dolibarr.git into 3.2

This commit is contained in:
Laurent Destailleur 2012-06-06 23:13:41 +02:00
commit d8894b149e
3 changed files with 38 additions and 17 deletions

View File

@ -87,8 +87,15 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($
}
else if (! empty($ext_element))
{
dol_include_once('/'.$ext_element.'/class/actions_'.$ext_element.'.class.php');
$classname = 'Actions'.ucfirst($ext_element);
$module = $subelement = $ext_element;
if (preg_match('/^([^_]+)_([^_]+)/i',$ext_element,$regs))
{
$module = $regs[1];
$subelement = $regs[2];
}
dol_include_once('/'.$module.'/class/actions_'.$subelement.'.class.php');
$classname = 'Actions'.ucfirst($subelement);
$object = new $classname($db);
$ret = $object->$methodname();
if ($ret > 0) echo json_encode($object->$cachename);

View File

@ -51,6 +51,7 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($
$field = substr($field, 8); // remove prefix val_
$type = GETPOST('type','alpha',2);
$value = ($type == 'ckeditor' ? GETPOST('value','',2) : GETPOST('value','alpha',2));
$loadmethod = GETPOST('loadmethod','alpha',2);
$savemethod = GETPOST('savemethod','alpha',2);
$savemethodname = (! empty($savemethod) ? $savemethod : 'setValueFrom');
@ -104,9 +105,9 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($
}
else if ($type == 'select')
{
$loadmethodname = 'load_cache_'.GETPOST('loadmethod','alpha');
$loadcachename = 'cache_'.GETPOST('loadmethod','alpha');
$loadviewname = 'view_'.GETPOST('loadmethod','alpha');
$loadmethodname = 'load_cache_'.$loadmethod;
$loadcachename = 'cache_'.$loadmethod;
$loadviewname = 'view_'.$loadmethod;
$form = new Form($db);
if (method_exists($form, $loadmethodname))
@ -131,8 +132,15 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($
}
else
{
dol_include_once('/'.$ext_element.'/class/actions_'.$ext_element.'.class.php');
$classname = 'Actions'.ucfirst($ext_element);
$module = $subelement = $ext_element;
if (preg_match('/^([^_]+)_([^_]+)/i',$ext_element,$regs))
{
$module = $regs[1];
$subelement = $regs[2];
}
dol_include_once('/'.$module.'/class/actions_'.$subelement.'.class.php');
$classname = 'Actions'.ucfirst($subelement);
$object = new $classname($db);
$ret = $object->$loadmethodname();
if ($ret > 0)

View File

@ -719,29 +719,35 @@ function activateModule($value,$withdeps=1)
if (! $ret && $withdeps)
{
if (is_array($objMod->depends) && !empty($objMod->depends))
if (is_array($objMod->depends) && ! empty($objMod->depends))
{
// Activation des modules dont le module depend
$num = count($objMod->depends);
for ($i = 0; $i < $num; $i++)
{
if (file_exists(DOL_DOCUMENT_ROOT."/core/modules/".$objMod->depends[$i].".class.php"))
{
activateModule($objMod->depends[$i]);
}
foreach ($modulesdir as $dir)
{
if (file_exists($dir.$objMod->depends[$i].".class.php"))
{
activateModule($objMod->depends[$i]);
}
}
}
}
if (isset($objMod->conflictwith) && is_array($objMod->conflictwith))
if (is_array($objMod->conflictwith) && ! empty($objMod->conflictwith))
{
// Desactivation des modules qui entrent en conflit
$num = count($objMod->conflictwith);
for ($i = 0; $i < $num; $i++)
{
if (file_exists(DOL_DOCUMENT_ROOT."/core/modules/".$objMod->conflictwith[$i].".class.php"))
{
unActivateModule($objMod->conflictwith[$i],0);
}
foreach ($modulesdir as $dir)
{
if (file_exists($dir.$objMod->conflictwith[$i].".class.php"))
{
unActivateModule($objMod->conflictwith[$i],0);
}
}
}
}
}