Debug v23

This commit is contained in:
Laurent Destailleur
2025-11-12 15:03:31 +01:00
parent ad165e3712
commit 9e7fedfec5
10 changed files with 301 additions and 234 deletions

View File

@@ -518,8 +518,6 @@ $i = 0; // is a sequencer of modules found
$j = 0; // j is module number. Automatically affected if module number not defined. $j = 0; // j is module number. Automatically affected if module number not defined.
$modNameLoaded = array(); $modNameLoaded = array();
$listOfOfficialModuleGroups = array('hr', 'technic', 'interface', 'technic', 'portal', 'financial', 'crm', 'base', 'products', 'srm', 'ecm', 'projects', 'other');
//if ($mode == 'common' || $mode == 'commonkanban') { //if ($mode == 'common' || $mode == 'commonkanban') {
// Load $modules (required for the badge count) // Load $modules (required for the badge count)
foreach ($modulesdir as $dir) { foreach ($modulesdir as $dir) {
@@ -619,7 +617,7 @@ foreach ($modulesdir as $dir) {
} }
$familyposition = (empty($familyinfo[$familykey]['position']) ? '0' : $familyinfo[$familykey]['position']); $familyposition = (empty($familyinfo[$familykey]['position']) ? '0' : $familyinfo[$familykey]['position']);
if ($external && !in_array($familykey, $listOfOfficialModuleGroups)) { if ($external && !in_array($familykey, array_keys($familyinfo))) {
// If module is extern and into a custom group (not into an official predefined one), it must appear at end (custom groups should not be before official groups). // If module is extern and into a custom group (not into an official predefined one), it must appear at end (custom groups should not be before official groups).
if (is_numeric($familyposition)) { if (is_numeric($familyposition)) {
$familyposition = sprintf("%03d", (int) $familyposition + 100); $familyposition = sprintf("%03d", (int) $familyposition + 100);

View File

@@ -26,12 +26,6 @@
// Load Dolibarr environment // Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
if (empty($user->admin)) {
accessforbidden();
}
/** /**
* @var Conf $conf * @var Conf $conf
* @var DoliDB $db * @var DoliDB $db
@@ -39,6 +33,11 @@ if (empty($user->admin)) {
* @var Translate $langs * @var Translate $langs
* @var User $user * @var User $user
*/ */
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
if (empty($user->admin)) {
accessforbidden();
}
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("install", "other", "admin")); $langs->loadLangs(array("install", "other", "admin"));
@@ -52,6 +51,7 @@ $search_id = GETPOST("search_id", 'alpha');
$search_version = GETPOST("search_version", 'alpha'); $search_version = GETPOST("search_version", 'alpha');
$search_permission = GETPOST("search_permission", 'alpha'); $search_permission = GETPOST("search_permission", 'alpha');
$page = GETPOSTINT('page');
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma');

View File

@@ -767,7 +767,7 @@ function dol_fileperm($pathoffile)
* @param string $destfile Destination file (can't be a directory). If empty, will be same than source file. * @param string $destfile Destination file (can't be a directory). If empty, will be same than source file.
* @param string $newmask Mask for new file. '0' by default means getDolGlobalString('MAIN_UMASK'). Example: '0666'. * @param string $newmask Mask for new file. '0' by default means getDolGlobalString('MAIN_UMASK'). Example: '0666'.
* @param int $indexdatabase 1=index new file into database. * @param int $indexdatabase 1=index new file into database.
* @param int $arrayreplacementisregex 1=Array of replacement is already an array with key that is a regex. Warning: the key must be escaped with preg_quote for '/' * @param int $arrayreplacementisregex 1=Array of replacement is already an array with key that is a regex. Warning: the key must be escaped with preg_quote for '/' and include the starting/ending '/' in string.
* @return int Return integer <0 if error, 0 if nothing done (dest file already exists), >0 if OK * @return int Return integer <0 if error, 0 if nothing done (dest file already exists), >0 if OK
* @see dol_copy(), dolCopyDir() * @see dol_copy(), dolCopyDir()
*/ */

View File

@@ -5421,7 +5421,8 @@ function getPictoForType($key, $morecss = '')
* Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img * Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img
* Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img * Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img
* Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1) * Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1)
* Example: fontawesome_envelope-open-text_fas_red_1em if you want to use fontaweseome icons: fontawesome_<icon-name>_<style>_<color>_<size> (only icon-name is mandatory) * Example: fa-value if you want to use fontaweseome icons: fa-<icon-name>
* Example: fa-value_fas_color_1em if you want to use fontaweseome icons: fa-<icon-name>_<style>_<color>_<size> (only icon-name is mandatory, color can be 'red' or '#FF0000')
* @param string $moreatt Add more attribute on img tag (For example 'class="pictofixedwidth"') * @param string $moreatt Add more attribute on img tag (For example 'class="pictofixedwidth"')
* @param int<0,1> $pictoisfullpath If true or 1, image path is a full path, 0 if not * @param int<0,1> $pictoisfullpath If true or 1, image path is a full path, 0 if not
* @param int $srconly Return only content of the src attribute of img. * @param int $srconly Return only content of the src attribute of img.
@@ -5568,7 +5569,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $srco
if (in_array($pictowithouttext, array('dollyrevert', 'member', 'members', 'contract', 'group', 'resource', 'shipment', 'reception'))) { if (in_array($pictowithouttext, array('dollyrevert', 'member', 'members', 'contract', 'group', 'resource', 'shipment', 'reception'))) {
$morecss .= ' em092'; $morecss .= ' em092';
} }
if (in_array($pictowithouttext, array('conferenceorbooth', 'collab', 'eventorganization', 'holiday', 'info', 'info_black', 'project', 'workstation'))) { if (in_array($pictowithouttext, array('conferenceorbooth', 'eventorganization', 'holiday', 'info', 'info_black', 'project', 'workstation'))) {
$morecss .= ' em088'; $morecss .= ' em088';
} }
if (in_array($pictowithouttext, array('asset', 'intervention', 'payment', 'loan', 'partnership', 'stock', 'technic'))) { if (in_array($pictowithouttext, array('asset', 'intervention', 'payment', 'loan', 'partnership', 'stock', 'technic'))) {
@@ -5631,10 +5632,9 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $srco
'bookcal' => 'infobox-action', 'bookcal' => 'infobox-action',
'margin' => 'infobox-bank_account', 'margin' => 'infobox-bank_account',
'conferenceorbooth' => 'infobox-project', 'conferenceorbooth' => 'infobox-project',
'cash-register' => 'infobox-bank_account', 'cash-register' => 'infobox-portal',
'contract' => 'infobox-contrat', 'contract' => 'infobox-contrat',
'check' => 'font-status4', 'check' => 'font-status4',
'collab' => 'infobox-action',
'conversation' => 'infobox-contrat', 'conversation' => 'infobox-contrat',
'donation' => 'infobox-commande', 'donation' => 'infobox-commande',
'dolly' => 'infobox-commande', 'dolly' => 'infobox-commande',
@@ -5645,6 +5645,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $srco
'group' => 'infobox-adherent', 'group' => 'infobox-adherent',
'intervention' => 'infobox-contrat', 'intervention' => 'infobox-contrat',
'incoterm' => 'infobox-supplier_proposal', 'incoterm' => 'infobox-supplier_proposal',
'intracommreport' => 'infobox-bank_account',
'currency' => 'infobox-bank_account', 'currency' => 'infobox-bank_account',
'multicurrency' => 'infobox-bank_account', 'multicurrency' => 'infobox-bank_account',
'members' => 'infobox-adherent', 'members' => 'infobox-adherent',
@@ -5668,7 +5669,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $srco
'loan' => 'infobox-bank_account', 'loan' => 'infobox-bank_account',
'payment' => 'infobox-bank_account', 'payment' => 'infobox-bank_account',
'payment_vat' => 'infobox-bank_account', 'payment_vat' => 'infobox-bank_account',
'poll' => 'infobox-adherent', 'poll' => 'infobox-portal',
'pos' => 'infobox-bank_account', 'pos' => 'infobox-bank_account',
'project' => 'infobox-project', 'project' => 'infobox-project',
'projecttask' => 'infobox-project', 'projecttask' => 'infobox-project',
@@ -5682,6 +5683,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $srco
'salary' => 'infobox-bank_account', 'salary' => 'infobox-bank_account',
'shapes' => 'infobox-adherent', 'shapes' => 'infobox-adherent',
'shipment' => 'infobox-commande', 'shipment' => 'infobox-commande',
'store' => 'infobox-portal',
'stripe' => 'infobox-bank_account', 'stripe' => 'infobox-bank_account',
'supplier_invoice' => 'infobox-order_supplier', 'supplier_invoice' => 'infobox-order_supplier',
'supplier_invoicea' => 'infobox-order_supplier', 'supplier_invoicea' => 'infobox-order_supplier',
@@ -5696,6 +5698,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $srco
'trip' => 'infobox-expensereport', 'trip' => 'infobox-expensereport',
'title_agenda' => 'infobox-action', 'title_agenda' => 'infobox-action',
'vat' => 'infobox-bank_account', 'vat' => 'infobox-bank_account',
'webportal' => 'infobox-portal',
//'title_setup'=>'infobox-action', 'tools'=>'infobox-action', //'title_setup'=>'infobox-action', 'tools'=>'infobox-action',
'list-alt' => 'imgforviewmode', 'list-alt' => 'imgforviewmode',
'calendar' => 'imgforviewmode', 'calendar' => 'imgforviewmode',

View File

@@ -38,14 +38,12 @@ class modCollab extends DolibarrModules
*/ */
public function __construct($db) public function __construct($db)
{ {
global $langs, $conf;
$this->db = $db; $this->db = $db;
$this->numero = 30000; $this->numero = 30000;
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page // It is used to group modules in module setup page
$this->family = "portal"; $this->family = "ecm";
$this->module_position = '51'; $this->module_position = '51';
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) // 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->name = preg_replace('/^mod/i', '', get_class($this));

View File

@@ -82,7 +82,7 @@ class modWebPortal extends DolibarrModules
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
// To use a supported fa-xxx css style of font awesome, use this->picto='xxx' // To use a supported fa-xxx css style of font awesome, use this->picto='xxx'
$this->picto = 'fa-door-open'; $this->picto = 'webportal';
// Define some features supported by module (triggers, login, substitutions, menus, css, etc...) // Define some features supported by module (triggers, login, substitutions, menus, css, etc...)
$this->module_parts = array( $this->module_parts = array(

View File

@@ -18,6 +18,7 @@ ErrorRecordNotFoundShort=Not found
ErrorFailToCopyFile=Failed to copy file '<b>%s</b>' into '<b>%s</b>'. ErrorFailToCopyFile=Failed to copy file '<b>%s</b>' into '<b>%s</b>'.
ErrorFailToCopyDir=Failed to copy directory '<b>%s</b>' into '<b>%s</b>'. ErrorFailToCopyDir=Failed to copy directory '<b>%s</b>' into '<b>%s</b>'.
ErrorFailToRenameFile=Failed to rename file '<b>%s</b>' into '<b>%s</b>'. ErrorFailToRenameFile=Failed to rename file '<b>%s</b>' into '<b>%s</b>'.
ErrorFailToEditFile=Failed to edit file '<b>%s</b>'.
ErrorFailToDeleteFile=Failed to remove file '<b>%s</b>'. ErrorFailToDeleteFile=Failed to remove file '<b>%s</b>'.
ErrorFailToCreateFile=Failed to create file '<b>%s</b>'. ErrorFailToCreateFile=Failed to create file '<b>%s</b>'.
ErrorFailToRenameDir=Failed to rename directory '<b>%s</b>' into '<b>%s</b>'. ErrorFailToRenameDir=Failed to rename directory '<b>%s</b>' into '<b>%s</b>'.

View File

@@ -3144,27 +3144,41 @@ if ($dirins && $action == "update_props_module" && !empty(GETPOST('keydescriptio
if (isset($propertyToUpdate) && !empty(GETPOST('propsmodule'))) { if (isset($propertyToUpdate) && !empty(GETPOST('propsmodule'))) {
$newValue = GETPOST('propsmodule'); $newValue = GETPOST('propsmodule');
$lineToReplace = "\t\t\$this->$propertyToUpdate = "; $patternToFindLine = '^\s*\$this->'.$propertyToUpdate.'\s*='; // Must be a regex string
$newLine = "\t\t\$this->$propertyToUpdate = '$newValue';\n"; $newLine = "\t\t\$this->$propertyToUpdate = '$newValue';\n"; // Must a real string
//for change version in log file $fileLines = file($moduledescriptorfile); // Get each line of file into an array
if ($propertyToUpdate === 'version') { $error = 0;
dolReplaceInFile($modulelogfile, array("## ".$moduleobj->$propertyToUpdate => $newValue)); $changedone = 0;
}
$fileLines = file($moduledescriptorfile);
foreach ($fileLines as &$line) { foreach ($fileLines as &$line) {
if (strpos($line, $lineToReplace) === 0) { if (preg_match('/'.$patternToFindLine.'/', $line)) {
dolReplaceInFile($moduledescriptorfile, array($line => $newLine)); $result = dolReplaceInFile($moduledescriptorfile, array($line => $newLine));
if ($result > 0) {
$changedone++;
} elseif ($result <= -1) {
$langs->load("errors");
setEventMessages($langs->trans('ErrorFailToEditFile', $moduledescriptorfile), null, 'warnings');
break; break;
} }
break;
}
}
// To complete also the ChangeLogif we update the version
if ($changedone && $propertyToUpdate === 'version') {
dolReplaceInFile($modulelogfile, array("## ".$moduleobj->$propertyToUpdate => $newValue));
} }
clearstatcache(true); clearstatcache(true);
if (function_exists('opcache_invalidate')) { if (function_exists('opcache_invalidate')) {
opcache_reset(); opcache_reset();
} }
if ($changedone) {
setEventMessages($langs->trans('PropertyModuleUpdated', $propertyToUpdate), null); setEventMessages($langs->trans('PropertyModuleUpdated', $propertyToUpdate), null);
} else {
setEventMessages($langs->trans('NothingProcessed'), null, 'warnings');
}
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=description&module='.$module); header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=description&module='.$module);
exit; exit;
} }
@@ -3470,8 +3484,9 @@ if ($module == 'initmodule') {
print '<input type="text" name="idpicto" value="'.(GETPOSTISSET('idpicto') ? GETPOST('idpicto') : getDolGlobalString('MODULEBUILDER_DEFAULTPICTO', 'fa-file')).'" placeholder="'.dol_escape_htmltag($langs->trans("Picto")).'">'; print '<input type="text" name="idpicto" value="'.(GETPOSTISSET('idpicto') ? GETPOST('idpicto') : getDolGlobalString('MODULEBUILDER_DEFAULTPICTO', 'fa-file')).'" placeholder="'.dol_escape_htmltag($langs->trans("Picto")).'">';
print $form->textwithpicto('', $langs->trans("Example").': fa-file, fa-globe, ... any font awesome code.<br>Advanced syntax is fa-fakey[_faprefix[_facolor[_fasize]]]'); print $form->textwithpicto('', $langs->trans("Example").': fa-file, fa-globe, ... any font awesome code.<br>Advanced syntax is fa-fakey[_faprefix[_facolor[_fasize]]]');
print '<span class="opacitymedium small">';
print ' &nbsp; &nbsp; '; print ' &nbsp; &nbsp; ';
print '<span class="opacitymedium small">';
print dolButtonToOpenUrlInDialogPopup('popup_picto_id', $langs->transnoentitiesnoconv("DocIconsList"), $langs->transnoentitiesnoconv("DocIconsList"), '/admin/tools/ui/components/icons.php?hidenavmenu=1&displayMode=icon-only&mode=no-btn#img-picto-section-list', '', ''); print dolButtonToOpenUrlInDialogPopup('popup_picto_id', $langs->transnoentitiesnoconv("DocIconsList"), $langs->transnoentitiesnoconv("DocIconsList"), '/admin/tools/ui/components/icons.php?hidenavmenu=1&displayMode=icon-only&mode=no-btn#img-picto-section-list', '', '');
print '</span>'; print '</span>';
@@ -3786,13 +3801,23 @@ if ($module == 'initmodule') {
} }
print '</td></tr>'; print '</td></tr>';
print '<!-- picto of module -->'."\n";
print '<tr><td>'; print '<tr><td>';
print $langs->trans("Picto"); print $langs->trans("Picto");
print '</td><td>'; print '</td><td>';
if ($action == 'edit_modulepicto' && GETPOST('keydescription', 'alpha') === 'picto') { if ($action == 'edit_modulepicto' && GETPOST('keydescription', 'alpha') === 'picto') {
print '<input class="minwidth500" name="propsmodule" value="'.dol_escape_htmltag($moduleobj->picto).'">'; print '<input class="minwidth200 maxwidth500" name="propsmodule" value="'.dol_escape_htmltag($moduleobj->picto).'">';
print $form->textwithpicto('', $langs->trans("Example").': fa-file, fa-globe, ... any font awesome code.<br>Advanced syntax is fa-fakey[_faprefix[_facolor[_fasize]]] where faprefix can be far,far, facolor can be a text like \'red\' orvalue like \'#FF0000\' and fasize is CSS font size like \'1em\'');
print '<input class="reposition button smallpaddingimp" type="submit" name="modifypicto" value="'.$langs->trans("Modify").'"/>'; print '<input class="reposition button smallpaddingimp" type="submit" name="modifypicto" value="'.$langs->trans("Modify").'"/>';
print '<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans("Cancel").'"/>'; print '<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans("Cancel").'"/>';
print ' &nbsp; &nbsp; ';
print '<span class="opacitymedium small">';
print dolButtonToOpenUrlInDialogPopup('popup_picto_id', $langs->transnoentitiesnoconv("DocIconsList"), $langs->transnoentitiesnoconv("DocIconsList"), '/admin/tools/ui/components/icons.php?hidenavmenu=1&displayMode=icon-only&mode=no-btn#img-picto-section-list', '', '');
print '</span>';
} else { } else {
print $moduleobj->picto; print $moduleobj->picto;
print ' &nbsp; '.img_picto('', $moduleobj->picto, 'class="valignmiddle pictomodule paddingrightonly"'); print ' &nbsp; '.img_picto('', $moduleobj->picto, 'class="valignmiddle pictomodule paddingrightonly"');
@@ -4061,7 +4086,7 @@ if ($module == 'initmodule') {
print '</div><div class="tagtd">'; print '</div><div class="tagtd">';
print '<input type="text" name="idpicto" value="fa-file" placeholder="'.dol_escape_htmltag($langs->trans("Picto")).'">'; print '<input type="text" name="idpicto" value="fa-file" placeholder="'.dol_escape_htmltag($langs->trans("Picto")).'">';
print $form->textwithpicto('', $langs->trans("Example").': fa-file, fa-globe, ... any font awesome code.<br>Advanced syntax is fa-fakey[_faprefix[_facolor[_fasize]]]'); print $form->textwithpicto('', $langs->trans("Example").': fa-file, fa-globe, ... any font awesome code.<br>Advanced syntax is fa-fakey[_faprefix[_facolor[_fasize]]] where faprefix can be far,far, facolor can be a text like \'red\' orvalue like \'#FF0000\' and fasize is CSS font size like \'1em\'');
print '<span class="opacitymedium small">'; print '<span class="opacitymedium small">';
print ' &nbsp; &nbsp; '; print ' &nbsp; &nbsp; ';

View File

@@ -482,6 +482,9 @@ a.vmenu span, span.vmenu, span.vmenu span {
.infobox-holiday{ .infobox-holiday{
color: #755114; color: #755114;
} }
.infobox-portal {
color: #304;
}
.fa-dol-action:before { .fa-dol-action:before {

View File

@@ -198,7 +198,7 @@ $sql = "SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module
$sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r"; $sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r";
$sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // We ignore permission "tous les tiers". Why ? $sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // We ignore permission "tous les tiers". Why ?
$sql .= " AND r.entity = ".((int) $entity); $sql .= " AND r.entity = ".((int) $entity);
$sql .= " ORDER BY r.family_position, r.module_position, r.module, r.id"; $sql .= " ORDER BY r.family, r.family_position, r.module_position, r.module, r.id";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result) {
@@ -462,17 +462,32 @@ print '<a class="hideallperms" title="'.dol_escape_htmltag($langs->trans("HideAl
print '</td>'; print '</td>';
print '</tr>'."\n"; print '</tr>'."\n";
// Get list of all permissions
//print "xx".$conf->global->MAIN_USE_ADVANCED_PERMS; $sql = "SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.bydefault, r.family, r.family_position";
$sql = "SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.bydefault";
$sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r"; $sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r";
$sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous" $sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // We ignore permission "tous les tiers". Why ?
$sql .= " AND r.entity = ".((int) $entity); $sql .= " AND r.entity = ".((int) $entity);
if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) { if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
$sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled
} }
$sql .= " ORDER BY r.family_position, r.module_position, r.module, r.id"; $sql .= " ORDER BY r.family_position, r.module_position, r.module, r.id";
$familyinfo = array(
'hr' => array('position' => '001', 'label' => $langs->trans("ModuleFamilyHr")),
'crm' => array('position' => '006', 'label' => $langs->trans("ModuleFamilyCrm")),
'srm' => array('position' => '007', 'label' => $langs->trans("ModuleFamilySrm")),
'financial' => array('position' => '009', 'label' => $langs->trans("ModuleFamilyFinancial")),
'products' => array('position' => '012', 'label' => $langs->trans("ModuleFamilyProducts")),
'projects' => array('position' => '015', 'label' => $langs->trans("ModuleFamilyProjects")),
'ecm' => array('position' => '018', 'label' => $langs->trans("ModuleFamilyECM")),
'technic' => array('position' => '021', 'label' => $langs->trans("ModuleFamilyTechnic")),
'portal' => array('position' => '040', 'label' => $langs->trans("ModuleFamilyPortal")),
'interface' => array('position' => '050', 'label' => $langs->trans("ModuleFamilyInterface")),
'base' => array('position' => '060', 'label' => $langs->trans("ModuleFamilyBase")),
'other' => array('position' => '100', 'label' => $langs->trans("ModuleFamilyOther")),
);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result) {
$num = $db->num_rows($result); $num = $db->num_rows($result);
@@ -487,6 +502,33 @@ if ($result) {
while ($i < $num) { while ($i < $num) {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
if (empty($obj->family)) {
$obj->family = 'other';
}
if (empty($obj->family_position)) {
$obj->family_position = $familyinfo[$obj->family]['position'];
if ($obj->module_position < 100000) {
$obj->module_position = intval($obj->module_position) + 100000;
} else {
$obj->module_position = intval($obj->module_position);
}
}
$obj->position = $obj->family_position.'_'.$obj->module_position.'_'.$obj->id;
$arrayofpermission[$i] = $obj;
$i++;
}
} else {
dol_print_error($db);
}
$arrayofpermission = dol_sort_array($arrayofpermission, 'position');
foreach ($arrayofpermission as $i => $obj) {
// If line is for a module that does not exist anymore (absent of includes/module), we ignore it // If line is for a module that does not exist anymore (absent of includes/module), we ignore it
if (empty($modules[$obj->module])) { if (empty($modules[$obj->module])) {
$i++; $i++;
@@ -748,9 +790,6 @@ if ($result) {
print '</tr>'."\n"; print '</tr>'."\n";
$i++; $i++;
}
} else {
dol_print_error($db);
} }
print '</table>'; print '</table>';
print '</div>'; print '</div>';