Debug v23

This commit is contained in:
Laurent Destailleur
2025-12-04 14:00:34 +01:00
parent e329c11e82
commit 39e200eb50
4 changed files with 44 additions and 30 deletions

View File

@@ -801,7 +801,8 @@ if ($sql) {
print '</div></div></div>';
$parameters = array('user' => $user);
$reshook = $hookmanager->executeHooks('dashboardAccountancy', $parameters, $object); // Note that $action and $object may have been modified by hook
$object = null;
$reshook = $hookmanager->executeHooks('dashboardAccountancy', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
// End of page
llxFooter();

View File

@@ -12698,7 +12698,6 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type,
function printCommonFooter($zone = 'private')
{
global $conf, $hookmanager, $user, $langs;
global $debugbar;
global $action;
global $micro_start_time;
@@ -12712,8 +12711,9 @@ function printCommonFooter($zone = 'private')
print "\n<!-- A div to store page_y POST parameter -->\n";
print '<div id="page_y" style="display: none;">' . (GETPOST('page_y') ? GETPOST('page_y') : '') . '</div>' . "\n";
$parameters = array();
$reshook = $hookmanager->executeHooks('printCommonFooter', $parameters); // Note that $action and $object may have been modified by some hooks
$parameters = array('zone' => $zone);
$tmpobject = null;
$reshook = $hookmanager->executeHooks('printCommonFooter', $parameters, $tmpobject, $action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) {
if (getDolGlobalString('MAIN_HTML_FOOTER')) {
print getDolGlobalString('MAIN_HTML_FOOTER') . "\n";
@@ -12907,7 +12907,7 @@ function printCommonFooter($zone = 'private')
print "\n" . '</script>' . "\n";
// Google Analytics
// TODO Add a hook here
// TODO Remove this, can be replaced with the hook printCommonFooter
if (isModEnabled('google') && getDolGlobalString('MAIN_GOOGLE_AN_ID')) {
$tmptagarray = explode(',', getDolGlobalString('MAIN_GOOGLE_AN_ID'));
foreach ($tmptagarray as $tmptag) {
@@ -12933,15 +12933,23 @@ function printCommonFooter($zone = 'private')
print_r(xdebug_get_code_coverage());
}
// Output string from hooks
if (!empty($hookmanager->resPrint)) {
print $hookmanager->resPrint;
}
// Add DebugBar data
if ($user->hasRight('debugbar', 'read') && $debugbar instanceof DebugBar\DebugBar) {
if (isset($debugbar['time'])) {
// @phan-suppress-next-line PhanPluginUnknownObjectMethodCall
$debugbar['time']->stopMeasure('pageaftermaster');
if ($user->hasRight('debugbar', 'read')) {
global $debugbar;
if ($debugbar instanceof DebugBar\DebugBar) {
if (isset($debugbar['time'])) {
// @phan-suppress-next-line PhanPluginUnknownObjectMethodCall
$debugbar['time']->stopMeasure('pageaftermaster');
}
print '<!-- Output debugbar data -->' . "\n";
$renderer = $debugbar->getJavascriptRenderer();
print $renderer->render();
}
print '<!-- Output debugbar data -->' . "\n";
$renderer = $debugbar->getJavascriptRenderer();
print $renderer->render();
} elseif (count($conf->logbuffer)) { // If there is some logs in buffer to show
print "\n";
print "<!-- Start of log output\n";

View File

@@ -29,13 +29,6 @@
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
/**
* @var Conf $conf
* @var DoliDB $db
@@ -43,6 +36,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
* @var Translate $langs
* @var User $user
*/
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
// Load translation files required by the page
$langs->loadLangs(array('projects', 'other'));
@@ -90,6 +89,7 @@ restrictedArea($user, 'projet', $object->fk_project, 'projet&project');
$permissiontoadd = $user->hasRight('projet', 'creer'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php
/*
* Actions
*/

View File

@@ -23,11 +23,8 @@
* \brief Page to show information on a task
*/
require "../../main.inc.php";
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
// Load Dolibarr environment
require '../../main.inc.php';
/**
* @var Conf $conf
* @var DoliDB $db
@@ -35,9 +32,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
* @var Translate $langs
* @var User $user
*/
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
// Load translation files required by the page
$langs->load('projects');
$langs->loadLangs(array('projects'));
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
@@ -88,7 +88,8 @@ if (!empty($project_ref) && !empty($withproject)) {
$id = $tasksarray[0]->id;
$object->fetch($id);
} else {
header("Location: ".DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.(empty($mode) ? '' : '&mode='.$mode));
header("Location: ".DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.($withproject ? '&withproject=1' : '').(empty($mode) ? '' : '&mode='.$mode));
exit;
}
}
}
@@ -134,6 +135,8 @@ $help_url = '';
llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-project project-tasks page-task_note');
if ($object->id > 0) {
$projectstatic->fetch_thirdparty();
$userWrite = $projectstatic->restrictedProjectArea($user, 'write');
if (!empty($withproject)) {
@@ -245,7 +248,7 @@ if ($object->id > 0) {
print '<div class="fichehalfright">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
print '<table class="border tableforfield centpercent">';
// Categories
if (isModEnabled('category')) {
@@ -285,9 +288,9 @@ if ($object->id > 0) {
if (!GETPOST('withproject') || empty($projectstatic->id)) {
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1);
$object->next_prev_filter = " fk_projet:IN:".$db->sanitize($projectsListId);
$object->next_prev_filter = "fk_projet:IN:".$db->sanitize($projectsListId);
} else {
$object->next_prev_filter = " fk_projet:=:".((int) $projectstatic->id);
$object->next_prev_filter = "fk_projet:=:".((int) $projectstatic->id);
}
$morehtmlref = '';
@@ -301,7 +304,9 @@ if ($object->id > 0) {
// Third party
$morehtmlref .= $langs->trans("ThirdParty").': ';
$morehtmlref .= $projectstatic->thirdparty->getNomUrl(1);
if (is_object($projectstatic->thirdparty) && $projectstatic->thirdparty->id > 0) {
$morehtmlref .= $projectstatic->thirdparty->getNomUrl(1);
}
$morehtmlref .= '</div>';
}