Error management
This commit is contained in:
parent
7f8c0d0e7a
commit
21c58e9fab
@ -485,6 +485,7 @@ if ($dirins && $action == 'initcss' && !empty($module))
|
|||||||
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
|
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($dirins && $action == 'initjs' && !empty($module))
|
if ($dirins && $action == 'initjs' && !empty($module))
|
||||||
{
|
{
|
||||||
dol_mkdir($dirins.'/'.strtolower($module).'/js');
|
dol_mkdir($dirins.'/'.strtolower($module).'/js');
|
||||||
@ -1567,14 +1568,26 @@ $infomodulesfound = '<div style="padding: 12px 9px 12px">'.$form->textwithpicto(
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
$moduleobj = null;
|
$moduleobj = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!empty($module) && $module != 'initmodule' && $module != 'deletemodule')
|
if (!empty($module) && $module != 'initmodule' && $module != 'deletemodule')
|
||||||
{
|
{
|
||||||
$modulelowercase = strtolower($module);
|
$modulelowercase = strtolower($module);
|
||||||
|
$loadclasserrormessage = '';
|
||||||
|
|
||||||
// Load module
|
// Load module
|
||||||
$fullpathdirtodescriptor = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
|
try {
|
||||||
dol_include_once($fullpathdirtodescriptor);
|
$fullpathdirtodescriptor = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
|
||||||
$class = 'mod'.$module;
|
|
||||||
|
//throw(new Exception());
|
||||||
|
dol_include_once($fullpathdirtodescriptor);
|
||||||
|
|
||||||
|
$class = 'mod'.$module;
|
||||||
|
} catch(Throwable $e) { // This is called in PHP 7 only. Never call be keep rest of code ok with PHP 5.6
|
||||||
|
$loadclasserrormessage = $e->getMessage()."<br>\n";;
|
||||||
|
$loadclasserrormessage .= 'File: '.$e->getFile()."<br>\n";
|
||||||
|
$loadclasserrormessage .= 'Line: '.$e->getLine()."<br>\n";
|
||||||
|
}
|
||||||
|
|
||||||
if (class_exists($class))
|
if (class_exists($class))
|
||||||
{
|
{
|
||||||
@ -1589,6 +1602,7 @@ if (!empty($module) && $module != 'initmodule' && $module != 'deletemodule')
|
|||||||
if (empty($forceddirread)) $error++;
|
if (empty($forceddirread)) $error++;
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
print img_warning('').' '.$langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module).'<br>';
|
print img_warning('').' '.$langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module).'<br>';
|
||||||
|
print $loadclasserrormessage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1620,7 +1634,7 @@ if (is_array($listofmodules) && count($listofmodules) > 0) {
|
|||||||
$urltomodulesetup = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?search_keyword='.urlencode($module).'">'.$langs->trans('Home').'-'.$langs->trans("Setup").'-'.$langs->trans("Modules").'</a>';
|
$urltomodulesetup = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?search_keyword='.urlencode($module).'">'.$langs->trans('Home').'-'.$langs->trans("Setup").'-'.$langs->trans("Modules").'</a>';
|
||||||
if (!empty($conf->global->$const_name)) // If module is already activated
|
if (!empty($conf->global->$const_name)) // If module is already activated
|
||||||
{
|
{
|
||||||
$linktoenabledisable .= '<a class="reposition asetresetmodule" href="'.$_SERVER["PHP_SELF"].'?id='.$moduleobj->numero.'&action=reset&value=mod'.$module.$param.'">';
|
$linktoenabledisable .= '<a class="reposition asetresetmodule valignmiddle" href="'.$_SERVER["PHP_SELF"].'?id='.$moduleobj->numero.'&action=reset&value=mod'.$module.$param.'">';
|
||||||
$linktoenabledisable .= img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', '', 1);
|
$linktoenabledisable .= img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', '', 1);
|
||||||
$linktoenabledisable .= '</a>';
|
$linktoenabledisable .= '</a>';
|
||||||
|
|
||||||
@ -1656,7 +1670,7 @@ if (is_array($listofmodules) && count($listofmodules) > 0) {
|
|||||||
$linktoenabledisable .= ' <a href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1).'?save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').'</a>';
|
$linktoenabledisable .= ' <a href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1).'?save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').'</a>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$linktoenabledisable .= '<a class="reposition asetresetmodule" href="'.$_SERVER["PHP_SELF"].'?id='.$moduleobj->numero.'&action=set&value=mod'.$module.$param.'">';
|
$linktoenabledisable .= '<a class="reposition asetresetmodule valignmiddle" href="'.$_SERVER["PHP_SELF"].'?id='.$moduleobj->numero.'&action=set&value=mod'.$module.$param.'">';
|
||||||
$linktoenabledisable .= img_picto($langs->trans("ModuleIsNotActive", $urltomodulesetup), 'switch_off', '', false, 0, 0, '', 'classfortooltip', 1);
|
$linktoenabledisable .= img_picto($langs->trans("ModuleIsNotActive", $urltomodulesetup), 'switch_off', '', false, 0, 0, '', 'classfortooltip', 1);
|
||||||
$linktoenabledisable .= "</a>\n";
|
$linktoenabledisable .= "</a>\n";
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user