diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 687c3750c89..88ad0acf097 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -63,8 +63,6 @@ $dolistore = new Dolistore(false); if (! $user->admin) accessforbidden(); -$specialtostring=array(0=>'common', 1=>'interfaces', 2=>'other', 3=>'functional', 4=>'marketplace'); - $familyinfo=array( 'hr'=>array('position'=>'001', 'label'=>$langs->trans("ModuleFamilyHr")), 'crm'=>array('position'=>'006', 'label'=>$langs->trans("ModuleFamilyCrm")), @@ -368,11 +366,8 @@ foreach ($modulesdir as $dir) } } ksort($arrayofnatures); - } - // Define array $categ with categ with at least one qualified module - if ($modulequalified > 0) - { + // Define array $categ with categ with at least one qualified module $filename[$i]= $modName; $modules[$modName] = $objMod; @@ -400,7 +395,15 @@ foreach ($modulesdir as $dir) $arrayofwarningsext[$modName]=$objMod->warnings_activation_ext; } - $orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number + $familyposition = $familyinfo[$familykey]['position']; + if ($external) + { + // TODO Find a solution so modules with their own family are always at end + //var_dump($familyposition); + //$familyposition += 100; + } + + $orders[$i] = $familyposition."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number $dirmod[$i] = $dir; //print $i.'-'.$dirmod[$i].'
'; // Set categ[$i] @@ -527,6 +530,7 @@ if ($mode == 'common') print '

'; + $object=new stdClass(); $parameters=array(); $reshook=$hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -538,14 +542,13 @@ if ($mode == 'common') foreach ($orders as $key => $value) { $tab=explode('_', $value); - $familyposition=$tab[0]; $familykey=$tab[1]; $module_position=$tab[2]; $numero=$tab[3]; + $familykey=$tab[1]; + $module_position=$tab[2]; $modName = $filename[$key]; $objMod = $modules[$modName]; - $dirofmodule = $dirmod[$key]; //print $objMod->name." - ".$key." - ".$objMod->version."
"; - //if (($mode != (isset($specialtostring[$special])?$specialtostring[$special]:'unknown') && $mode != 'expdev') if ($mode == 'expdev' && $objMod->version != 'development' && $objMod->version != 'experimental') continue; // Discard if not for current tab if (! $objMod->getName()) diff --git a/htdocs/core/modules/modDataPolicy.class.php b/htdocs/core/modules/modDataPolicy.class.php index 488dccd9067..c5169c7f6d1 100644 --- a/htdocs/core/modules/modDataPolicy.class.php +++ b/htdocs/core/modules/modDataPolicy.class.php @@ -59,7 +59,7 @@ class modDataPolicy extends DolibarrModules { // It is used to group modules by family in module setup page $this->family = "technic"; // Module position in the family on 2 digits ('01', '10', '20', ...) - $this->module_position = '81'; + $this->module_position = '78'; // Gives the possibility to the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this) //$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily"))); // Module label (no space allowed), used if translation string 'ModuledatapolicyName' not found (MyModue is name of module). diff --git a/htdocs/core/modules/modDocumentGeneration.class.php b/htdocs/core/modules/modDocumentGeneration.class.php index 8286bca9c82..78832122ff0 100644 --- a/htdocs/core/modules/modDocumentGeneration.class.php +++ b/htdocs/core/modules/modDocumentGeneration.class.php @@ -45,7 +45,7 @@ class modDocumentGeneration extends DolibarrModules $this->numero = 1520; $this->family = "technic"; - $this->module_position = '80'; + $this->module_position = '78'; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i', '', get_class($this)); $this->description = "Direct mail document generation"; diff --git a/htdocs/core/modules/modZapier.class.php b/htdocs/core/modules/modZapier.class.php index ed628110044..fe8f43416f3 100644 --- a/htdocs/core/modules/modZapier.class.php +++ b/htdocs/core/modules/modZapier.class.php @@ -42,14 +42,14 @@ class modZapier extends DolibarrModules $this->db = $db; // Id for module (must be unique). // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). - $this->numero = 792000; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve id number for your module + $this->numero = 50330; // Key text used to identify module (for permissions, menus, etc...) $this->rights_class = 'zapier'; // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...' // It is used to group modules by family in module setup page $this->family = "interface"; // Module position in the family on 2 digits ('01', '10', '20', ...) - $this->module_position = 100; + $this->module_position = '13'; // Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this) //$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily"))); // Module label (no space allowed), used if translation string 'ModuleZapierName' not found (Zapier is name of module). diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index f3f715776b4..f52b7618daa 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -283,7 +283,7 @@ print ''.$langs->trans("Permissions").''; print ''."\n"; //print "xx".$conf->global->MAIN_USE_ADVANCED_PERMS; -$sql = "SELECT r.id, r.libelle, r.module"; +$sql = "SELECT r.id, r.libelle, r.module, r.module_position"; $sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r"; $sql.= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous" $sql.= " AND r.entity = " . $entity; @@ -301,12 +301,24 @@ if ($result) { $obj = $db->fetch_object($result); - // Si la ligne correspond a un module qui n'existe plus (absent de includes/module), on l'ignore + // If line is for a module that doe snot existe anymore (absent of includes/module), we ignore it if (empty($modules[$obj->module])) { $i++; continue; } + + // Fix field module_position in database if value is still zero + if (empty($obj->module_position)) + { + if (is_object($modules[$obj->module]) && ($modules[$obj->module]->module_position > 0)) + { + $sqlupdate = 'UPDATE '.MAIN_DB_PREFIX."rights_def set module_position = ".$modules[$obj->module]->module_position; + $sqlupdate.= " WHERE module_position = 0 AND module = '".$db->escape($obj->module)."'"; + $db->query($sqlupdate); + } + } + if (isset($obj->module) && ($oldmod <> $obj->module)) { $oldmod = $obj->module;