NEW Introduce property module_position so a module can decide where it

appears into list of modules.
This commit is contained in:
Laurent Destailleur 2015-11-17 00:58:12 +01:00
parent dfc01e971f
commit f5631cac45
33 changed files with 59 additions and 10 deletions

View File

@ -53,6 +53,7 @@ class modMyModule extends DolibarrModules
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page
$this->family = "other";
$this->module_position = 500;
// 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));
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)

View File

@ -164,10 +164,15 @@ foreach ($modulesdir as $dir)
$special = $objMod->special;
$familykey = $objMod->family;
$moduleposition = ($objMod->module_position?$objMod->module_position:'500');
if ($moduleposition == 500 && ($objMod->isCoreOrExternalModule() == 'external'))
{
$moduleposition = 800;
}
if ($special == 1) $familykey='interface';
$orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$j; // Sort by family, then by module number
$orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number
$dirmod[$i] = $dir;
// Set categ[$i]
$specialstring = isset($specialtostring[$special])?$specialtostring[$special]:'unknown';
@ -312,7 +317,7 @@ if ($mode != 'marketplace')
foreach ($orders as $key => $value)
{
$tab=explode('_',$value);
$familypos=$tab[0]; $familykey=$tab[1]; $numero=$tab[2];
$familyposition=$tab[0]; $familykey=$tab[1]; $module_position=$tab[2]; $numero=$tab[3];
$modName = $filename[$key];
$objMod = $modules[$key];
@ -426,12 +431,13 @@ if ($mode != 'marketplace')
}
else
{
print '<a class="reposition" href="modules.php?id='.$objMod->numero.'&amp;action=reset&amp;value=' . $modName . '&amp;mode=' . $mode . '">';
print '<a class="reposition" href="modules.php?id='.$objMod->numero.'&amp;module_position='.$module_position.'&amp;action=reset&amp;value=' . $modName . '&amp;mode=' . $mode . '">';
print img_picto($langs->trans("Activated"),'switch_on');
print '</a>';
}
print '</td>'."\n";
// Config link
if (! empty($objMod->config_page_url) && !$disableSetup)
{
if (is_array($objMod->config_page_url))
@ -489,7 +495,7 @@ if ($mode != 'marketplace')
else
{
// Module non actif
print '<a class="reposition" href="modules.php?id='.$objMod->numero.'&amp;action=set&amp;value=' . $modName . '&amp;mode=' . $mode . '">';
print '<a class="reposition" href="modules.php?id='.$objMod->numero.'&amp;module_position='.$module_position.'&amp;action=set&amp;value=' . $modName . '&amp;mode=' . $mode . '">';
print img_picto($langs->trans("Disabled"),'switch_off');
print "</a>\n";
}

View File

@ -34,21 +34,31 @@
*/
class DolibarrModules // Can not be abstract, because we need to instantiant it into unActivateModule to be able to disable a module whose files were removed.
{
/**
* @var DoliDb Database handler
*/
public $db;
/**
* @var int Module unique ID
*/
public $numero;
/**
* @var string Family
*/
public $family;
/**
* @var int module_position
*/
public $module_position=500;
/**
* @var string Module name
*/
public $name;
/**
* @var DoliDb Database handler
*/
public $db;
/**
* @var array Paths to create when module is activated
*/

View File

@ -44,6 +44,7 @@ class modAccounting extends DolibarrModules
$this->numero = 50400;
$this->family = "financial";
$this->module_position = 610;
// 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 = "Advanced accounting management";

View File

@ -49,6 +49,7 @@ class modAdherent extends DolibarrModules
$this->numero = 310;
$this->family = "hr";
$this->module_position = 20;
// 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 = "Management of members of a foundation or association";

View File

@ -50,6 +50,7 @@ class modAgenda extends DolibarrModules
$this->numero = 2400;
$this->family = "projects";
$this->module_position = 15;
// 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 = "Gestion de l'agenda et des actions";

View File

@ -49,6 +49,7 @@ class modBanque extends DolibarrModules
$this->numero = 85;
$this->family = "financial";
$this->module_position = 510;
// 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 = "Gestion des comptes financiers de type Comptes bancaires ou postaux";

View File

@ -46,6 +46,7 @@ class modCashDesk extends DolibarrModules
$this->rights_class = 'cashdesk';
$this->family = "portal";
$this->module_position = 10;
// 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 = "CashDesk module";

View File

@ -51,6 +51,7 @@ class modCommande extends DolibarrModules
$this->numero = 25;
$this->family = "crm";
$this->module_position = 30;
// 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 = "Gestion des commandes clients";

View File

@ -48,6 +48,7 @@ class modComptabilite extends DolibarrModules
$this->numero = 10;
$this->family = "financial";
$this->module_position = 600;
// 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 = "Gestion sommaire de comptabilite";

View File

@ -45,6 +45,7 @@ class modDocumentGeneration extends DolibarrModules
$this->numero = 1520;
$this->family = "technic";
$this->module_position = 10000;
// 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";

View File

@ -48,6 +48,7 @@ class modECM extends DolibarrModules
// Family can be 'crm','financial','hr','projects','product','ecm','technic','other'
// It is used to sort modules in module setup page
$this->family = "ecm";
$this->module_position = 10;
// 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));
// Module description used if translation string 'ModuleXXXDesc' not found (XXX is id value)

View File

@ -49,6 +49,7 @@ class modExpedition extends DolibarrModules
$this->numero = 80;
$this->family = "crm";
$this->module_position = 40;
// 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 = "Gestion des expeditions";

View File

@ -52,6 +52,7 @@ class modExpenseReport extends DolibarrModules
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page
$this->family = "hr";
$this->module_position = 40;
// 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));
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)

View File

@ -48,6 +48,7 @@ class modFacture extends DolibarrModules
$this->numero = 30;
$this->family = "financial";
$this->module_position = 10;
// 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 = "Gestion des factures";

View File

@ -48,6 +48,7 @@ class modFournisseur extends DolibarrModules
$this->numero = 40;
$this->family = "products";
$this->module_position = 10;
// 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 = "Gestion des fournisseurs";

View File

@ -53,6 +53,7 @@ class modHoliday extends DolibarrModules
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page
$this->family = "hr";
$this->module_position = 30;
// 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));
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)

