Clean code

This commit is contained in:
Laurent Destailleur 2020-10-02 16:15:24 +02:00
parent 9ea7e26458
commit 03ede71989
10 changed files with 25 additions and 10 deletions

View File

@ -56,11 +56,13 @@ $arrayfields = array(
'name'=>array('label'=>$langs->trans("Modules"), 'checked'=>1, 'position'=>10),
'version'=>array('label'=>$langs->trans("Version"), 'checked'=>1, 'position'=>20),
'id'=>array('label'=>$langs->trans("IdModule"), 'checked'=>1, 'position'=>30),
'module_position'=>array('label'=>$langs->trans("Position"), 'checked'=>1, 'position'=>35),
'permission'=>array('label'=>$langs->trans("IdPermissions"), 'checked'=>1, 'position'=>40)
);
$arrayfields = dol_sort_array($arrayfields, 'position');
/*
* Actions
*/
@ -129,6 +131,7 @@ foreach ($modules as $key=>$module) {
$newModule->name = $module->getName();
$newModule->version = $module->getVersion();
$newModule->id = $key;
$newModule->module_position = $module->module_position;
$alt = $module->name.' - '.$modules_files[$key];
@ -223,6 +226,10 @@ if ($arrayfields['id']['checked']) {
print '<input class="flat" type="text" name="search_id" size="8" value="'.$search_id.'">';
print '</td>';
}
if ($arrayfields['module_position']['checked']) {
print '<td class="liste_titre left">';
print '</td>';
}
if ($arrayfields['permission']['checked']) {
print '<td class="liste_titre left">';
print '<input class="flat" type="text" name="search_permission" size="8" value="'.$search_permission.'">';
@ -247,6 +254,9 @@ if ($arrayfields['version']['checked']) {
if ($arrayfields['id']['checked']) {
print_liste_field_titre($arrayfields['id']['label'], $_SERVER["PHP_SELF"], "id", "", "", "", $sortfield, $sortorder);
}
if ($arrayfields['module_position']['checked']) {
print_liste_field_titre($arrayfields['module_position']['label'], $_SERVER["PHP_SELF"], "module_position", "", "", "", $sortfield, $sortorder);
}
if ($arrayfields['permission']['checked']) {
print_liste_field_titre($arrayfields['permission']['label'], $_SERVER["PHP_SELF"], "permission", "", "", "", $sortfield, $sortorder);
}
@ -273,6 +283,8 @@ if ($sortfield == "id" && $sortorder == "desc") usort($moduleList, "compareIdDes
if ($sortfield == "permission" && $sortorder == "asc") usort($moduleList, "comparePermissionIdsAsc");
if ($sortfield == "permission" && $sortorder == "desc") usort($moduleList, "comparePermissionIdsDesc");
$moduleList = dol_sort_array($moduleList, 'module_position');
foreach ($moduleList as $module) {
print '<tr class="oddeven">';
@ -291,6 +303,10 @@ foreach ($moduleList as $module) {
print '<td class="center">'.$module->id.'</td>';
}
if ($arrayfields['module_position']['checked']) {
print '<td class="center">'.$module->module_position.'</td>';
}
if ($arrayfields['permission']['checked']) {
$idperms = '';

View File

@ -54,7 +54,7 @@ class modBom extends DolibarrModules
// It is used to group modules by family in module setup page
$this->family = "products";
// Module position in the family on 2 digits ('01', '10', '20', ...)
$this->module_position = '60';
$this->module_position = '65';
// 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")));

View File

@ -46,12 +46,11 @@ class modCashDesk extends DolibarrModules
$this->rights_class = 'cashdesk';
$this->family = "portal";
$this->module_position = '55';
$this->module_position = '59';
// 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";
$this->revision = '1.27';
$this->version = 'dolibarr';
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);

View File

@ -45,7 +45,7 @@ class modDeplacement extends DolibarrModules
$this->numero = 75;
$this->family = "hr";
$this->module_position = '41';
$this->module_position = '43';
// 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 notes de frais et deplacements"; // Si traduction Module75Desc non trouvee

View File

@ -52,7 +52,7 @@ class modEmailCollector extends DolibarrModules
// 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 = '12';
$this->module_position = '23';
// 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")));

View File

@ -48,7 +48,7 @@ class modMailing extends DolibarrModules
// 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 = '11';
$this->module_position = '22';
// 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));

View File

@ -52,7 +52,7 @@ class modMrp extends DolibarrModules
// It is used to group modules by family in module setup page
$this->family = "products";
// Module position in the family on 2 digits ('01', '10', '20', ...)
$this->module_position = '62';
$this->module_position = '66';
// 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 'ModuleMrpName' not found (Mrp is name of module).

View File

@ -51,7 +51,7 @@ class modProduct extends DolibarrModules
$this->numero = 50;
$this->family = "products";
$this->module_position = '25';
$this->module_position = '26';
// 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 = "Product management";

View File

@ -52,7 +52,7 @@ class modRecruitment extends DolibarrModules
// It is used to group modules by family in module setup page
$this->family = "hr";
// Module position in the family on 2 digits ('01', '10', '20', ...)
$this->module_position = '51';
$this->module_position = '44';
// 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 'ModuleRecruitmentName' not found (Recruitment is name of module).

View File

@ -41,7 +41,7 @@ class modWebServicesClient extends DolibarrModules
$this->numero = 2660;
$this->family = "interface";
$this->module_position = '26';
$this->module_position = '25';
// 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 web service client to call external supplier web services";