diff --git a/htdocs/core/ajax/loadinplace.php b/htdocs/core/ajax/loadinplace.php index 152ba07288d..55d9adb70f3 100644 --- a/htdocs/core/ajax/loadinplace.php +++ b/htdocs/core/ajax/loadinplace.php @@ -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); diff --git a/htdocs/core/ajax/saveinplace.php b/htdocs/core/ajax/saveinplace.php index 9af6a83e54a..50541facffa 100644 --- a/htdocs/core/ajax/saveinplace.php +++ b/htdocs/core/ajax/saveinplace.php @@ -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) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 50d8dd7e123..4b09433eecc 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -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); + } + } } } }