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();
|
$modulename=$objMod->getName();
|
||||||
$moduledesc=$objMod->getDesc();
|
$moduledesc=$objMod->getDesc();
|
||||||
$moduleauthor=$objMod->getPublisher();
|
$moduleauthor=$objMod->getPublisher();
|
||||||
|
$moduledir=strtolower(preg_replace('/^mod/i','',get_class($objMod)));
|
||||||
|
|
||||||
|
|
||||||
print '<div class="centpercent">';
|
print '<div class="centpercent">';
|
||||||
@@ -458,7 +458,17 @@ if ($mode == 'feature')
|
|||||||
{
|
{
|
||||||
$yesno='No';
|
$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;
|
$text.=$langs->trans($yesno).$moreinfoontriggerfile;
|
||||||
|
|
||||||
|
|||||||
@@ -325,8 +325,9 @@ class Interfaces
|
|||||||
{
|
{
|
||||||
$module=preg_replace('/^mod/i','',$reg[2]);
|
$module=preg_replace('/^mod/i','',$reg[2]);
|
||||||
$constparam='MAIN_MODULE_'.strtoupper($module);
|
$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;
|
else if (empty($conf->global->$constparam)) $disabledbymodule=2;
|
||||||
|
$triggers[$j]['module']=strtolower($module);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We set info of modules
|
// We set info of modules
|
||||||
|
|||||||
@@ -56,9 +56,6 @@ class modAccounting extends DolibarrModules
|
|||||||
$this->special = 0;
|
$this->special = 0;
|
||||||
$this->picto = 'accounting';
|
$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
|
// Data directories to create when module is enabled
|
||||||
$this->dirs = array('/accounting/temp');
|
$this->dirs = array('/accounting/temp');
|
||||||
|
|
||||||
|
|||||||
@@ -54,9 +54,6 @@ class modExpenseReport extends DolibarrModules
|
|||||||
$this->special = 0;
|
$this->special = 0;
|
||||||
$this->picto='trip';
|
$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.
|
// Data directories to create when module is enabled.
|
||||||
$this->dirs = array("/expensereport/temp");
|
$this->dirs = array("/expensereport/temp");
|
||||||
$r=0;
|
$r=0;
|
||||||
|
|||||||
@@ -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'
|
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
|
||||||
$this->picto='holiday';
|
$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.
|
// Data directories to create when module is enabled.
|
||||||
// Example: this->dirs = array("/mymodule/temp");
|
// Example: this->dirs = array("/mymodule/temp");
|
||||||
$this->dirs = array();
|
$this->dirs = array();
|
||||||
|
|||||||
Reference in New Issue
Block a user