This commit is contained in:
Laurent Destailleur
2018-10-30 13:54:11 +01:00
parent 0500f54237
commit d4fd55c4cf
4 changed files with 7 additions and 5 deletions

View File

@@ -805,7 +805,7 @@ if ($mode == 'common')
{ {
foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage) 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":"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName());
$warningmessage .= ($warningmessage?"\n":"").($warningmessage?"\n":"").$langs->trans("Module").' : '.$objMod->getName(); $warningmessage .= ($warningmessage?"\n":"").($warningmessage?"\n":"").$langs->trans("Module").' : '.$objMod->getName();

View File

@@ -932,10 +932,11 @@ function activateModule($value,$withdeps=1)
if (isset($objMod->depends) && is_array($objMod->depends) && ! empty($objMod->depends)) if (isset($objMod->depends) && is_array($objMod->depends) && ! empty($objMod->depends))
{ {
// Activation of modules this module depends on // 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) 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); dol_syslog("We are not concerned by dependency with key=".$key." because our country is ".$mysoc->country_code);
continue; continue;
@@ -943,6 +944,7 @@ function activateModule($value,$withdeps=1)
$activate = false; $activate = false;
foreach ($modulesdir as $dir) foreach ($modulesdir as $dir)
{ {
var_dump($modulestring);
if (file_exists($dir.$modulestring.".class.php")) if (file_exists($dir.$modulestring.".class.php"))
{ {
$resarray = activateModule($modulestring); $resarray = activateModule($modulestring);

View File

@@ -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. * @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; public $depends;

View File

@@ -98,7 +98,7 @@ class modTakePos extends DolibarrModules
// Dependencies // Dependencies
$this->hidden = false; // A condition to hide module $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->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->conflictwith = array(); // List of module class names as string this module is in conflict with
$this->langfiles = array("cashdesk"); $this->langfiles = array("cashdesk");