View File

@ -48,6 +48,7 @@ class modMargin extends DolibarrModules
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page
$this->family = "financial";
$this->module_position = 550;
// 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));
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)

View File

@ -47,6 +47,7 @@ class modOauth extends DolibarrModules
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page
$this->family = "technic";
$this->module_position = 510;
// 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));
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)

View File

@ -52,6 +52,7 @@ class modOpenSurvey extends DolibarrModules
// Family can be 'crm','financial','hr','projects','product','technic','other'
// It is used to group modules in module setup page
$this->family = "projects";
$this->module_position = 40;
// 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));
// Module description used if translation string 'ModuleXXXDesc' not found (XXX is value MyModule)

View File

@ -48,6 +48,7 @@ class modPrelevement extends DolibarrModules
$this->numero = 57;
$this->family = "financial";
$this->module_position = 520;
// 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 = "Gestion des Prelevements";

View File

@ -47,6 +47,7 @@ class modPrinting extends DolibarrModules
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page
$this->family = "technic";
$this->module_position = 520;
// 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));
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)

View File

@ -50,6 +50,7 @@ class modProduct extends DolibarrModules
$this->numero = 50;
$this->family = "products";
$this->module_position = 20;
// 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 = "Gestion des produits";

View File

@ -46,6 +46,8 @@ class modProductBatch extends DolibarrModules
$this->numero = 39000;
$this->family = "products";
$this->module_position = 45;
$this->name = preg_replace('/^mod/i','',get_class($this));
$this->description = "Batch number, eat-by and sell-by date management module";

View File

@ -50,6 +50,7 @@ class modProjet extends DolibarrModules
$this->numero = 400;
$this->family = "projects";
$this->module_position = 10;
// 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 = "Gestion des projets";

View File

@ -49,6 +49,7 @@ class modPropale extends DolibarrModules
$this->numero = 20;
$this->family = "crm";
$this->module_position = 20;
// 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 = "Gestion des propositions commerciales";

View File

@ -47,6 +47,7 @@ class modReceiptPrinter extends DolibarrModules
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page
$this->family = "technic";
$this->module_position = 530;
// 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));
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)

View File

@ -47,12 +47,14 @@ class modResource extends DolibarrModules
// Use a free id here
// (See in Home -> System information -> Dolibarr for list of used modules id).
$this->numero = 63000;
// Key text used to identify module (for permissions, menus, etc...)
$this->rights_class = 'resource';
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page
$this->family = "projects";
$this->module_position = 20;
// Module label (no space allowed)
// used if translation string 'ModuleXXXName' not found
// (where XXX is value of numeric property 'numero' of module)

View File

@ -48,6 +48,7 @@ class modService extends DolibarrModules
$this->numero = 53;
$this->family = "products";
$this->module_position = 30;
// 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 = "Gestion des services";

View File

@ -49,6 +49,7 @@ class modSociete extends DolibarrModules
$this->numero = 1;
$this->family = "crm";
$this->module_position = 10;
// 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 = "Gestion des societes et contacts";

View File

@ -48,6 +48,7 @@ class modStock extends DolibarrModules
$this->numero = 52;
$this->family = "products";
$this->module_position = 40;
// 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 = "Gestion des stocks";

View File

@ -46,6 +46,7 @@ class modUser extends DolibarrModules
$this->numero = 0;
$this->family = "hr"; // Family for module (or "base" if core module)
$this->module_position = 10;
// 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 = "Gestion des utilisateurs (requis)";

View File

@ -42,10 +42,11 @@ class modWebsite extends DolibarrModules
$this->db = $db;
$this->numero = 10000;
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page
$this->family = "portal";
$this->module_position = 20;
// 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 = "Enable the public website with CMS features";