diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 81eec5a4247..3dbedae32bb 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -805,7 +805,7 @@ if ($mode == 'common') { foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage) { - if ($keycountry == 'always' || $keycountry == $mysoc->country_code) + if (preg_match('/^always/', $keycountry) || ($mysoc->country_code && preg_match('/^'.$mysoc->country_code.'/', $keycountry))) { $warningmessage .= ($warningmessage?"\n":"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName()); $warningmessage .= ($warningmessage?"\n":"").($warningmessage?"\n":"").$langs->trans("Module").' : '.$objMod->getName(); diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index f92fd56a87b..34ca8e48079 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -932,10 +932,11 @@ function activateModule($value,$withdeps=1) if (isset($objMod->depends) && is_array($objMod->depends) && ! empty($objMod->depends)) { // Activation of modules this module depends on - // this->depends may be array('modModule1', 'mmodModule2') or array('always'=>"modModule1", 'FR'=>'modModule2') + // this->depends may be array('modModule1', 'mmodModule2') or array('always1'=>"modModule1", 'FR'=>'modModule2') foreach ($objMod->depends as $key => $modulestring) { - if ((! is_numeric($key)) && $key != 'always' && $key != $mysoc->country_code) + //var_dump((! is_numeric($key)) && ! preg_match('/^always/', $key) && $mysoc->country_code && ! preg_match('/^'.$mysoc->country_code.'/', $key));exit; + if ((! is_numeric($key)) && ! preg_match('/^always/', $key) && $mysoc->country_code && ! preg_match('/^'.$mysoc->country_code.'/', $key)) { dol_syslog("We are not concerned by dependency with key=".$key." because our country is ".$mysoc->country_code); continue; @@ -943,6 +944,7 @@ function activateModule($value,$withdeps=1) $activate = false; foreach ($modulesdir as $dir) { + var_dump($modulestring); if (file_exists($dir.$modulestring.".class.php")) { $resarray = activateModule($modulestring); diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index dfaaa6b26b4..24541c353e8 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -300,7 +300,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it /** * @var string[] List of module class names that must be enabled if this module is enabled. * - * e.g.: array('modAnotherModule', 'modYetAnotherModule') + * e.g.: array('modAnotherModule', 'FR'=>'modYetAnotherModule') */ public $depends; diff --git a/htdocs/core/modules/modTakePos.class.php b/htdocs/core/modules/modTakePos.class.php index 4603ba74c04..4404ee9de63 100644 --- a/htdocs/core/modules/modTakePos.class.php +++ b/htdocs/core/modules/modTakePos.class.php @@ -98,7 +98,7 @@ class modTakePos extends DolibarrModules // Dependencies $this->hidden = false; // A condition to hide module - $this->depends = array('always'=>"modBanque", 'always'=>"modFacture", 'always'=>"modProduct", 'always'=>'modCategorie', 'FR'=>'modBlockedLog'); // List of module class names as string that must be enabled if this module is enabled + $this->depends = array('always1'=>"modBanque", 'always2'=>"modFacture", 'always3'=>"modProduct", 'always4'=>'modCategorie', 'FR1'=>'modBlockedLog'); // List of module class names as string that must be enabled if this module is enabled $this->requiredby = array(); // List of module ids to disable if this one is disabled $this->conflictwith = array(); // List of module class names as string this module is in conflict with $this->langfiles = array("cashdesk");