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"));
88'@phan-var-force DolibarrModules[] $modules';
95$modNameLoaded = array();
98foreach ($modulesdir as $dir) {
101 dol_syslog(
"Scan directory ".$dir.
" for module descriptor files (modXXX.class.php)");
102 $handle = @opendir($dir);
103 if (is_resource($handle)) {
104 while (($file = readdir($handle)) !==
false) {
106 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
107 $modName = substr($file, 0,
dol_strlen($file) - 10);
110 if (!empty($modNameLoaded[$modName])) {
111 $mesg =
"Error: Module ".$modName.
" was found twice: Into ".$modNameLoaded[$modName].
" and ".$dir.
". You probably have an old file on your disk.<br>";
118 $res = include_once $dir.$file;
119 if (class_exists($modName)) {
121 $objMod =
new $modName($db);
122 '@phan-var-force DolibarrModules $objMod';
123 $modNameLoaded[$modName] = $dir;
125 if (!$objMod->numero > 0 && $modName !=
'modUser') {
126 dol_syslog(
'The module descriptor '.$modName.
' must have a numero property', LOG_ERR);
128 $j = $objMod->numero;
130 $modulequalified = 1;
133 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
135 $modulequalified = 0;
138 $modulequalified = 0;
141 $modulequalified = 0;
147 if ($modulequalified > 0) {
149 $external = ($objMod->isCoreOrExternalModule() ==
'external');
152 $arrayofnatures[
'external_'.$publisher] = $langs->trans(
"External").
' - '.$publisher;
154 $arrayofnatures[
'external_'] = $langs->trans(
"External").
' - '.$langs->trans(
"UnknownPublishers");
157 ksort($arrayofnatures);
161 if ($modulequalified > 0) {
162 $modules[$i] = $objMod;
163 $filename[$i] = $modName;
166 if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) {
167 $familyinfo = array_merge($familyinfo, $objMod->familyinfo);
168 $familykey = key($objMod->familyinfo);
170 $familykey = $objMod->family;
172 if (empty($familykey) || $familykey ===
null) {
173 $familykey =
'other';
176 $moduleposition = ($objMod->module_position ? $objMod->module_position :
'50');
177 if ($moduleposition ==
'50' && ($objMod->isCoreOrExternalModule() ==
'external')) {
178 $moduleposition =
'80';
181 if (empty($familyinfo[$familykey][
'position'])) {
182 $familyinfo[$familykey][
'position'] =
'0';
185 $orders[$i] = $familyinfo[$familykey][
'position'].
"_".$familykey.
"_".$moduleposition.
"_".$j;
189 $specialstring =
'unknown';
190 if ($objMod->version ==
'development' || $objMod->version ==
'experimental') {
191 $specialstring =
'expdev';
193 if (isset($categ[$specialstring])) {
194 $categ[$specialstring]++;
196 $categ[$specialstring] = 1;
201 dol_syslog(
"Module ".get_class($objMod).
" not qualified");
204 dol_syslog(
"Failed to load ".$dir.$file.
" ".$e->getMessage(), LOG_ERR);
207 print
info_admin(
"Warning bad descriptor file : ".$dir.$file.
" (Class ".$modName.
" not found into file)", 0, 0,
'1',
'warning');
210 dol_syslog(
"Failed to load ".$dir.$file.
" ".$e->getMessage(), LOG_ERR);
217 dol_syslog(
"htdocs/admin/modulehelp.php: Failed to open directory ".$dir.
". See permission and open_basedir option.", LOG_WARNING);
231foreach ($orders as $tmpkey => $tmpvalue) {
232 $tmpMod = $modules[$tmpkey];
233 '@phan-var-force DolibarrModules $tmpMod';
234 if ($tmpMod->numero == $id) {
236 $modName = $filename[$tmpkey];
237 $dirofmodule = $dirmod[$tmpkey];
243if (!is_object($objMod)) {
244 $msg = __FILE__.
" Module with no found for id:".
$id;
249$value = $orders[$key];
250$tab = explode(
'_', $value);
251$familyposition = $tab[0];
253$module_position = $tab[2];
261$modulename = $objMod->getName();
262$moduledesc = $objMod->getDesc();
263$moduleauthor = $objMod->getPublisher();
264$moduledir = strtolower(preg_replace(
'/^mod/i',
'', get_class($objMod)));
266$const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
268$text =
'<span class="opacitymedium">'.$langs->trans(
"LastActivationDate").
':</span> ';
270 $text .=
dol_print_date($objMod->getLastActivationDate(),
'dayhour');
272 $text .= $langs->trans(
"Disabled");
274$tmp = $objMod->getLastActivationInfo();
275$authorid = (empty($tmp[
'authorid']) ?
'' : $tmp[
'authorid']);
277 $tmpuser =
new User($db);
278 $tmpuser->fetch($authorid);
279 $text .=
'<br><span class="opacitymedium">'.$langs->trans(
"LastActivationAuthor").
':</span> ';
280 $text .= $tmpuser->getNomUrl(-1);
282$ip = (empty($tmp[
'ip']) ?
'' : $tmp[
'ip']);
284 $text .=
'<br><span class="opacitymedium">'.$langs->trans(
"LastActivationIP").
':</span> ';
287$lastactivationversion = (empty($tmp[
'lastactivationversion']) ?
'' : $tmp[
'lastactivationversion']);
288if ($lastactivationversion) {
289 $text .=
'<br><span class="opacitymedium">'.$langs->trans(
"LastActivationVersion").
':</span> ';
290 $text .= $lastactivationversion;
295$title = ($modulename ? $modulename : $moduledesc);
297print
'<div class="centpercent">';
299$picto =
'object_'.$objMod->picto;
301print
load_fiche_titre(($modulename ? $modulename : $moduledesc), $moreinfo, $picto, 0,
'',
'titlemodulehelp');
307 dol_syslog(
"Error for module ".$key.
" - Property name of module looks empty", LOG_WARNING);
311if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
312 foreach ($objMod->langfiles as $domain) {
313 $langs->load($domain);
321$version = $objMod->getVersion(0);
323if (preg_match(
'/development/i', $version)) {
324 $versiontrans .=
img_warning($langs->trans(
"Development"),
'style="float: left"');
326if (preg_match(
'/experimental/i', $version)) {
327 $versiontrans .=
img_warning($langs->trans(
"Experimental"),
'style="float: left"');
329if (preg_match(
'/deprecated/i', $version)) {
330 $versiontrans .=
img_warning($langs->trans(
"Deprecated"),
'style="float: left"');
332$versiontrans .= $objMod->getVersion(1);
336if ($objMod->isCoreOrExternalModule() ==
'external') {
337 $imginfo =
"info_black";
343if ($mode ==
'desc') {
345 $text .=
'<br>'.$moduledesc.
'<br><br><br>';
348 $moduledescriptorfile = get_class($objMod).
'.class.php';
349 $text .=
'<span class="opacitymedium">'.$langs->trans(
"DescriptorFile").
':</span> '.$moduledescriptorfile;
351 $text .=
'<br><span class="opacitymedium">'.$langs->trans(
"IdModule").
':</span> '.$objMod->numero;
354 if ($objMod->isCoreOrExternalModule() ==
'external') {
355 $tmpdirofmoduletoshow = preg_replace(
'/^'.preg_quote(DOL_DOCUMENT_ROOT,
'/').
'/',
'', (
string) $dirofmodule);
356 $textexternal .=
'<br><span class="opacitymedium">'.$langs->trans(
"Origin").
':</span> '.$langs->trans(
"ExternalModule").
' - '.$langs->trans(
"InstalledInto", $tmpdirofmoduletoshow);
358 global $dolibarr_allow_download_external_modules;
359 if (!empty($dolibarr_allow_download_external_modules) && preg_match(
'/\/custom\//', (
string) $dirofmodule)) {
361 $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>';
364 if ($objMod->editor_name !=
'dolibarr') {
365 $textexternal .=
'<br><span class="opacitymedium">'.$langs->trans(
"Publisher").
':</span> '.(empty($objMod->editor_name) ? $langs->trans(
"Unknown") : $objMod->editor_name);
367 $editor_url = $objMod->editor_url;
368 if (!preg_match(
'/^http/', $editor_url)) {
369 $editor_url =
'http://'.$editor_url;
371 if (!empty($objMod->editor_url) && !preg_match(
'/dolibarr\.org/i', $objMod->editor_url)) {
372 $textexternal .= ($objMod->editor_name !=
'dolibarr' ?
' - ' :
'').
img_picto(
'',
'globe').
' <a href="'.$editor_url.
'" target="_blank" rel="noopener noreferrer external">'.$objMod->editor_url.
'</a>';
374 $text .= $textexternal;
376 $text .=
'<br><span class="opacitymedium">'.$langs->trans(
"Origin").
':</span> '.$langs->trans(
"Core");
377 if (empty($objMod->numero)) {
378 $text .=
' <span class="italic opacitymedium">('.$langs->trans(
"AlwaysEnabled").
')</span>';
379 } elseif (!empty($objMod->enabled_bydefault)) {
380 $text .=
' <span class="italic opacitymedium">('.$langs->trans(
"EnabledByDefaultAtInstall").
')</span>';
384 $text .=
'<br><span class="opacitymedium">'.$langs->trans(
"Version").
':</span> '.$version;
388 $moduledesclong = $objMod->getDescLong();
389 if ($moduledesclong) {
390 $text .=
'<br><hr><div class="moduledesclong">'.$moduledesclong.
'<div>';
394if ($mode ==
'feature') {
395 $text .=
'<br><strong>'.$langs->trans(
"DependsOn").
':</strong> ';
396 if (is_array($objMod->depends) && count($objMod->depends)) {
398 foreach ($objMod->depends as $modulestringorarray) {
399 if (is_array($modulestringorarray)) {
400 $text .= ($i ?
', ' :
'').implode(
', ', $modulestringorarray);
402 $text .= ($i ?
', ' :
'').$modulestringorarray;
407 $text .=
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
411 $text .=
'<br><strong>'.$langs->trans(
"RequiredBy").
':</strong> ';
412 if (is_array($objMod->requiredby) && count($objMod->requiredby)) {
414 foreach ($objMod->requiredby as $modulestringorarray) {
415 if (is_array($modulestringorarray)) {
416 $text .= ($i ?
', ' :
'').implode(
', ', $modulestringorarray);
418 $text .= ($i ?
', ' :
'').$modulestringorarray;
423 $text .=
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
428 $text .=
'<br><strong>'.$langs->trans(
"AddDataTables").
':</strong> ';
429 $listofsqlfiles1 =
dol_dir_list(DOL_DOCUMENT_ROOT.
'/install/mysql/tables/',
'files', 0,
'llx.*-'.$moduledir.
'\.sql', array(
'\.key\.sql',
'\.sql\.back'));
430 $listofsqlfiles2 =
dol_dir_list(
dol_buildpath($moduledir.
'/sql/'),
'files', 0,
'llx.*\.sql', array(
'\.key\.sql',
'\.sql\.back'));
431 $sqlfiles = array_merge($listofsqlfiles1, $listofsqlfiles2);
433 if (count($sqlfiles) > 0) {
435 foreach ($sqlfiles as $val) {
436 $text .= ($i ?
', ' :
'').preg_replace(
'/\-'.$moduledir.
'$/',
'', preg_replace(
'/\.sql$/',
'', preg_replace(
'/llx_/',
'', $val[
'name'])));
440 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
445 $text .=
'<br><strong>'.$langs->trans(
"AddDictionaries").
':</strong> ';
446 if (isset($objMod->dictionaries) && isset($objMod->dictionaries[
'tablib']) && is_array($objMod->dictionaries[
'tablib']) && count($objMod->dictionaries[
'tablib'])) {
448 foreach ($objMod->dictionaries[
'tablib'] as $val) {
449 $text .= ($i ?
', ' :
'').$val;
453 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
458 $text .=
'<br><strong>'.$langs->trans(
"AddData").
':</strong> ';
461 $text .= $langs->trans(
"Yes").
' <span class="opacitymedium">('.$moduledir.
'/sql/data.sql)</span>';
463 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
468 $text .=
'<br><strong>'.$langs->trans(
"AddRemoveTabs").
':</strong> ';
469 if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs)) {
471 foreach ($objMod->tabs as $val) {
472 if (is_array($val)) {
475 if (is_string($val)) {
476 $tmp = explode(
':', $val, 3);
477 $text .= ($i ?
', ' :
'').$tmp[0].
':'.$tmp[1];
482 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
487 $text .=
'<br><strong>'.$langs->trans(
"AddModels").
':</strong> ';
488 if (isset($objMod->module_parts) && isset($objMod->module_parts[
'models']) && $objMod->module_parts[
'models']) {
489 $text .= $langs->trans(
"Yes");
491 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
496 $text .=
'<br><strong>'.$langs->trans(
"AddSubstitutions").
':</strong> ';
497 if (isset($objMod->module_parts) && isset($objMod->module_parts[
'substitutions']) && $objMod->module_parts[
'substitutions']) {
498 $text .= $langs->trans(
"Yes");
500 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
505 $text .=
'<br><strong>'.$langs->trans(
"AddSheduledJobs").
':</strong> ';
506 if (isset($objMod->cronjobs) && is_array($objMod->cronjobs) && count($objMod->cronjobs)) {
508 foreach ($objMod->cronjobs as $val) {
509 $text .= ($i ?
', ' :
'').($val[
'label']);
513 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
518 $text .=
'<br><strong>'.$langs->trans(
"AddTriggers").
':</strong> ';
519 $moreinfoontriggerfile =
'';
520 if (isset($objMod->module_parts) && isset($objMod->module_parts[
'triggers']) && $objMod->module_parts[
'triggers']) {
523 $yesno =
'<span class="opacitymedium">No</span>';
525 require_once DOL_DOCUMENT_ROOT.
'/core/class/interfaces.class.php';
527 $triggers = $interfaces->getTriggersList(array((($objMod->isCoreOrExternalModule() ==
'external') ?
'/'.$moduledir :
'').
'/core/triggers'));
528 foreach ($triggers as $triggercursor) {
529 if ($triggercursor[
'module'] == $moduledir) {
531 $moreinfoontriggerfile =
' ('.$triggercursor[
'relpath'].
')';
535 $text .= $langs->trans($yesno).$moreinfoontriggerfile;
539 $text .=
'<br><strong>'.$langs->trans(
"AddBoxes").
':</strong> ';
540 if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes)) {
542 foreach ($objMod->boxes as $val) {
543 $boxstring = (empty($val[
'file']) ? (empty($val[0]) ?
'' : $val[0]) : $val[
'file']);
545 $text .= ($i ?
', ' :
'').$boxstring;
550 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
555 $text .=
'<br><strong>'.$langs->trans(
"AddHooks").
':</strong> ';
556 if (isset($objMod->module_parts) && isset($objMod->module_parts[
'hooks']) && is_array($objMod->module_parts[
'hooks']) && count($objMod->module_parts[
'hooks'])) {
558 foreach ($objMod->module_parts[
'hooks'] as $key => $val) {
559 if ($key ===
'entity') {
564 if ($key ===
'data') {
565 if (is_array($val)) {
566 foreach ($val as $value) {
567 $text .= ($i ?
', ' :
'').($value);
575 $text .= ($i ?
', ' :
'').($val);
579 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
584 $text .=
'<br><strong>'.$langs->trans(
"AddPermissions").
':</strong> ';
585 if (isset($objMod->rights) && is_array($objMod->rights) && count($objMod->rights)) {
587 foreach ($objMod->rights as $val) {
588 $text .= ($i ?
', ' :
'').($val[1]);
592 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
597 $text .=
'<br><strong>'.$langs->trans(
"AddMenus").
':</strong> ';
598 if (isset($objMod->menu) && !empty($objMod->menu)) {
599 $text .= $langs->trans(
"Yes");
601 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
606 $text .=
'<br><strong>'.$langs->trans(
"AddExportProfiles").
':</strong> ';
607 if (isset($objMod->export_label) && is_array($objMod->export_label) && count($objMod->export_label)) {
609 foreach ($objMod->export_label as $val) {
610 $text .= ($i ?
', ' :
'').($val);
614 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
619 $text .=
'<br><strong>'.$langs->trans(
"AddImportProfiles").
':</strong> ';
620 if (isset($objMod->import_label) && is_array($objMod->import_label) && count($objMod->import_label)) {
622 foreach ($objMod->import_label as $val) {
623 $text .= ($i ?
', ' :
'').($val);
627 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
632 $text .=
'<br><strong>'.$langs->trans(
"AddWebsiteTemplates").
':</strong> ';
633 if (isset($objMod->module_parts) && isset($objMod->module_parts[
'websitetemplates']) && $objMod->module_parts[
'websitetemplates']) {
634 $text .= $langs->trans(
"Yes");
636 $text .=
'<span class="opacitymedium">'.$langs->trans(
"No").
'</span>';
641 $text .=
'<br><strong>'.$langs->trans(
"AddOtherPagesOrServices").
':</strong> ';
642 $text .=
'<span class="opacitymedium">'.$langs->trans(
"DetectionNotPossible").
'</span>';
646if ($mode ==
'changelog') {
647 $changelog = $objMod->getChangeLog();
649 $text .=
'<div class="moduledesclong">'.$changelog.
'<div>';
651 $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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return a 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.