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

View File

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