forked from Wavyzz/dolibarr
Better detection if a module provide triggers
This commit is contained in:
@@ -269,7 +269,7 @@ if ($objMod->isCoreOrExternalModule() == 'external')
|
||||
$modulename=$objMod->getName();
|
||||
$moduledesc=$objMod->getDesc();
|
||||
$moduleauthor=$objMod->getPublisher();
|
||||
|
||||
$moduledir=strtolower(preg_replace('/^mod/i','',get_class($objMod)));
|
||||
|
||||
|
||||
print '<div class="centpercent">';
|
||||
@@ -458,7 +458,17 @@ if ($mode == 'feature')
|
||||
{
|
||||
$yesno='No';
|
||||
}
|
||||
// TODO Try autodetection by scanning all triggers files for a file interface_99_modModule_xxx.class.php to set $moreinfoontriggerfile
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
|
||||
$interfaces = new Interfaces($db);
|
||||
$triggers = $interfaces->getTriggersList(array((($objMod->isCoreOrExternalModule() == 'external')?'/'.$moduledir:'').'/core/triggers'));
|
||||
foreach($triggers as $triggercursor)
|
||||
{
|
||||
if ($triggercursor['module'] == $moduledir)
|
||||
{
|
||||
$yesno='Yes';
|
||||
$moreinfoontriggerfile=' ('.$triggercursor['relpath'].')';
|
||||
}
|
||||
}
|
||||
|
||||
$text.=$langs->trans($yesno).$moreinfoontriggerfile;
|
||||
|
||||
|
||||
@@ -325,8 +325,9 @@ class Interfaces
|
||||
{
|
||||
$module=preg_replace('/^mod/i','',$reg[2]);
|
||||
$constparam='MAIN_MODULE_'.strtoupper($module);
|
||||
if (strtolower($reg[2]) == 'all') $disabledbymodule=0;
|
||||
if (strtolower($module) == 'all') $disabledbymodule=0;
|
||||
else if (empty($conf->global->$constparam)) $disabledbymodule=2;
|
||||
$triggers[$j]['module']=strtolower($module);
|
||||
}
|
||||
|
||||
// We set info of modules
|
||||
|
||||
@@ -56,9 +56,6 @@ class modAccounting extends DolibarrModules
|
||||
$this->special = 0;
|
||||
$this->picto = 'accounting';
|
||||
|
||||
// Defined if the directory /mymodule/inc/triggers/ contains triggers or not
|
||||
// $this->triggers = 1;
|
||||
|
||||
// Data directories to create when module is enabled
|
||||
$this->dirs = array('/accounting/temp');
|
||||
|
||||
|
||||
@@ -54,9 +54,6 @@ class modExpenseReport extends DolibarrModules
|
||||
$this->special = 0;
|
||||
$this->picto='trip';
|
||||
|
||||
// Defined if the directory /mymodule/inc/triggers/ contains triggers or not
|
||||
$this->triggers = 0;
|
||||
|
||||
// Data directories to create when module is enabled.
|
||||
$this->dirs = array("/expensereport/temp");
|
||||
$r=0;
|
||||
@@ -114,56 +111,56 @@ class modExpenseReport extends DolibarrModules
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'lire';
|
||||
$r++;
|
||||
|
||||
|
||||
$this->rights[$r][0] = 772;
|
||||
$this->rights[$r][1] = 'Create/modify expense reports';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'creer';
|
||||
$r++;
|
||||
|
||||
|
||||
$this->rights[$r][0] = 773;
|
||||
$this->rights[$r][1] = 'Delete expense reports';
|
||||
$this->rights[$r][2] = 'd';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'supprimer';
|
||||
$r++;
|
||||
|
||||
|
||||
$this->rights[$r][0] = 775;
|
||||
$this->rights[$r][1] = 'Approve expense reports';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'approve';
|
||||
$r++;
|
||||
|
||||
|
||||
$this->rights[$r][0] = 776;
|
||||
$this->rights[$r][1] = 'Pay expense reports';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'to_paid';
|
||||
$r++;
|
||||
|
||||
|
||||
$this->rights[$r][0] = 777;
|
||||
$this->rights[$r][1] = 'Read expense reports of everybody';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 1;
|
||||
$this->rights[$r][4] = 'readall';
|
||||
$r++;
|
||||
|
||||
|
||||
$this->rights[$r][0] = 778;
|
||||
$this->rights[$r][1] = 'Create expense reports for everybody';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'writeall_advance';
|
||||
$r++;
|
||||
|
||||
|
||||
$this->rights[$r][0] = 779;
|
||||
$this->rights[$r][1] = 'Export expense reports';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'export';
|
||||
$r++;
|
||||
|
||||
|
||||
// Menus
|
||||
//-------
|
||||
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
|
||||
|
||||
@@ -69,9 +69,6 @@ class modHoliday extends DolibarrModules
|
||||
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
|
||||
$this->picto='holiday';
|
||||
|
||||
// Defined if the directory /mymodule/inc/triggers/ contains triggers or not
|
||||
$this->triggers = 0;
|
||||
|
||||
// Data directories to create when module is enabled.
|
||||
// Example: this->dirs = array("/mymodule/temp");
|
||||
$this->dirs = array();
|
||||
@@ -173,11 +170,11 @@ class modHoliday extends DolibarrModules
|
||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||
$r++;
|
||||
|
||||
|
||||
|
||||
// Menus
|
||||
//-------
|
||||
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
|
||||
|
||||
|
||||
|
||||
// Exports
|
||||
$r=1;
|
||||
|
||||
Reference in New Issue
Block a user