26if (!defined(
'NOREQUIREMENU')) {
27 define(
'NOREQUIREMENU',
'1');
29if (!defined(
'NOTOKENRENEWAL')) {
30 define(
'NOTOKENRENEWAL',
'1');
35require
'../main.inc.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
41$langs->loadLangs(array(
'errors',
'admin',
'modulebuilder',
'exports'));
43$mode =
GETPOST(
'mode',
'alpha');
44$action =
GETPOST(
'action',
'aZ09');
50if (empty($user->admin)) {
69$help_url =
'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
70llxHeader(
'', $langs->trans(
"Setup"), $help_url,
'', 0, 0,
'',
'',
'',
'mod-admin page-modulehelp');
72print
'<!-- Force style container -->'.
"\n".
'<style>
81$arrayofnatures = array(
'core' => $langs->transnoentitiesnoconv(
"Core"),
'external' => $langs->transnoentitiesnoconv(
"External").
' - '.$langs->trans(
"AllPublishers"));
94$modNameLoaded = array();
96foreach ($modulesdir as $dir) {
99 dol_syslog(
"Scan directory ".$dir.
" for module descriptor files (modXXX.class.php)");
100 $handle = @opendir($dir);
101 if (is_resource($handle)) {
102 while (($file = readdir($handle)) !==
false) {
104 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
105 $modName = substr($file, 0,
dol_strlen($file) - 10);
108 if (!empty($modNameLoaded[$modName])) {
109 $mesg =
"Error: Module ".$modName.
" was found twice: Into ".$modNameLoaded[$modName].
" and ".$dir.
". You probably have an old file on your disk.<br>";
116 $res = include_once $dir.$file;
117 if (class_exists($modName)) {
119 $objMod =
new $modName($db);
120 '@phan-var-force DolibarrModules $objMod';
121 $modNameLoaded[$modName] = $dir;
123 if (!$objMod->numero > 0 && $modName !=
'modUser') {
124 dol_syslog(
'The module descriptor '.$modName.
' must have a numero property', LOG_ERR);
126 $j = $objMod->numero;
128 $modulequalified = 1;
131 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
133 $modulequalified = 0;
136 $modulequalified = 0;
139 $modulequalified = 0;
145 if ($modulequalified > 0) {
147 $external = ($objMod->isCoreOrExternalModule() ==
'external');
150 $arrayofnatures[
'external_'.$publisher] = $langs->trans(
"External").
' - '.$publisher;
152 $arrayofnatures[
'external_'] = $langs->trans(
"External").
' - '.$langs->trans(
"UnknownPublishers");
155 ksort($arrayofnatures);
159 if ($modulequalified > 0) {
160 $modules[$i] = $objMod;
161 $filename[$i] = $modName;
164 if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) {
165 if (!is_array($familyinfo)) {
166 $familyinfo = array();
168 $familyinfo = array_merge($familyinfo, $objMod->familyinfo);
169 $familykey = key($objMod->familyinfo);
171 $familykey = $objMod->family;
173 if (empty($familykey) || $familykey ===
null) {
174 $familykey =
'other';
177 $moduleposition = ($objMod->module_position ? $objMod->module_position :
'50');
178 if ($moduleposition ==
'50' && ($objMod->isCoreOrExternalModule() ==
'external')) {
179 $moduleposition =
'80';
182 if (empty($familyinfo[$familykey][
'position'])) {
183 $familyinfo[$familykey][
'position'] =
'0';
186 $orders[$i] = $familyinfo[$familykey][
'position'].
"_".$familykey.
"_".$moduleposition.
"_".$j;
190 $specialstring =
'unknown';
191 if ($objMod->version ==
'development' || $objMod->version ==
'experimental') {
192 $specialstring =
'expdev';
194 if (isset($categ[$specialstring])) {
195 $categ[$specialstring]++;
197 $categ[$specialstring] = 1;
202 dol_syslog(
"Module ".get_class($objMod).
" not qualified");
205 dol_syslog(
"Failed to load ".$dir.$file.
" ".$e->getMessage(), LOG_ERR);
208 print
info_admin(
"Warning bad descriptor file : ".$dir.$file.
" (Class ".$modName.
" not found into file)", 0, 0,
'1',
'warning');
211 dol_syslog(
"Failed to load ".$dir.$file.
" ".$e->getMessage(), LOG_ERR);
218 dol_syslog(
"htdocs/admin/modulehelp.php: Failed to open directory ".$dir.
". See permission and open_basedir option.", LOG_WARNING);
230foreach ($orders as $tmpkey => $tmpvalue) {
231 $tmpMod = $modules[$tmpkey];
232 if ($tmpMod->numero == $id) {
234 $modName = $filename[$tmpkey];
235 $dirofmodule = $dirmod[$tmpkey];
241$value = $orders[$key];
242$tab = explode(
'_', $value);
243$familyposition = $tab[0];
245$module_position = $tab[2];
253$modulename = $objMod->getName();
254$moduledesc = $objMod->getDesc();
255$moduleauthor = $objMod->getPublisher();
256$moduledir = strtolower(preg_replace(
'/^mod/i',
'', get_class($objMod)));
258$const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
260$text =
'<span class="opacitymedium">'.$langs->trans(
"LastActivationDate").
':</span> ';
262 $text .=
dol_print_date($objMod->getLastActivationDate(),
'dayhour');
264 $text .= $langs->trans(
"Disabled");
266$tmp = $objMod->getLastActivationInfo();
267$authorid = (empty($tmp[
'authorid']) ?
'' : $tmp[
'authorid']);
269 $tmpuser =
new User($db);
270 $tmpuser->fetch($authorid);
271 $text .=
'<br><span class="opacitymedium">'.$langs->trans(
"LastActivationAuthor").
':</span> ';
272 $text .= $tmpuser->getNomUrl(-1);
274$ip = (empty($tmp[
'ip']) ?
'' : $tmp[
'ip']);
276 $text .=
'<br><span class="opacitymedium">'.$langs->trans(
"LastActivationIP").
':</span> ';
279$lastactivationversion = (empty($tmp[
'lastactivationversion']) ?
'' : $tmp[
'lastactivationversion']);
280if ($lastactivationversion) {
281 $text .=
'<br><span class="opacitymedium">'.$langs->trans(
"LastActivationVersion").
':</span> ';
282 $text .= $lastactivationversion;
287$title = ($modulename ? $modulename : $moduledesc);
289print
'<div class="centpercent">';
291$picto =
'object_'.$objMod->picto;
293print
load_fiche_titre(($modulename ? $modulename : $moduledesc), $moreinfo, $picto, 0,
'',
'titlemodulehelp');
299 dol_syslog(
"Error for module ".$key.
" - Property name of module looks empty", LOG_WARNING);
303if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
304 foreach ($objMod->langfiles as $domain) {
305 $langs->load($domain);
313$version = $objMod->getVersion(0);
315if (preg_match(
'/development/i', $version)) {
316 $versiontrans .=
img_warning($langs->trans(
"Development"),
'style="float: left"');
318if (preg_match(
'/experimental/i', $version)) {
319 $versiontrans .=
img_warning($langs->trans(
"Experimental"),
'style="float: left"');
321if (preg_match(
'/deprecated/i', $version)) {
322 $versiontrans .=
img_warning($langs->trans(
"Deprecated"),
'style="float: left"');
324$versiontrans .= $objMod->getVersion(1);
328if ($objMod->isCoreOrExternalModule() ==
'external') {
329 $imginfo =
"info_black";
335if ($mode ==
'desc') {
337 $text .=
'<br>'.$moduledesc.
'<br><br><br>';
340 $moduledescriptorfile = get_class($objMod).
'.class.php';
341 $text .=
'<span class="opacitymedium">'.$langs->trans(
"DescriptorFile").
':</span> '.$moduledescriptorfile;
343 $text .=
'<br><span class="opacitymedium">'.$langs->trans(
"IdModule").
':</span> '.$objMod->numero;
345 $text .=
'<br><span class="opacitymedium">'.$langs->trans(
"Version").
':</span> '.$version;
348 if ($objMod->isCoreOrExternalModule() ==
'external') {
349 $tmpdirofmoduletoshow = preg_replace(
'/^'.preg_quote(DOL_DOCUMENT_ROOT,
'/').
'/',
'', $dirofmodule);
350 $textexternal .=
'<br><span class="opacitymedium">'.$langs->trans(
"Origin").
':</span> '.$langs->trans(
"ExternalModule").
' - '.$langs->trans(
"InstalledInto", $tmpdirofmoduletoshow);
352 global $dolibarr_allow_download_external_modules;
353 if (!empty($dolibarr_allow_download_external_modules) && preg_match(
'/\/custom\//', $dirofmodule)) {
355 $textexternal .=
' <a href="'.DOL_URL_ROOT.
'/admin/tools/export_files.php?export_type=externalmodule&what='.urlencode($moduledir).
'&compression=zip&zipfilename_template=module_'.$moduledir.
'-'.$version.
'.notorig" target="_blank" rel="noopener">'.
img_picto(
'',
'download').
'</a>';
358 if ($objMod->editor_name !=
'dolibarr') {
359 $textexternal .=
'<br><span class="opacitymedium">'.$langs->trans(
"Publisher").
':</span> '.(empty($objMod->editor_name) ? $langs->trans(
"Unknown") : $objMod->editor_name);
361 $editor_url = $objMod->editor_url;
362 if (!preg_match(
'/^http/', $editor_url)) {
363 $editor_url =
'http://'.$editor_url;
365 if (!empty($objMod->editor_url) && !preg_match(
'/dolibarr\.org/i', $objMod->editor_url)) {
366 $textexternal .= ($objMod->editor_name !=
'dolibarr' ?
' - ' :
'').
img_picto(
'',
'globe').
' <a href="'.$editor_url.
'" target="_blank" rel="noopener noreferrer external">'.$objMod->editor_url.
'</a>';
368 $text .= $textexternal;
370 $text .=
'<br><span class="opacitymedium">'.$langs->trans(
"Origin").
':</span> '.$langs->trans(
"Core");
371 if (empty($objMod->numero)) {
372 $text .=
' <span class="italic opacitymedium">('.$langs->trans(
"AlwaysEnabled").
')</span>';
373 } elseif (!empty($objMod->enabled_bydefault)) {
374 $text .=
' <span class="italic opacitymedium">('.$langs->trans(
"EnabledByDefaultAtInstall").
')</span>';
380 $moduledesclong = $objMod->getDescLong();
381 if ($moduledesclong) {
382 $text .=
'<br><hr><div class="moduledesclong">'.$moduledesclong.
'<div>';
386if ($mode ==
'feature') {
387 $text .=
'<br><strong>'.$langs->trans(
"DependsOn").
':</strong> ';
388 if (is_array($objMod->depends) && count($objMod->depends)) {
390 foreach ($objMod->depends as $modulestringorarray) {
391 if (is_array($modulestringorarray)) {
392 $text .= ($i ?
', ' :
'').implode(
', ', $modulestringorarray);
394 $text .= ($i ?
', ' :
'').$modulestringorarray;
399 $text .=
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
403 $text .=
'<br><strong>'.$langs->trans(
"RequiredBy").
':</strong> ';
404 if (is_array($objMod->requiredby) && count($objMod->requiredby)) {
406 foreach ($objMod->requiredby as $modulestringorarray) {
407 if (is_array($modulestringorarray)) {
408 $text .= ($i ?
', ' :
'').implode(
', ', $modulestringorarray);
410 $text .= ($i ?
', ' :
'').$modulestringorarray;
415 $text .=
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
420 $text .=
'<br><strong>'.$langs->trans(
"AddDataTables").
':</strong> ';
421 $listofsqlfiles1 =
dol_dir_list(DOL_DOCUMENT_ROOT.
'/install/mysql/tables/',
'files', 0,
'llx.*-'.$moduledir.
'\.sql', array(
'\.key\.sql',
'\.sql\.back'));
422 $listofsqlfiles2 =
dol_dir_list(
dol_buildpath($moduledir.
'/sql/'),
'files', 0,
'llx.*\.sql', array(
'\.key\.sql',
'\.sql\.back'));
423 $sqlfiles = array_merge($listofsqlfiles1, $listofsqlfiles2);
425 if (count($sqlfiles) > 0) {
427 foreach ($sqlfiles as $val) {
428 $text .= ($i ?
', ' :
'').preg_replace(
'/\-'.$moduledir.
'$/',
'', preg_replace(
'/\.sql$/',
'', preg_replace(
'/llx_/',
'', $val[
'name'])));
432 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
437 $text .=
'<br><strong>'.$langs->trans(
"AddDictionaries").
':</strong> ';
438 if (isset($objMod->dictionaries) && isset($objMod->dictionaries[
'tablib']) && is_array($objMod->dictionaries[
'tablib']) && count($objMod->dictionaries[
'tablib'])) {
440 foreach ($objMod->dictionaries[
'tablib'] as $val) {
441 $text .= ($i ?
', ' :
'').$val;
445 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
450 $text .=
'<br><strong>'.$langs->trans(
"AddData").
':</strong> ';
453 $text .= $langs->trans(
"Yes").
' <span class="opacitymedium">('.$moduledir.
'/sql/data.sql)</span>';
455 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
460 $text .=
'<br><strong>'.$langs->trans(
"AddRemoveTabs").
':</strong> ';
461 if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs)) {
463 foreach ($objMod->tabs as $val) {
464 if (is_array($val)) {
467 if (is_string($val)) {
468 $tmp = explode(
':', $val, 3);
469 $text .= ($i ?
', ' :
'').$tmp[0].
':'.$tmp[1];
474 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
479 $text .=
'<br><strong>'.$langs->trans(
"AddModels").
':</strong> ';
480 if (isset($objMod->module_parts) && isset($objMod->module_parts[
'models']) && $objMod->module_parts[
'models']) {
481 $text .= $langs->trans(
"Yes");
483 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
488 $text .=
'<br><strong>'.$langs->trans(
"AddSubstitutions").
':</strong> ';
489 if (isset($objMod->module_parts) && isset($objMod->module_parts[
'substitutions']) && $objMod->module_parts[
'substitutions']) {
490 $text .= $langs->trans(
"Yes");
492 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
497 $text .=
'<br><strong>'.$langs->trans(
"AddSheduledJobs").
':</strong> ';
498 if (isset($objMod->cronjobs) && is_array($objMod->cronjobs) && count($objMod->cronjobs)) {
500 foreach ($objMod->cronjobs as $val) {
501 $text .= ($i ?
', ' :
'').($val[
'label']);
505 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
510 $text .=
'<br><strong>'.$langs->trans(
"AddTriggers").
':</strong> ';
511 $moreinfoontriggerfile =
'';
512 if (isset($objMod->module_parts) && isset($objMod->module_parts[
'triggers']) && $objMod->module_parts[
'triggers']) {
515 $yesno =
'<span class="opacitymedium">No</span>';
517 require_once DOL_DOCUMENT_ROOT.
'/core/class/interfaces.class.php';
519 $triggers = $interfaces->getTriggersList(array((($objMod->isCoreOrExternalModule() ==
'external') ?
'/'.$moduledir :
'').
'/core/triggers'));
520 foreach ($triggers as $triggercursor) {
521 if ($triggercursor[
'module'] == $moduledir) {
523 $moreinfoontriggerfile =
' ('.$triggercursor[
'relpath'].
')';
527 $text .= $langs->trans($yesno).$moreinfoontriggerfile;
531 $text .=
'<br><strong>'.$langs->trans(
"AddBoxes").
':</strong> ';
532 if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes)) {
534 foreach ($objMod->boxes as $val) {
535 $boxstring = (empty($val[
'file']) ? (empty($val[0]) ?
'' : $val[0]) : $val[
'file']);
537 $text .= ($i ?
', ' :
'').$boxstring;
542 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
547 $text .=
'<br><strong>'.$langs->trans(
"AddHooks").
':</strong> ';
548 if (isset($objMod->module_parts) && isset($objMod->module_parts[
'hooks']) && is_array($objMod->module_parts[
'hooks']) && count($objMod->module_parts[
'hooks'])) {
550 foreach ($objMod->module_parts[
'hooks'] as $key => $val) {
551 if ($key ===
'entity') {
556 if ($key ===
'data') {
557 if (is_array($val)) {
558 foreach ($val as $value) {
559 $text .= ($i ?
', ' :
'').($value);
567 $text .= ($i ?
', ' :
'').($val);
571 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
576 $text .=
'<br><strong>'.$langs->trans(
"AddPermissions").
':</strong> ';
577 if (isset($objMod->rights) && is_array($objMod->rights) && count($objMod->rights)) {
579 foreach ($objMod->rights as $val) {
580 $text .= ($i ?
', ' :
'').($val[1]);
584 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
589 $text .=
'<br><strong>'.$langs->trans(
"AddMenus").
':</strong> ';
590 if (isset($objMod->menu) && !empty($objMod->menu)) {
591 $text .= $langs->trans(
"Yes");
593 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
598 $text .=
'<br><strong>'.$langs->trans(
"AddExportProfiles").
':</strong> ';
599 if (isset($objMod->export_label) && is_array($objMod->export_label) && count($objMod->export_label)) {
601 foreach ($objMod->export_label as $val) {
602 $text .= ($i ?
', ' :
'').($val);
606 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
611 $text .=
'<br><strong>'.$langs->trans(
"AddImportProfiles").
':</strong> ';
612 if (isset($objMod->import_label) && is_array($objMod->import_label) && count($objMod->import_label)) {
614 foreach ($objMod->import_label as $val) {
615 $text .= ($i ?
', ' :
'').($val);
619 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
624 $text .=
'<br><strong>'.$langs->trans(
"AddWebsiteTemplates").
':</strong> ';
625 if (isset($objMod->module_parts) && isset($objMod->module_parts[
'websitetemplates']) && $objMod->module_parts[
'websitetemplates']) {
626 $text .= $langs->trans(
"Yes");
628 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
633 $text .=
'<br><strong>'.$langs->trans(
"AddOtherPagesOrServices").
':</strong> ';
634 $text .=
'<span class="opacitymedium">'.$langs->trans(
"DetectionNotPossible").
'</span>';
638if ($mode ==
'changelog') {
639 $changelog = $objMod->getChangeLog();
641 $text .=
'<div class="moduledesclong">'.$changelog.
'<div>';
643 $text .=
'<div class="moduledesclong"><span class="opacitymedium">'.$langs->trans(
"NotAvailable").
'</span></div>';
modulehelp_prepare_head($object)
Prepare array with list of tabs.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage triggers.
Class to manage Dolibarr users.
dol_is_file($pathoffile)
Return if path is a file.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
dolGetModulesDirs($subdir='')
Return list of directories that contain modules.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.