mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-08 00:52:01 +01:00
code syntax admin dir
This commit is contained in:
@@ -21,8 +21,12 @@
|
||||
* \brief Page to activate/disable all modules
|
||||
*/
|
||||
|
||||
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
|
||||
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disabled because this page is into a popup on module search page and we want to avoid to have an Anti CSRF token error (done if MAIN_SECURITY_CSRF_WITH_TOKEN is on) when we make a second search after closing popup.
|
||||
if (!defined('NOREQUIREMENU')) {
|
||||
define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
|
||||
}
|
||||
if (!defined('NOTOKENRENEWAL')) {
|
||||
define('NOTOKENRENEWAL', '1'); // Disabled because this page is into a popup on module search page and we want to avoid to have an Anti CSRF token error (done if MAIN_SECURITY_CSRF_WITH_TOKEN is on) when we make a second search after closing popup.
|
||||
}
|
||||
|
||||
|
||||
require '../main.inc.php';
|
||||
@@ -36,10 +40,13 @@ $langs->loadLangs(array('errors', 'admin', 'modulebuilder', 'exports'));
|
||||
$mode = GETPOST('mode', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$id = GETPOST('id', 'int');
|
||||
if (empty($mode)) $mode = 'desc';
|
||||
if (empty($mode)) {
|
||||
$mode = 'desc';
|
||||
}
|
||||
|
||||
if (!$user->admin)
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -80,25 +87,19 @@ $i = 0; // is a sequencer of modules found
|
||||
$j = 0; // j is module number. Automatically affected if module number not defined.
|
||||
$modNameLoaded = array();
|
||||
|
||||
foreach ($modulesdir as $dir)
|
||||
{
|
||||
foreach ($modulesdir as $dir) {
|
||||
// Load modules attributes in arrays (name, numero, orders) from dir directory
|
||||
//print $dir."\n<br>";
|
||||
dol_syslog("Scan directory ".$dir." for module descriptor files (modXXX.class.php)");
|
||||
$handle = @opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (is_resource($handle)) {
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
//print "$i ".$file."\n<br>";
|
||||
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
|
||||
{
|
||||
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') {
|
||||
$modName = substr($file, 0, dol_strlen($file) - 10);
|
||||
|
||||
if ($modName)
|
||||
{
|
||||
if (!empty($modNameLoaded[$modName]))
|
||||
{
|
||||
if ($modName) {
|
||||
if (!empty($modNameLoaded[$modName])) {
|
||||
$mesg = "Error: Module ".$modName." was found twice: Into ".$modNameLoaded[$modName]." and ".$dir.". You probably have an old file on your disk.<br>";
|
||||
setEventMessages($mesg, null, 'warnings');
|
||||
dol_syslog($mesg, LOG_ERR);
|
||||
@@ -107,15 +108,13 @@ foreach ($modulesdir as $dir)
|
||||
|
||||
try {
|
||||
$res = include_once $dir.$file;
|
||||
if (class_exists($modName))
|
||||
{
|
||||
if (class_exists($modName)) {
|
||||
try {
|
||||
$objMod = new $modName($db);
|
||||
$modNameLoaded[$modName] = $dir;
|
||||
|
||||
if (!$objMod->numero > 0 && $modName != 'modUser')
|
||||
{
|
||||
dol_syslog('The module descriptor '.$modName.' must have a numero property', LOG_ERR);
|
||||
if (!$objMod->numero > 0 && $modName != 'modUser') {
|
||||
dol_syslog('The module descriptor '.$modName.' must have a numero property', LOG_ERR);
|
||||
}
|
||||
$j = $objMod->numero;
|
||||
|
||||
@@ -123,21 +122,24 @@ foreach ($modulesdir as $dir)
|
||||
|
||||
// We discard modules according to features level (PS: if module is activated we always show it)
|
||||
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
|
||||
if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) $modulequalified = 0;
|
||||
if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) $modulequalified = 0;
|
||||
if (preg_match('/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) $modulequalified = 0;
|
||||
if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) {
|
||||
$modulequalified = 0;
|
||||
}
|
||||
if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) {
|
||||
$modulequalified = 0;
|
||||
}
|
||||
if (preg_match('/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) {
|
||||
$modulequalified = 0;
|
||||
}
|
||||
|
||||
// We discard modules according to property disabled
|
||||
//if (! empty($objMod->hidden)) $modulequalified=0;
|
||||
|
||||
if ($modulequalified > 0)
|
||||
{
|
||||
if ($modulequalified > 0) {
|
||||
$publisher = dol_escape_htmltag($objMod->getPublisher());
|
||||
$external = ($objMod->isCoreOrExternalModule() == 'external');
|
||||
if ($external)
|
||||
{
|
||||
if ($publisher)
|
||||
{
|
||||
if ($external) {
|
||||
if ($publisher) {
|
||||
$arrayofnatures['external_'.$publisher] = $langs->trans("External").' - '.$publisher;
|
||||
} else {
|
||||
$arrayofnatures['external_'] = $langs->trans("External").' - '.$langs->trans("UnknownPublishers");
|
||||
@@ -147,14 +149,15 @@ foreach ($modulesdir as $dir)
|
||||
}
|
||||
|
||||
// Define array $categ with categ with at least one qualified module
|
||||
if ($modulequalified > 0)
|
||||
{
|
||||
if ($modulequalified > 0) {
|
||||
$modules[$i] = $objMod;
|
||||
$filename[$i] = $modName;
|
||||
|
||||
// Gives the possibility to the module, to provide his own family info and position of this family
|
||||
if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) {
|
||||
if (!is_array($familyinfo)) $familyinfo = array();
|
||||
if (!is_array($familyinfo)) {
|
||||
$familyinfo = array();
|
||||
}
|
||||
$familyinfo = array_merge($familyinfo, $objMod->familyinfo);
|
||||
$familykey = key($objMod->familyinfo);
|
||||
} else {
|
||||
@@ -162,8 +165,7 @@ foreach ($modulesdir as $dir)
|
||||
}
|
||||
|
||||
$moduleposition = ($objMod->module_position ? $objMod->module_position : '50');
|
||||
if ($moduleposition == '50' && ($objMod->isCoreOrExternalModule() == 'external'))
|
||||
{
|
||||
if ($moduleposition == '50' && ($objMod->isCoreOrExternalModule() == 'external')) {
|
||||
$moduleposition = '80'; // External modules at end by default
|
||||
}
|
||||
|
||||
@@ -172,21 +174,26 @@ foreach ($modulesdir as $dir)
|
||||
//print $i.'-'.$dirmod[$i].'<br>';
|
||||
// Set categ[$i]
|
||||
$specialstring = 'unknown';
|
||||
if ($objMod->version == 'development' || $objMod->version == 'experimental') $specialstring = 'expdev';
|
||||
if (isset($categ[$specialstring])) $categ[$specialstring]++; // Array of all different modules categories
|
||||
else $categ[$specialstring] = 1;
|
||||
if ($objMod->version == 'development' || $objMod->version == 'experimental') {
|
||||
$specialstring = 'expdev';
|
||||
}
|
||||
if (isset($categ[$specialstring])) {
|
||||
$categ[$specialstring]++; // Array of all different modules categories
|
||||
} else {
|
||||
$categ[$specialstring] = 1;
|
||||
}
|
||||
$j++;
|
||||
$i++;
|
||||
} else dol_syslog("Module ".get_class($objMod)." not qualified");
|
||||
} catch (Exception $e)
|
||||
{
|
||||
} else {
|
||||
dol_syslog("Module ".get_class($objMod)." not qualified");
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
|
||||
}
|
||||
} else {
|
||||
print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)<br>";
|
||||
}
|
||||
} catch (Exception $e)
|
||||
{
|
||||
} catch (Exception $e) {
|
||||
dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
|
||||
}
|
||||
}
|
||||
@@ -206,11 +213,9 @@ asort($orders);
|
||||
|
||||
unset($objMod);
|
||||
$i = 0;
|
||||
foreach ($orders as $tmpkey => $tmpvalue)
|
||||
{
|
||||
foreach ($orders as $tmpkey => $tmpvalue) {
|
||||
$tmpMod = $modules[$tmpkey];
|
||||
if ($tmpMod->numero == $id)
|
||||
{
|
||||
if ($tmpMod->numero == $id) {
|
||||
$key = $i;
|
||||
$modName = $filename[$tmpkey];
|
||||
$dirofmodule = $dirmod[$tmpkey];
|
||||
@@ -236,20 +241,21 @@ $moduledir = strtolower(preg_replace('/^mod/i', '', get_class($objMod)));
|
||||
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
|
||||
|
||||
$text = '<span class="opacitymedium">'.$langs->trans("LastActivationDate").':</span> ';
|
||||
if (!empty($conf->global->$const_name)) $text .= dol_print_date($objMod->getLastActivationDate(), 'dayhour');
|
||||
else $text .= $langs->trans("Disabled");
|
||||
if (!empty($conf->global->$const_name)) {
|
||||
$text .= dol_print_date($objMod->getLastActivationDate(), 'dayhour');
|
||||
} else {
|
||||
$text .= $langs->trans("Disabled");
|
||||
}
|
||||
$tmp = $objMod->getLastActivationInfo();
|
||||
$authorid = $tmp['authorid'];
|
||||
if ($authorid > 0)
|
||||
{
|
||||
if ($authorid > 0) {
|
||||
$tmpuser = new User($db);
|
||||
$tmpuser->fetch($authorid);
|
||||
$text .= '<br><span class="opacitymedium">'.$langs->trans("LastActivationAuthor").':</span> ';
|
||||
$text .= $tmpuser->getNomUrl(1);
|
||||
}
|
||||
$ip = $tmp['ip'];
|
||||
if ($ip)
|
||||
{
|
||||
if ($ip) {
|
||||
$text .= '<br><span class="opacitymedium">'.$langs->trans("LastActivationIP").':</span> ';
|
||||
$text .= $ip;
|
||||
}
|
||||
@@ -267,16 +273,13 @@ print '<br>';
|
||||
|
||||
print dol_get_fiche_head($head, $mode, '', -1);
|
||||
|
||||
if (!$modulename)
|
||||
{
|
||||
if (!$modulename) {
|
||||
dol_syslog("Error for module ".$key." - Property name of module looks empty", LOG_WARNING);
|
||||
}
|
||||
|
||||
// Load all lang files of module
|
||||
if (isset($objMod->langfiles) && is_array($objMod->langfiles))
|
||||
{
|
||||
foreach ($objMod->langfiles as $domain)
|
||||
{
|
||||
if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
|
||||
foreach ($objMod->langfiles as $domain) {
|
||||
$langs->load($domain);
|
||||
}
|
||||
}
|
||||
@@ -287,24 +290,30 @@ if (isset($objMod->langfiles) && is_array($objMod->langfiles))
|
||||
// Version (with picto warning or not)
|
||||
$version = $objMod->getVersion(0);
|
||||
$versiontrans = '';
|
||||
if (preg_match('/development/i', $version)) $versiontrans .= img_warning($langs->trans("Development"), 'style="float: left"');
|
||||
if (preg_match('/experimental/i', $version)) $versiontrans .= img_warning($langs->trans("Experimental"), 'style="float: left"');
|
||||
if (preg_match('/deprecated/i', $version)) $versiontrans .= img_warning($langs->trans("Deprecated"), 'style="float: left"');
|
||||
if (preg_match('/development/i', $version)) {
|
||||
$versiontrans .= img_warning($langs->trans("Development"), 'style="float: left"');
|
||||
}
|
||||
if (preg_match('/experimental/i', $version)) {
|
||||
$versiontrans .= img_warning($langs->trans("Experimental"), 'style="float: left"');
|
||||
}
|
||||
if (preg_match('/deprecated/i', $version)) {
|
||||
$versiontrans .= img_warning($langs->trans("Deprecated"), 'style="float: left"');
|
||||
}
|
||||
$versiontrans .= $objMod->getVersion(1);
|
||||
|
||||
// Define imginfo
|
||||
$imginfo = "info";
|
||||
if ($objMod->isCoreOrExternalModule() == 'external')
|
||||
{
|
||||
if ($objMod->isCoreOrExternalModule() == 'external') {
|
||||
$imginfo = "info_black";
|
||||
}
|
||||
|
||||
// Define text of description of module
|
||||
$text = '';
|
||||
|
||||
if ($mode == 'desc')
|
||||
{
|
||||
if ($moduledesc) $text .= '<br>'.$moduledesc.'<br><br><br>';
|
||||
if ($mode == 'desc') {
|
||||
if ($moduledesc) {
|
||||
$text .= '<br>'.$moduledesc.'<br><br><br>';
|
||||
}
|
||||
|
||||
$text .= '<span class="opacitymedium">'.$langs->trans("Version").':</span> '.$version;
|
||||
|
||||
@@ -312,13 +321,18 @@ if ($mode == 'desc')
|
||||
$text .= '<br><span class="opacitymedium">'.$langs->trans("DescriptorFile").':</span> '.$moduledescriptorfile;
|
||||
|
||||
$textexternal = '';
|
||||
if ($objMod->isCoreOrExternalModule() == 'external')
|
||||
{
|
||||
if ($objMod->isCoreOrExternalModule() == 'external') {
|
||||
$textexternal .= '<br><span class="opacitymedium">'.$langs->trans("Origin").':</span> '.$langs->trans("ExternalModule").' - '.$langs->trans("InstalledInto", $dirofmodule);
|
||||
if ($objMod->editor_name != 'dolibarr') $textexternal .= '<br><span class="opacitymedium">'.$langs->trans("Publisher").':</span> '.(empty($objMod->editor_name) ? $langs->trans("Unknown") : $objMod->editor_name);
|
||||
if ($objMod->editor_name != 'dolibarr') {
|
||||
$textexternal .= '<br><span class="opacitymedium">'.$langs->trans("Publisher").':</span> '.(empty($objMod->editor_name) ? $langs->trans("Unknown") : $objMod->editor_name);
|
||||
}
|
||||
$editor_url = $objMod->editor_url;
|
||||
if (!preg_match('/^http/', $editor_url)) $editor_url = 'http://'.$editor_url;
|
||||
if (!empty($objMod->editor_url) && !preg_match('/dolibarr\.org/i', $objMod->editor_url)) $textexternal .= ($objMod->editor_name != 'dolibarr' ? ' - ' : '').img_picto('', 'globe').' <a href="'.$editor_url.'" target="_blank">'.$objMod->editor_url.'</a>';
|
||||
if (!preg_match('/^http/', $editor_url)) {
|
||||
$editor_url = 'http://'.$editor_url;
|
||||
}
|
||||
if (!empty($objMod->editor_url) && !preg_match('/dolibarr\.org/i', $objMod->editor_url)) {
|
||||
$textexternal .= ($objMod->editor_name != 'dolibarr' ? ' - ' : '').img_picto('', 'globe').' <a href="'.$editor_url.'" target="_blank">'.$objMod->editor_url.'</a>';
|
||||
}
|
||||
$text .= $textexternal;
|
||||
$text .= '<br>';
|
||||
} else {
|
||||
@@ -326,109 +340,119 @@ if ($mode == 'desc')
|
||||
}
|
||||
|
||||
$moduledesclong = $objMod->getDescLong();
|
||||
if ($moduledesclong) $text .= '<br><hr><div class="moduledesclong">'.$moduledesclong.'<div>';
|
||||
if ($moduledesclong) {
|
||||
$text .= '<br><hr><div class="moduledesclong">'.$moduledesclong.'<div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode == 'feature')
|
||||
{
|
||||
if ($mode == 'feature') {
|
||||
$text .= '<br><strong>'.$langs->trans("DependsOn").':</strong> ';
|
||||
if (count($objMod->depends)) $text .= join(',', $objMod->depends);
|
||||
else $text .= $langs->trans("None");
|
||||
if (count($objMod->depends)) {
|
||||
$text .= join(',', $objMod->depends);
|
||||
} else {
|
||||
$text .= $langs->trans("None");
|
||||
}
|
||||
$text .= '<br><strong>'.$langs->trans("RequiredBy").':</strong> ';
|
||||
if (count($objMod->requiredby)) $text .= join(',', $objMod->requiredby);
|
||||
else $text .= $langs->trans("None");
|
||||
if (count($objMod->requiredby)) {
|
||||
$text .= join(',', $objMod->requiredby);
|
||||
} else {
|
||||
$text .= $langs->trans("None");
|
||||
}
|
||||
|
||||
$text .= '<br><br>';
|
||||
|
||||
$text .= '<br><strong>'.$langs->trans("AddDataTables").':</strong> ';
|
||||
$sqlfiles = dol_dir_list(dol_buildpath($moduledir.'/sql/'), 'files', 0, 'llx.*\.sql', array('\.key\.sql', '\.sql\.back'));
|
||||
if (count($sqlfiles) > 0)
|
||||
{
|
||||
if (count($sqlfiles) > 0) {
|
||||
$text .= $langs->trans("Yes").' (';
|
||||
$i = 0;
|
||||
foreach ($sqlfiles as $val)
|
||||
{
|
||||
foreach ($sqlfiles as $val) {
|
||||
$text .= ($i ? ', ' : '').preg_replace('/\.sql$/', '', preg_replace('/llx_/', '', $val['name']));
|
||||
$i++;
|
||||
}
|
||||
$text .= ')';
|
||||
} else $text .= $langs->trans("No");
|
||||
} else {
|
||||
$text .= $langs->trans("No");
|
||||
}
|
||||
|
||||
$text .= '<br>';
|
||||
|
||||
$text .= '<br><strong>'.$langs->trans("AddDictionaries").':</strong> ';
|
||||
if (isset($objMod->dictionaries) && isset($objMod->dictionaries['tablib']) && is_array($objMod->dictionaries['tablib']) && count($objMod->dictionaries['tablib']))
|
||||
{
|
||||
if (isset($objMod->dictionaries) && isset($objMod->dictionaries['tablib']) && is_array($objMod->dictionaries['tablib']) && count($objMod->dictionaries['tablib'])) {
|
||||
$i = 0;
|
||||
foreach ($objMod->dictionaries['tablib'] as $val)
|
||||
{
|
||||
foreach ($objMod->dictionaries['tablib'] as $val) {
|
||||
$text .= ($i ? ', ' : '').$val;
|
||||
$i++;
|
||||
}
|
||||
} else $text .= $langs->trans("No");
|
||||
} else {
|
||||
$text .= $langs->trans("No");
|
||||
}
|
||||
|
||||
$text .= '<br>';
|
||||
|
||||
$text .= '<br><strong>'.$langs->trans("AddData").':</strong> ';
|
||||
$filedata = dol_buildpath($moduledir.'/sql/data.sql');
|
||||
if (dol_is_file($filedata))
|
||||
{
|
||||
if (dol_is_file($filedata)) {
|
||||
$text .= $langs->trans("Yes").' ('.$moduledir.'/sql/data.sql)';
|
||||
} else $text .= $langs->trans("No");
|
||||
} else {
|
||||
$text .= $langs->trans("No");
|
||||
}
|
||||
|
||||
$text .= '<br>';
|
||||
|
||||
$text .= '<br><strong>'.$langs->trans("AddRemoveTabs").':</strong> ';
|
||||
if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs))
|
||||
{
|
||||
if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs)) {
|
||||
$i = 0;
|
||||
foreach ($objMod->tabs as $val)
|
||||
{
|
||||
if (is_array($val)) $val = $val['data'];
|
||||
if (is_string($val))
|
||||
{
|
||||
foreach ($objMod->tabs as $val) {
|
||||
if (is_array($val)) {
|
||||
$val = $val['data'];
|
||||
}
|
||||
if (is_string($val)) {
|
||||
$tmp = explode(':', $val, 3);
|
||||
$text .= ($i ? ', ' : '').$tmp[0].':'.$tmp[1];
|
||||
$i++;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
} else $text .= $langs->trans("No");
|
||||
} else {
|
||||
$text .= $langs->trans("No");
|
||||
}
|
||||
|
||||
$text .= '<br>';
|
||||
|
||||
$text .= '<br><strong>'.$langs->trans("AddModels").':</strong> ';
|
||||
if (isset($objMod->module_parts) && isset($objMod->module_parts['models']) && $objMod->module_parts['models'])
|
||||
{
|
||||
if (isset($objMod->module_parts) && isset($objMod->module_parts['models']) && $objMod->module_parts['models']) {
|
||||
$text .= $langs->trans("Yes");
|
||||
} else $text .= $langs->trans("No");
|
||||
} else {
|
||||
$text .= $langs->trans("No");
|
||||
}
|
||||
|
||||
$text .= '<br>';
|
||||
|
||||
$text .= '<br><strong>'.$langs->trans("AddSubstitutions").':</strong> ';
|
||||
if (isset($objMod->module_parts) && isset($objMod->module_parts['substitutions']) && $objMod->module_parts['substitutions'])
|
||||
{
|
||||
if (isset($objMod->module_parts) && isset($objMod->module_parts['substitutions']) && $objMod->module_parts['substitutions']) {
|
||||
$text .= $langs->trans("Yes");
|
||||
} else $text .= $langs->trans("No");
|
||||
} else {
|
||||
$text .= $langs->trans("No");
|
||||
}
|
||||
|
||||
$text .= '<br>';
|
||||
|
||||
$text .= '<br><strong>'.$langs->trans("AddSheduledJobs").':</strong> ';
|
||||
if (isset($objMod->cronjobs) && is_array($objMod->cronjobs) && count($objMod->cronjobs))
|
||||
{
|
||||
if (isset($objMod->cronjobs) && is_array($objMod->cronjobs) && count($objMod->cronjobs)) {
|
||||
$i = 0;
|
||||
foreach ($objMod->cronjobs as $val)
|
||||
{
|
||||
foreach ($objMod->cronjobs as $val) {
|
||||
$text .= ($i ? ', ' : '').($val['label']);
|
||||
$i++;
|
||||
}
|
||||
} else $text .= $langs->trans("No");
|
||||
} else {
|
||||
$text .= $langs->trans("No");
|
||||
}
|
||||
|
||||
$text .= '<br>';
|
||||
|
||||
$text .= '<br><strong>'.$langs->trans("AddTriggers").':</strong> ';
|
||||
$moreinfoontriggerfile = '';
|
||||
if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers'])
|
||||
{
|
||||
if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers']) {
|
||||
$yesno = 'Yes';
|
||||
} else {
|
||||
$yesno = 'No';
|
||||
@@ -436,10 +460,8 @@ if ($mode == 'feature')
|
||||
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)
|
||||
{
|
||||
foreach ($triggers as $triggercursor) {
|
||||
if ($triggercursor['module'] == $moduledir) {
|
||||
$yesno = 'Yes';
|
||||
$moreinfoontriggerfile = ' ('.$triggercursor['relpath'].')';
|
||||
}
|
||||
@@ -450,33 +472,30 @@ if ($mode == 'feature')
|
||||
$text .= '<br>';
|
||||
|
||||
$text .= '<br><strong>'.$langs->trans("AddBoxes").':</strong> ';
|
||||
if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes))
|
||||
{
|
||||
if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes)) {
|
||||
$i = 0;
|
||||
foreach ($objMod->boxes as $val)
|
||||
{
|
||||
foreach ($objMod->boxes as $val) {
|
||||
$text .= ($i ? ', ' : '').($val['file'] ? $val['file'] : $val[0]);
|
||||
$i++;
|
||||
}
|
||||
} else $text .= $langs->trans("No");
|
||||
} else {
|
||||
$text .= $langs->trans("No");
|
||||
}
|
||||
|
||||
$text .= '<br>';
|
||||
|
||||
$text .= '<br><strong>'.$langs->trans("AddHooks").':</strong> ';
|
||||
if (isset($objMod->module_parts) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks']))
|
||||
{
|
||||
if (isset($objMod->module_parts) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks'])) {
|
||||
$i = 0;
|
||||
foreach ($objMod->module_parts['hooks'] as $key => $val)
|
||||
{
|
||||
if ($key === 'entity') continue;
|
||||
foreach ($objMod->module_parts['hooks'] as $key => $val) {
|
||||
if ($key === 'entity') {
|
||||
continue;
|
||||
}
|
||||
|
||||
// For special values
|
||||
if ($key === 'data')
|
||||
{
|
||||
if (is_array($val))
|
||||
{
|
||||
foreach ($val as $value)
|
||||
{
|
||||
if ($key === 'data') {
|
||||
if (is_array($val)) {
|
||||
foreach ($val as $value) {
|
||||
$text .= ($i ? ', ' : '').($value);
|
||||
$i++;
|
||||
}
|
||||
@@ -488,54 +507,57 @@ if ($mode == 'feature')
|
||||
$text .= ($i ? ', ' : '').($val);
|
||||
$i++;
|
||||
}
|
||||
} else $text .= $langs->trans("No");
|
||||
} else {
|
||||
$text .= $langs->trans("No");
|
||||
}
|
||||
|
||||
$text .= '<br>';
|
||||
|
||||
$text .= '<br><strong>'.$langs->trans("AddPermissions").':</strong> ';
|
||||
if (isset($objMod->rights) && is_array($objMod->rights) && count($objMod->rights))
|
||||
{
|
||||
if (isset($objMod->rights) && is_array($objMod->rights) && count($objMod->rights)) {
|
||||
$i = 0;
|
||||
foreach ($objMod->rights as $val)
|
||||
{
|
||||
foreach ($objMod->rights as $val) {
|
||||
$text .= ($i ? ', ' : '').($val[1]);
|
||||
$i++;
|
||||
}
|
||||
} else $text .= $langs->trans("No");
|
||||
} else {
|
||||
$text .= $langs->trans("No");
|
||||
}
|
||||
|
||||
$text .= '<br>';
|
||||
|
||||
$text .= '<br><strong>'.$langs->trans("AddMenus").':</strong> ';
|
||||
if (isset($objMod->menu) && !empty($objMod->menu)) // objMod can be an array or just an int 1
|
||||
{
|
||||
if (isset($objMod->menu) && !empty($objMod->menu)) { // objMod can be an array or just an int 1
|
||||
$text .= $langs->trans("Yes");
|
||||
} else $text .= $langs->trans("No");
|
||||
} else {
|
||||
$text .= $langs->trans("No");
|
||||
}
|
||||
|
||||
$text .= '<br>';
|
||||
|
||||
$text .= '<br><strong>'.$langs->trans("AddExportProfiles").':</strong> ';
|
||||
if (isset($objMod->export_label) && is_array($objMod->export_label) && count($objMod->export_label))
|
||||
{
|
||||
if (isset($objMod->export_label) && is_array($objMod->export_label) && count($objMod->export_label)) {
|
||||
$i = 0;
|
||||
foreach ($objMod->export_label as $val)
|
||||
{
|
||||
foreach ($objMod->export_label as $val) {
|
||||
$text .= ($i ? ', ' : '').($val);
|
||||
$i++;
|
||||
}
|
||||
} else $text .= $langs->trans("No");
|
||||
} else {
|
||||
$text .= $langs->trans("No");
|
||||
}
|
||||
|
||||
$text .= '<br>';
|
||||
|
||||
$text .= '<br><strong>'.$langs->trans("AddImportProfiles").':</strong> ';
|
||||
if (isset($objMod->import_label) && is_array($objMod->import_label) && count($objMod->import_label))
|
||||
{
|
||||
if (isset($objMod->import_label) && is_array($objMod->import_label) && count($objMod->import_label)) {
|
||||
$i = 0;
|
||||
foreach ($objMod->import_label as $val)
|
||||
{
|
||||
foreach ($objMod->import_label as $val) {
|
||||
$text .= ($i ? ', ' : '').($val);
|
||||
$i++;
|
||||
}
|
||||
} else $text .= $langs->trans("No");
|
||||
} else {
|
||||
$text .= $langs->trans("No");
|
||||
}
|
||||
|
||||
$text .= '<br>';
|
||||
|
||||
@@ -544,11 +566,13 @@ if ($mode == 'feature')
|
||||
}
|
||||
|
||||
|
||||
if ($mode == 'changelog')
|
||||
{
|
||||
if ($mode == 'changelog') {
|
||||
$changelog = $objMod->getChangeLog();
|
||||
if ($changelog) $text .= '<div class="moduledesclong">'.$changelog.'<div>';
|
||||
else $text .= '<div class="moduledesclong">'.$langs->trans("NotAvailable").'</div>';
|
||||
if ($changelog) {
|
||||
$text .= '<div class="moduledesclong">'.$changelog.'<div>';
|
||||
} else {
|
||||
$text .= '<div class="moduledesclong">'.$langs->trans("NotAvailable").'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
print $text;
|
||||
|
||||
Reference in New Issue
Block a user