diff --git a/htdocs/core/class/interfaces.class.php b/htdocs/core/class/interfaces.class.php index f1daafeb9e7..9302ed09afb 100644 --- a/htdocs/core/class/interfaces.class.php +++ b/htdocs/core/class/interfaces.class.php @@ -328,48 +328,59 @@ class Interfaces continue; } - $objMod = new $modName($db); + try { + $objMod = new $modName($db); - // Define disabledbyname and disabledbymodule - $disabledbyname = 0; - $disabledbymodule = 1; - $module = ''; + if (is_subclass_of($objMod, 'DolibarrTriggers')) + { + // Define disabledbyname and disabledbymodule + $disabledbyname = 0; + $disabledbymodule = 1; + $module = ''; - // Check if trigger file is disabled by name - if (preg_match('/NORUN$/i', $files[$key])) $disabledbyname = 1; - // Check if trigger file is for a particular module - if (preg_match('/^interface_([0-9]+)_([^_]+)_(.+)\.class\.php/i', $files[$key], $reg)) - { - $module = preg_replace('/^mod/i', '', $reg[2]); - $constparam = 'MAIN_MODULE_'.strtoupper($module); - if (strtolower($module) == 'all') $disabledbymodule = 0; - elseif (empty($conf->global->$constparam)) $disabledbymodule = 2; - $triggers[$j]['module'] = strtolower($module); + // Check if trigger file is disabled by name + if (preg_match('/NORUN$/i', $files[$key])) $disabledbyname = 1; + // Check if trigger file is for a particular module + if (preg_match('/^interface_([0-9]+)_([^_]+)_(.+)\.class\.php/i', $files[$key], $reg)) + { + $module = preg_replace('/^mod/i', '', $reg[2]); + $constparam = 'MAIN_MODULE_'.strtoupper($module); + if (strtolower($module) == 'all') $disabledbymodule = 0; + elseif (empty($conf->global->$constparam)) $disabledbymodule = 2; + $triggers[$j]['module'] = strtolower($module); + } + + // We set info of modules + $triggers[$j]['picto'] = $objMod->picto ?img_object('', $objMod->picto, 'class="valignmiddle pictomodule "') : img_object('', 'generic', 'class="valignmiddle pictomodule "'); + $triggers[$j]['file'] = $files[$key]; + $triggers[$j]['fullpath'] = $fullpath[$key]; + $triggers[$j]['relpath'] = $relpath[$key]; + $triggers[$j]['iscoreorexternal'] = $iscoreorexternal[$key]; + $triggers[$j]['version'] = $objMod->getVersion(); + $triggers[$j]['status'] = img_picto($langs->trans("Active"), 'tick'); + if ($disabledbyname > 0 || $disabledbymodule > 1) $triggers[$j]['status'] = ''; + + $text = ''.$langs->trans("Description").':
'; + $text .= $objMod->getDesc().'
'; + $text .= '
'.$langs->trans("Status").':
'; + if ($disabledbyname == 1) + { + $text .= $langs->trans("TriggerDisabledByName").'
'; + if ($disabledbymodule == 2) $text .= $langs->trans("TriggerDisabledAsModuleDisabled", $module).'
'; + } + else + { + if ($disabledbymodule == 0) $text .= $langs->trans("TriggerAlwaysActive").'
'; + if ($disabledbymodule == 1) $text .= $langs->trans("TriggerActiveAsModuleActive", $module).'
'; + if ($disabledbymodule == 2) $text .= $langs->trans("TriggerDisabledAsModuleDisabled", $module).'
'; + } + } + else { + print 'Error: Trigger '.$modName.' does not extends DolibarrTriggers
'; + } } - - // We set info of modules - $triggers[$j]['picto'] = $objMod->picto ?img_object('', $objMod->picto, 'class="valignmiddle pictomodule "') : img_object('', 'generic', 'class="valignmiddle pictomodule "'); - $triggers[$j]['file'] = $files[$key]; - $triggers[$j]['fullpath'] = $fullpath[$key]; - $triggers[$j]['relpath'] = $relpath[$key]; - $triggers[$j]['iscoreorexternal'] = $iscoreorexternal[$key]; - $triggers[$j]['version'] = $objMod->getVersion(); - $triggers[$j]['status'] = img_picto($langs->trans("Active"), 'tick'); - if ($disabledbyname > 0 || $disabledbymodule > 1) $triggers[$j]['status'] = ''; - - $text = ''.$langs->trans("Description").':
'; - $text .= $objMod->getDesc().'
'; - $text .= '
'.$langs->trans("Status").':
'; - if ($disabledbyname == 1) - { - $text .= $langs->trans("TriggerDisabledByName").'
'; - if ($disabledbymodule == 2) $text .= $langs->trans("TriggerDisabledAsModuleDisabled", $module).'
'; - } - else - { - if ($disabledbymodule == 0) $text .= $langs->trans("TriggerAlwaysActive").'
'; - if ($disabledbymodule == 1) $text .= $langs->trans("TriggerActiveAsModuleActive", $module).'
'; - if ($disabledbymodule == 2) $text .= $langs->trans("TriggerDisabledAsModuleDisabled", $module).'
'; + catch(Exception $e) { + print $e->getMessage(); } $triggers[$j]['info'] = $text; diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 9543cf74442..f9d27fedfa4 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -2295,9 +2295,11 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it { print img_object($alttext, 'generic', 'class="inline-block valignmiddle"'); } - print 'getVersion(1).'">'; - print $this->getVersion(1); - print ''; + if ($this->isCoreOrExternalModule() == 'external') { + print 'getVersion(1).'">'; + print $this->getVersion(1); + print ''; + } /*print ''; print '
'; @@ -2313,7 +2315,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it print '
- '.$this->getName().' + '.$this->getName().' '.nl2br($this->getDesc()).''; /*print 'getVersion(1).'">'; diff --git a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php index 27138e6099f..e6c2df36ee1 100644 --- a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php +++ b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; /** * Class of triggers for stripe module */ -class InterfaceStripe +class InterfaceStripe extends DolibarrTriggers { /** * @var DoliDB Database handler. diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index 3138cd8bfd9..3d9c392f32b 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -8,7 +8,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> */ .info-box-module-external span.info-box-icon-version { - background: #999; + background: #bbb; } .info-box { @@ -74,7 +74,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> height: 80px; width: 80px; font-size: 25px; - line-height: 80px; + line-height: 100px; } .info-box-module .info-box-icon { height: 106px;