mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-07 18:18:18 +01:00
Debug v23
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
@@ -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');
|
||||||
|
|
||||||
|
|||||||
@@ -762,13 +762,13 @@ function dol_fileperm($pathoffile)
|
|||||||
/**
|
/**
|
||||||
* Make replacement of strings into a file.
|
* Make replacement of strings into a file.
|
||||||
*
|
*
|
||||||
* @param string $srcfile Source file (can't be a directory)
|
* @param string $srcfile Source file (can't be a directory)
|
||||||
* @param array<string,string|int> $arrayreplacement Array with strings to replace. Example: array('valuebefore'=>'valueafter', ...)
|
* @param array<string,string|int> $arrayreplacement Array with strings to replace. Example: array('valuebefore'=>'valueafter', ...)
|
||||||
* @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()
|
||||||
*/
|
*/
|
||||||
function dolReplaceInFile($srcfile, $arrayreplacement, $destfile = '', $newmask = '0', $indexdatabase = 0, $arrayreplacementisregex = 0)
|
function dolReplaceInFile($srcfile, $arrayreplacement, $destfile = '', $newmask = '0', $indexdatabase = 0, $arrayreplacementisregex = 0)
|
||||||
|
|||||||
@@ -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',
|
||||||
|
|||||||
@@ -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));
|
||||||
|
|||||||
@@ -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(
|
||||||
|
|||||||
@@ -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>'.
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
setEventMessages($langs->trans('PropertyModuleUpdated', $propertyToUpdate), null);
|
if ($changedone) {
|
||||||
|
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 ' ';
|
print ' ';
|
||||||
|
|
||||||
|
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 ' ';
|
||||||
|
|
||||||
|
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 ' '.img_picto('', $moduleobj->picto, 'class="valignmiddle pictomodule paddingrightonly"');
|
print ' '.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 ' ';
|
print ' ';
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -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,27 +502,78 @@ 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++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Special cases
|
||||||
|
if (isModEnabled("reception")) {
|
||||||
|
// The 2 permission in fournisseur modules has been replaced by permissions into reception module
|
||||||
|
if ($obj->module == 'fournisseur' && $obj->perms == 'commande' && $obj->subperms == 'receptionner') {
|
||||||
$i++;
|
$i++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if ($obj->module == 'fournisseur' && $obj->perms == 'commande_advance' && $obj->subperms == 'check') {
|
||||||
// Special cases
|
$i++;
|
||||||
if (isModEnabled("reception")) {
|
continue;
|
||||||
// The 2 permission in fournisseur modules has been replaced by permissions into reception module
|
|
||||||
if ($obj->module == 'fournisseur' && $obj->perms == 'commande' && $obj->subperms == 'receptionner') {
|
|
||||||
$i++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ($obj->module == 'fournisseur' && $obj->perms == 'commande_advance' && $obj->subperms == 'check') {
|
|
||||||
$i++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$objMod = $modules[$obj->module];
|
$objMod = $modules[$obj->module];
|
||||||
|
|
||||||
|
if (GETPOSTISSET('forbreakperms_'.$obj->module)) {
|
||||||
|
$ishidden = GETPOSTINT('forbreakperms_'.$obj->module);
|
||||||
|
} elseif (in_array($j, $cookietohidegrouparray)) { // If j is among list of hidden group
|
||||||
|
$ishidden = 1;
|
||||||
|
} else {
|
||||||
|
$ishidden = 0;
|
||||||
|
}
|
||||||
|
$isexpanded = ! $ishidden;
|
||||||
|
//var_dump("isexpanded=".$isexpanded);
|
||||||
|
|
||||||
|
$permsgroupbyentitypluszero = array();
|
||||||
|
if (!empty($permsgroupbyentity[0])) {
|
||||||
|
$permsgroupbyentitypluszero = array_merge($permsgroupbyentitypluszero, $permsgroupbyentity[0]);
|
||||||
|
}
|
||||||
|
if (!empty($permsgroupbyentity[$entity])) {
|
||||||
|
$permsgroupbyentitypluszero = array_merge($permsgroupbyentitypluszero, $permsgroupbyentity[$entity]);
|
||||||
|
}
|
||||||
|
//var_dump($permsgroupbyentitypluszero);
|
||||||
|
|
||||||
|
// Break found, it's a new module to catch
|
||||||
|
if (isset($obj->module) && ($oldmod != $obj->module)) {
|
||||||
|
$oldmod = $obj->module;
|
||||||
|
|
||||||
|
$j++;
|
||||||
if (GETPOSTISSET('forbreakperms_'.$obj->module)) {
|
if (GETPOSTISSET('forbreakperms_'.$obj->module)) {
|
||||||
$ishidden = GETPOSTINT('forbreakperms_'.$obj->module);
|
$ishidden = GETPOSTINT('forbreakperms_'.$obj->module);
|
||||||
} elseif (in_array($j, $cookietohidegrouparray)) { // If j is among list of hidden group
|
} elseif (in_array($j, $cookietohidegrouparray)) { // If j is among list of hidden group
|
||||||
@@ -516,92 +582,68 @@ if ($result) {
|
|||||||
$ishidden = 0;
|
$ishidden = 0;
|
||||||
}
|
}
|
||||||
$isexpanded = ! $ishidden;
|
$isexpanded = ! $ishidden;
|
||||||
//var_dump("isexpanded=".$isexpanded);
|
//var_dump('$obj->module='.$obj->module.' isexpanded='.$isexpanded);
|
||||||
|
|
||||||
$permsgroupbyentitypluszero = array();
|
// Break detected, we get objMod
|
||||||
if (!empty($permsgroupbyentity[0])) {
|
$objMod = $modules[$obj->module];
|
||||||
$permsgroupbyentitypluszero = array_merge($permsgroupbyentitypluszero, $permsgroupbyentity[0]);
|
$picto = ($objMod->picto ? $objMod->picto : 'generic');
|
||||||
}
|
|
||||||
if (!empty($permsgroupbyentity[$entity])) {
|
|
||||||
$permsgroupbyentitypluszero = array_merge($permsgroupbyentitypluszero, $permsgroupbyentity[$entity]);
|
|
||||||
}
|
|
||||||
//var_dump($permsgroupbyentitypluszero);
|
|
||||||
|
|
||||||
// Break found, it's a new module to catch
|
// Show break line
|
||||||
if (isset($obj->module) && ($oldmod != $obj->module)) {
|
print '<tr class="oddeven trforbreakperms trforbreaknobg" data-hide-perms="'.$obj->module.'" data-j="'.$j.'">';
|
||||||
$oldmod = $obj->module;
|
// Picto and label of module
|
||||||
|
print '<td class="maxwidthonsmartphone tdoverflowmax200 tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'" title="'.dol_escape_htmltag($objMod->getName()).'">';
|
||||||
|
print '<input type="hidden" name="forbreakperms_'.$obj->module.'" id="idforbreakperms_'.$obj->module.'" css="cssforfieldishiden" data-j="'.$j.'" value="'.($isexpanded ? '0' : "1").'">';
|
||||||
|
print img_object('', $picto, 'class="pictoobjectwidth paddingright"').' '.$objMod->getName();
|
||||||
|
print '<a name="'.$objMod->getName().'"></a>';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
$j++;
|
// Permission and tick (2 columns)
|
||||||
if (GETPOSTISSET('forbreakperms_'.$obj->module)) {
|
if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty($object->admin)) {
|
||||||
$ishidden = GETPOSTINT('forbreakperms_'.$obj->module);
|
if ($caneditperms) {
|
||||||
} elseif (in_array($j, $cookietohidegrouparray)) { // If j is among list of hidden group
|
print '<td class="tdforbreakperms tdforbreakpermsifnotempty center width50 nowraponall" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
|
||||||
$ishidden = 1;
|
print '<span class="permtohide_'.dol_escape_htmltag($obj->module).'" '.(!$isexpanded ? ' style="display:none"' : '').'>';
|
||||||
|
print '<a class="reposition alink addexpandedmodulesinparamlist" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'addrights', 'entity' => $entity, 'module' => $obj->module, 'confirm' => 'yes', 'updatedmodulename' => $obj->module], true).'">'.$langs->trans("All")."</a>";
|
||||||
|
print ' / ';
|
||||||
|
print '<a class="reposition alink addexpandedmodulesinparamlist" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'delrights', 'entity' => $entity, 'module' => $obj->module, 'confirm' => 'yes', 'updatedmodulename' => $obj->module], true).'">'.$langs->trans("None")."</a>";
|
||||||
|
print '</span>';
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
|
||||||
|
print '</td>';
|
||||||
} else {
|
} else {
|
||||||
$ishidden = 0;
|
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
|
||||||
|
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
|
||||||
}
|
}
|
||||||
$isexpanded = ! $ishidden;
|
} else {
|
||||||
//var_dump('$obj->module='.$obj->module.' isexpanded='.$isexpanded);
|
if ($caneditperms) {
|
||||||
|
print '<td class="tdforbreakperms center wraponsmartphone" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
|
||||||
// Break detected, we get objMod
|
/*print '<a class="reposition alink" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addrights&token='.newToken().'&entity='.$entity.'&module='.$obj->module.'&confirm=yes&updatedmodulename='.$obj->module.'">'.$langs->trans("All")."</a>";
|
||||||
$objMod = $modules[$obj->module];
|
print ' / ';
|
||||||
$picto = ($objMod->picto ? $objMod->picto : 'generic');
|
print '<a class="reposition alink" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delrights&token='.newToken().'&entity='.$entity.'&module='.$obj->module.'&confirm=yes&updatedmodulename='.$obj->module.'">'.$langs->trans("None")."</a>";
|
||||||
|
*/
|
||||||
// Show break line
|
print '</td>';
|
||||||
print '<tr class="oddeven trforbreakperms trforbreaknobg" data-hide-perms="'.$obj->module.'" data-j="'.$j.'">';
|
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
|
||||||
// Picto and label of module
|
print '</td>';
|
||||||
print '<td class="maxwidthonsmartphone tdoverflowmax200 tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'" title="'.dol_escape_htmltag($objMod->getName()).'">';
|
|
||||||
print '<input type="hidden" name="forbreakperms_'.$obj->module.'" id="idforbreakperms_'.$obj->module.'" css="cssforfieldishiden" data-j="'.$j.'" value="'.($isexpanded ? '0' : "1").'">';
|
|
||||||
print img_object('', $picto, 'class="pictoobjectwidth paddingright"').' '.$objMod->getName();
|
|
||||||
print '<a name="'.$objMod->getName().'"></a>';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Permission and tick (2 columns)
|
|
||||||
if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty($object->admin)) {
|
|
||||||
if ($caneditperms) {
|
|
||||||
print '<td class="tdforbreakperms tdforbreakpermsifnotempty center width50 nowraponall" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
|
|
||||||
print '<span class="permtohide_'.dol_escape_htmltag($obj->module).'" '.(!$isexpanded ? ' style="display:none"' : '').'>';
|
|
||||||
print '<a class="reposition alink addexpandedmodulesinparamlist" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'addrights', 'entity' => $entity, 'module' => $obj->module, 'confirm' => 'yes', 'updatedmodulename' => $obj->module], true).'">'.$langs->trans("All")."</a>";
|
|
||||||
print ' / ';
|
|
||||||
print '<a class="reposition alink addexpandedmodulesinparamlist" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'delrights', 'entity' => $entity, 'module' => $obj->module, 'confirm' => 'yes', 'updatedmodulename' => $obj->module], true).'">'.$langs->trans("None")."</a>";
|
|
||||||
print '</span>';
|
|
||||||
print '</td>';
|
|
||||||
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
|
|
||||||
print '</td>';
|
|
||||||
} else {
|
|
||||||
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
|
|
||||||
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if ($caneditperms) {
|
print '<td class="right tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
|
||||||
print '<td class="tdforbreakperms center wraponsmartphone" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
|
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
|
||||||
/*print '<a class="reposition alink" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addrights&token='.newToken().'&entity='.$entity.'&module='.$obj->module.'&confirm=yes&updatedmodulename='.$obj->module.'">'.$langs->trans("All")."</a>";
|
|
||||||
print ' / ';
|
|
||||||
print '<a class="reposition alink" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delrights&token='.newToken().'&entity='.$entity.'&module='.$obj->module.'&confirm=yes&updatedmodulename='.$obj->module.'">'.$langs->trans("None")."</a>";
|
|
||||||
*/
|
|
||||||
print '</td>';
|
|
||||||
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
|
|
||||||
print '</td>';
|
|
||||||
} else {
|
|
||||||
print '<td class="right tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
|
|
||||||
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Description of permission (2 columns)
|
|
||||||
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
|
|
||||||
print '<td class="maxwidthonsmartphone right tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
|
|
||||||
|
|
||||||
print '<div class="switchfolderperms inline-block marginrightonly folderperms_'.dol_escape_htmltag($obj->module).'"'.($isexpanded ? ' style="display:none;"' : '').'>';
|
|
||||||
print img_picto('', 'folder', 'class="marginright"');
|
|
||||||
print '</div>';
|
|
||||||
print '<div class="switchfolderperms inline-block marginrightonly folderopenperms_'.dol_escape_htmltag($obj->module).'"'.(!$isexpanded ? ' style="display:none;"' : '').'>';
|
|
||||||
print img_picto('', 'folder-open', 'class="marginright"');
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
print '</td>'; //Add picto + / - when open en closed
|
|
||||||
print '</tr>'."\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Description of permission (2 columns)
|
||||||
|
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
|
||||||
|
print '<td class="maxwidthonsmartphone right tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
|
||||||
|
|
||||||
|
print '<div class="switchfolderperms inline-block marginrightonly folderperms_'.dol_escape_htmltag($obj->module).'"'.($isexpanded ? ' style="display:none;"' : '').'>';
|
||||||
|
print img_picto('', 'folder', 'class="marginright"');
|
||||||
|
print '</div>';
|
||||||
|
print '<div class="switchfolderperms inline-block marginrightonly folderopenperms_'.dol_escape_htmltag($obj->module).'"'.(!$isexpanded ? ' style="display:none;"' : '').'>';
|
||||||
|
print img_picto('', 'folder-open', 'class="marginright"');
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print '</td>'; //Add picto + / - when open en closed
|
||||||
|
print '</tr>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
$permlabel = (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && ($langs->trans("PermissionAdvanced".$obj->id) != "PermissionAdvanced".$obj->id) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != "Permission".$obj->id) ? $langs->trans("Permission".$obj->id) : $langs->trans($obj->label)));
|
$permlabel = (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && ($langs->trans("PermissionAdvanced".$obj->id) != "PermissionAdvanced".$obj->id) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != "Permission".$obj->id) ? $langs->trans("Permission".$obj->id) : $langs->trans($obj->label)));
|
||||||
|
|
||||||
print '<!-- '.$obj->module.'->'.$obj->perms.($obj->subperms ? '->'.$obj->subperms : '').' -->'."\n";
|
print '<!-- '.$obj->module.'->'.$obj->perms.($obj->subperms ? '->'.$obj->subperms : '').' -->'."\n";
|
||||||
@@ -612,65 +654,47 @@ if ($result) {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Permission and tick (2 columns)
|
// Permission and tick (2 columns)
|
||||||
if (!empty($object->admin) && !empty($objMod->rights_admin_allowed)) { // Permission granted because admin
|
if (!empty($object->admin) && !empty($objMod->rights_admin_allowed)) { // Permission granted because admin
|
||||||
print '<!-- perm is a perm allowed to any admin -->';
|
print '<!-- perm is a perm allowed to any admin -->';
|
||||||
if ($caneditperms) {
|
if ($caneditperms) {
|
||||||
print '<td class="center nowrap">';
|
print '<td class="center nowrap">';
|
||||||
print img_picto($langs->trans("AdministratorDesc"), 'star', 'class="paddingleft valignmiddle"');
|
print img_picto($langs->trans("AdministratorDesc"), 'star', 'class="paddingleft valignmiddle"');
|
||||||
print '</td>';
|
|
||||||
} else {
|
|
||||||
print '<td class="center nowrap">';
|
|
||||||
print img_picto($langs->trans("Active"), 'switch_on', '', 0, 0, 0, '', 'opacitymedium');
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
print '<td>';
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
} elseif (in_array($obj->id, $permsuser)) { // Permission granted by user
|
} else {
|
||||||
print '<!-- user has perm -->';
|
print '<td class="center nowrap">';
|
||||||
if ($caneditperms) {
|
print img_picto($langs->trans("Active"), 'switch_on', '', 0, 0, 0, '', 'opacitymedium');
|
||||||
print '<td class="center nowrap">';
|
print '</td>';
|
||||||
print '<a class="reposition addexpandedmodulesinparamlist" href="'.dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'delrights', 'entity' => $entity, 'rights' => $obj->id, 'confirm' => 'yes', 'updatedmodulename' => $obj->module], true).'">';
|
}
|
||||||
//print img_edit_remove($langs->trans("Remove"));
|
print '<td>';
|
||||||
print img_picto($langs->trans("Remove"), 'switch_on');
|
print '</td>';
|
||||||
print '</a>';
|
} elseif (in_array($obj->id, $permsuser)) { // Permission granted by user
|
||||||
print '</td>';
|
print '<!-- user has perm -->';
|
||||||
} else {
|
if ($caneditperms) {
|
||||||
print '<td class="center nowrap">';
|
print '<td class="center nowrap">';
|
||||||
print img_picto($langs->trans("Active"), 'switch_on', '', 0, 0, 0, '', 'opacitymedium');
|
print '<a class="reposition addexpandedmodulesinparamlist" href="'.dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'delrights', 'entity' => $entity, 'rights' => $obj->id, 'confirm' => 'yes', 'updatedmodulename' => $obj->module], true).'">';
|
||||||
print '</td>';
|
//print img_edit_remove($langs->trans("Remove"));
|
||||||
}
|
print img_picto($langs->trans("Remove"), 'switch_on');
|
||||||
print '<td>';
|
print '</a>';
|
||||||
|
print '</td>';
|
||||||
|
} else {
|
||||||
|
print '<td class="center nowrap">';
|
||||||
|
print img_picto($langs->trans("Active"), 'switch_on', '', 0, 0, 0, '', 'opacitymedium');
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
print '<td>';
|
||||||
|
print '</td>';
|
||||||
|
} elseif (isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero)) {
|
||||||
|
print '<!-- permsgroupbyentitypluszero -->';
|
||||||
|
if (in_array($obj->id, $permsgroupbyentitypluszero)) { // Permission granted by group
|
||||||
|
print '<td class="center nowrap">';
|
||||||
|
print img_picto($langs->trans("Active"), 'switch_on', '', 0, 0, 0, '', 'opacitymedium');
|
||||||
|
//print img_picto($langs->trans("Active"), 'tick');
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="center nowrap">';
|
||||||
|
print $form->textwithtooltip($langs->trans("Inherited"), $langs->trans("PermissionInheritedFromAGroup"));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
} elseif (isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero)) {
|
|
||||||
print '<!-- permsgroupbyentitypluszero -->';
|
|
||||||
if (in_array($obj->id, $permsgroupbyentitypluszero)) { // Permission granted by group
|
|
||||||
print '<td class="center nowrap">';
|
|
||||||
print img_picto($langs->trans("Active"), 'switch_on', '', 0, 0, 0, '', 'opacitymedium');
|
|
||||||
//print img_picto($langs->trans("Active"), 'tick');
|
|
||||||
print '</td>';
|
|
||||||
print '<td class="center nowrap">';
|
|
||||||
print $form->textwithtooltip($langs->trans("Inherited"), $langs->trans("PermissionInheritedFromAGroup"));
|
|
||||||
print '</td>';
|
|
||||||
} else {
|
|
||||||
// Do not own permission
|
|
||||||
if ($caneditperms) {
|
|
||||||
print '<td class="center nowrap">';
|
|
||||||
print '<a class="reposition addexpandedmodulesinparamlist" href="'.dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'addrights', 'entity' => $entity, 'rights' => $obj->id, 'confirm' => 'yes', 'updatedmodulename' => $obj->module], true).'">';
|
|
||||||
//print img_edit_add($langs->trans("Add"));
|
|
||||||
print img_picto($langs->trans("Add"), 'switch_off');
|
|
||||||
print '</a>';
|
|
||||||
print '</td>';
|
|
||||||
} else {
|
|
||||||
print '<td class="center nowrap">';
|
|
||||||
print img_picto($langs->trans("Disabled"), 'switch_off', '', 0, 0, 0, '', 'opacitymedium');
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
print '<td>';
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// Do not own permission
|
// Do not own permission
|
||||||
print '<!-- do not own permission -->';
|
|
||||||
if ($caneditperms) {
|
if ($caneditperms) {
|
||||||
print '<td class="center nowrap">';
|
print '<td class="center nowrap">';
|
||||||
print '<a class="reposition addexpandedmodulesinparamlist" href="'.dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'addrights', 'entity' => $entity, 'rights' => $obj->id, 'confirm' => 'yes', 'updatedmodulename' => $obj->module], true).'">';
|
print '<a class="reposition addexpandedmodulesinparamlist" href="'.dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'addrights', 'entity' => $entity, 'rights' => $obj->id, 'confirm' => 'yes', 'updatedmodulename' => $obj->module], true).'">';
|
||||||
@@ -686,71 +710,86 @@ if ($result) {
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Do not own permission
|
||||||
|
print '<!-- do not own permission -->';
|
||||||
|
if ($caneditperms) {
|
||||||
|
print '<td class="center nowrap">';
|
||||||
|
print '<a class="reposition addexpandedmodulesinparamlist" href="'.dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'addrights', 'entity' => $entity, 'rights' => $obj->id, 'confirm' => 'yes', 'updatedmodulename' => $obj->module], true).'">';
|
||||||
|
//print img_edit_add($langs->trans("Add"));
|
||||||
|
print img_picto($langs->trans("Add"), 'switch_off');
|
||||||
|
print '</a>';
|
||||||
|
print '</td>';
|
||||||
|
} else {
|
||||||
|
print '<td class="center nowrap">';
|
||||||
|
print img_picto($langs->trans("Disabled"), 'switch_off', '', 0, 0, 0, '', 'opacitymedium');
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
print '<td>';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
// Description of permission (1 or 2 columns)
|
// Description of permission (1 or 2 columns)
|
||||||
if (!$user->admin) {
|
if (!$user->admin) {
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
} else {
|
} else {
|
||||||
print '<td>';
|
print '<td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print $permlabel;
|
print $permlabel;
|
||||||
$idtouse = $obj->id;
|
$idtouse = $obj->id;
|
||||||
if (in_array($idtouse, array(121, 122, 125, 126))) { // Force message for the 3 permission on third parties
|
if (in_array($idtouse, array(121, 122, 125, 126))) { // Force message for the 3 permission on third parties
|
||||||
$idtouse = 122;
|
$idtouse = 122;
|
||||||
}
|
}
|
||||||
if ($langs->trans("Permission".$idtouse.'b') != "Permission".$idtouse.'b') {
|
if ($langs->trans("Permission".$idtouse.'b') != "Permission".$idtouse.'b') {
|
||||||
print '<br><span class="opacitymedium">'.$langs->trans("Permission".$idtouse.'b').'</span>';
|
print '<br><span class="opacitymedium">'.$langs->trans("Permission".$idtouse.'b').'</span>';
|
||||||
}
|
}
|
||||||
if ($langs->trans("Permission".$obj->id.'c') != "Permission".$obj->id.'c') {
|
if ($langs->trans("Permission".$obj->id.'c') != "Permission".$obj->id.'c') {
|
||||||
print '<br><span class="opacitymedium">'.$langs->trans("Permission".$obj->id.'c').'</span>';
|
print '<br><span class="opacitymedium">'.$langs->trans("Permission".$obj->id.'c').'</span>';
|
||||||
}
|
}
|
||||||
if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
|
if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
|
||||||
if (preg_match('/_advance$/', $obj->perms)) {
|
if (preg_match('/_advance$/', $obj->perms)) {
|
||||||
print ' <span class="opacitymedium">('.$langs->trans("AdvancedModeOnly").')</span>';
|
print ' <span class="opacitymedium">('.$langs->trans("AdvancedModeOnly").')</span>';
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Special warning case for the permission "Allow to modify other users password"
|
// Special warning case for the permission "Allow to modify other users password"
|
||||||
if ($obj->module == 'user' && $obj->perms == 'user' && $obj->subperms == 'password') {
|
if ($obj->module == 'user' && $obj->perms == 'user' && $obj->subperms == 'password') {
|
||||||
if ((!empty($object->admin) && !empty($objMod->rights_admin_allowed)) ||
|
if ((!empty($object->admin) && !empty($objMod->rights_admin_allowed)) ||
|
||||||
in_array($obj->id, $permsuser) /* if edited user owns this permissions */ ||
|
in_array($obj->id, $permsuser) /* if edited user owns this permissions */ ||
|
||||||
(isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero) && in_array($obj->id, $permsgroupbyentitypluszero))) {
|
(isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero) && in_array($obj->id, $permsgroupbyentitypluszero))) {
|
||||||
print ' '.img_warning($langs->trans("AllowPasswordResetBySendingANewPassByEmail"));
|
print ' '.img_warning($langs->trans("AllowPasswordResetBySendingANewPassByEmail"));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Special warning case for the permission "Create/modify other users, groups and permissions"
|
// Special warning case for the permission "Create/modify other users, groups and permissions"
|
||||||
if ($obj->module == 'user' && $obj->perms == 'user' && ($obj->subperms == 'creer' || $obj->subperms == 'create')) {
|
if ($obj->module == 'user' && $obj->perms == 'user' && ($obj->subperms == 'creer' || $obj->subperms == 'create')) {
|
||||||
if ((!empty($object->admin) && !empty($objMod->rights_admin_allowed)) ||
|
if ((!empty($object->admin) && !empty($objMod->rights_admin_allowed)) ||
|
||||||
in_array($obj->id, $permsuser) /* if edited user owns this permissions */ ||
|
in_array($obj->id, $permsuser) /* if edited user owns this permissions */ ||
|
||||||
(isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero) && in_array($obj->id, $permsgroupbyentitypluszero))) {
|
(isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero) && in_array($obj->id, $permsgroupbyentitypluszero))) {
|
||||||
print ' '.img_warning($langs->trans("AllowAnyPrivileges"));
|
print ' '.img_warning($langs->trans("AllowAnyPrivileges"));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Special case for reading bank account when you have permission to manage Chart of account
|
// Special case for reading bank account when you have permission to manage Chart of account
|
||||||
if ($obj->module == 'banque' && $obj->perms == 'lire') {
|
if ($obj->module == 'banque' && $obj->perms == 'lire') {
|
||||||
if (isModEnabled("accounting") && $object->hasRight('accounting', 'chartofaccount')) {
|
if (isModEnabled("accounting") && $object->hasRight('accounting', 'chartofaccount')) {
|
||||||
print ' '.img_warning($langs->trans("WarningReadBankAlsoAllowedIfUserHasPermission"));
|
print ' '.img_warning($langs->trans("WarningReadBankAlsoAllowedIfUserHasPermission"));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Permission id
|
// Permission id
|
||||||
if ($user->admin) {
|
if ($user->admin) {
|
||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
$htmltext = $langs->trans("ID").': '.$obj->id;
|
$htmltext = $langs->trans("ID").': '.$obj->id;
|
||||||
$htmltext .= '<br>'.$langs->trans("Permission").': user->hasRight(\''.dol_escape_htmltag($obj->module).'\', \''.dol_escape_htmltag($obj->perms).'\''.($obj->subperms ? ', \''.dol_escape_htmltag($obj->subperms).'\'' : '').')';
|
$htmltext .= '<br>'.$langs->trans("Permission").': user->hasRight(\''.dol_escape_htmltag($obj->module).'\', \''.dol_escape_htmltag($obj->perms).'\''.($obj->subperms ? ', \''.dol_escape_htmltag($obj->subperms).'\'' : '').')';
|
||||||
print $form->textwithpicto('', $htmltext, 1, 'help', 'inline-block marginrightonly');
|
print $form->textwithpicto('', $htmltext, 1, 'help', 'inline-block marginrightonly');
|
||||||
//print '<span class="opacitymedium">'.$obj->id.'</span>';
|
//print '<span class="opacitymedium">'.$obj->id.'</span>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
|
||||||
} else {
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
Reference in New Issue
Block a user