Debug v16

This commit is contained in:
Laurent Destailleur 2022-07-26 11:04:52 +02:00
parent d0e74fbbeb
commit d65ea8c333
2 changed files with 24 additions and 12 deletions

View File

@ -37,11 +37,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/project/task/modules_task.php';
// Load translation files required by the page
$langs->loadlangs(array('projects', 'companies'));
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$id = GETPOST('id', 'int');
$ref = GETPOST("ref", 'alpha', 1); // task ref
$taskref = GETPOST("taskref", 'alpha'); // task ref
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$withproject = GETPOST('withproject', 'int');
$project_ref = GETPOST('project_ref', 'alpha');
$planned_workload = ((GETPOST('planned_workloadhour', 'int') != '' || GETPOST('planned_workloadmin', 'int') != '') ? (GETPOST('planned_workloadhour', 'int') > 0 ?GETPOST('planned_workloadhour', 'int') * 3600 : 0) + (GETPOST('planned_workloadmin', 'int') > 0 ?GETPOST('planned_workloadmin', 'int') * 60 : 0) : '');
@ -233,7 +234,7 @@ if ($id > 0 || !empty($ref)) {
// Title
$morehtmlref .= $projectstatic->title;
// Thirdparty
if ($projectstatic->thirdparty->id > 0) {
if (!empty($projectstatic->thirdparty->id) &&$projectstatic->thirdparty->id > 0) {
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '</div>';
@ -244,7 +245,7 @@ if ($id > 0 || !empty($ref)) {
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
@ -325,7 +326,7 @@ if ($id > 0 || !empty($ref)) {
print '<div class="fichehalfright">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="border tableforfield centpercent">';
// Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
@ -509,7 +510,7 @@ if ($id > 0 || !empty($ref)) {
// Third party
$morehtmlref .= $langs->trans("ThirdParty").': ';
if (!empty($projectstatic->thirdparty)) {
if (!empty($projectstatic->thirdparty) && is_object($projectstatic->thirdparty)) {
$morehtmlref .= $projectstatic->thirdparty->getNomUrl(1);
}
$morehtmlref .= '</div>';

View File

@ -98,8 +98,10 @@ $childids = $user->getAllChildIds(1);
$hookmanager->initHooks(array('projecttasktime', 'globalcard'));
$object = new Task($db);
$projectstatic = new Project($db);
$extrafields = new ExtraFields($db);
$projectstatic = new Project($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($projectstatic->table_element);
$extrafields->fetch_name_optionals_label($object->table_element);
@ -790,7 +792,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print '<table class="border tableforfield centpercent">';
// Usage
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || !empty($conf->eventorganization->enabled)) {
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled('eventorganization')) {
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
@ -813,7 +815,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '<br>';
}
if (!empty($conf->eventorganization->enabled)) {
if (isModEnabled('eventorganization')) {
print '<input type="checkbox" disabled name="usage_organize_event"'.(GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_organize_event ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("EventOrganizationDescriptionLong");
print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
@ -969,7 +971,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
// Third party
$morehtmlref .= $langs->trans("ThirdParty").': ';
if (is_object($projectstatic->thirdparty)) {
if (!empty($projectstatic->thirdparty) && is_object($projectstatic->thirdparty)) {
$morehtmlref .= $projectstatic->thirdparty->getNomUrl(1);
}
$morehtmlref .= '</div>';
@ -981,10 +983,19 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield centpercent">';
print '<table class="border centpercent tableforfield">';
// Task parent
print '<tr><td>'.$langs->trans("ChildOfTask").'</td><td>';
if ($object->fk_task_parent > 0) {
$tasktmp = new Task($db);
$tasktmp->fetch($object->fk_task_parent);
print $tasktmp->getNomUrl(1);
}
print '</td></tr>';
// Date start - Date end
print '<tr><td class="titlefield">'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
print '<tr><td class="titlefield">'.$langs->trans("DateStart").' - '.$langs->trans("Deadline").'</td><td>';
$start = dol_print_date($object->date_start, 'dayhour');
print ($start ? $start : '?');
$end = dol_print_date($object->date_end, 'dayhour');