From 8491be25727e83c146b422b8a2af6b3e717d03c2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Dec 2020 11:58:47 +0100 Subject: [PATCH] Fix look and feel v13 --- htdocs/core/class/html.formother.class.php | 37 ++-- htdocs/projet/tasks.php | 218 ++++++++++----------- 2 files changed, 130 insertions(+), 125 deletions(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 3b9d9db2906..2973eda7144 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -620,15 +620,17 @@ class FormOther if ($i > 0) print ''; print '\n"; $lastprojectid = $lines[$i]->fk_project; @@ -652,21 +654,26 @@ class FormOther print '\n"; + $labeltoshow .= $lines[$i]->ref.' '.$lines[$i]->label; + + print ' data-html="'.dol_escape_htmltag($labeltoshow).'"'; + print '>'; + print $labeltoshow; + print "\n"; $inc++; } diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 72e8f1cbdb4..b4d486e747c 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -492,121 +492,119 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print load_fiche_titre($langs->trans("NewTask"), '', 'projecttask'); - if ($object->statut == Project::STATUS_CLOSED) { + if ($object->id > 0 && $object->statut == Project::STATUS_CLOSED) { print '
'; $langs->load("errors"); print $langs->trans("WarningProjectClosed"); print '
'; - } else { - if ($object->statut == Project::STATUS_DRAFT) - { - print '
'; - $langs->load("errors"); - print $langs->trans("WarningProjectDraft"); - print '
'; - } - - print '
'; - print ''; - print ''; - print ''; - if (!empty($object->id)) print ''; - - print dol_get_fiche_head(''); - - print ''; - - $defaultref = ''; - $obj = empty($conf->global->PROJECT_TASK_ADDON) ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON; - if (!empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.".php")) - { - require_once DOL_DOCUMENT_ROOT."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.'.php'; - $modTask = new $obj; - $defaultref = $modTask->getNextValue($object->thirdparty, null); - } - - if (is_numeric($defaultref) && $defaultref <= 0) $defaultref = ''; - - // Ref - print ''; - - print ''; - - // List of projects - print ''; - - print ''; - - // Date start - print ''; - - // Date end - print ''; - - // Planned workload - print ''; - - // Progress - print ''; - - // Description - print ''; - print ''; - - // Other options - $parameters = array(); - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $taskstatic, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - if (empty($reshook) && !empty($extrafields->attributes[$taskstatic->table_element]['label'])) - { - print $taskstatic->showOptionals($extrafields, 'edit'); // Do not use $object here that is object of project but use $taskstatic - } - - print '
'.$langs->trans("Ref").''; - if (empty($duplicate_code_error)) - { - print (GETPOSTISSET("ref") ?GETPOST("ref", 'alpha') : $defaultref); - } else { - print $defaultref; - } - print ''; - print '
'.$langs->trans("Label").''; - print ''; - print '
'.$langs->trans("ChildOfProjectTask").''; - print $formother->selectProjectTasks(GETPOST('task_parent'), $projectid ? $projectid : $object->id, 'task_parent', 0, 0, 1, 1, 0, '0,1', 'maxwidth500'); - print '
'.$langs->trans("AffectedTo").''; - $contactsofproject = (!empty($object->id) ? $object->getListContactId('internal') : ''); - if (is_array($contactsofproject) && count($contactsofproject)) - { - print $form->select_dolusers($user->id, 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 0, '', 'maxwidth300'); - } else { - print $langs->trans("NoUserAssignedToTheProject"); - } - print '
'.$langs->trans("DateStart").''; - print $form->selectDate(($date_start ? $date_start : ''), 'dateo', 1, 1, 0, '', 1, 1); - print '
'.$langs->trans("DateEnd").''; - print $form->selectDate(($date_end ? $date_end : -1), 'datee', -1, 1, 0, '', 1, 1); - print '
'.$langs->trans("PlannedWorkload").''; - print $form->select_duration('planned_workload', $planned_workload ? $planned_workload : 0, 0, 'text'); - print '
'.$langs->trans("ProgressDeclared").''; - print $formother->select_percent($progress, 'progress', 0, 5, 0, 100, 1); - print '
'.$langs->trans("Description").''; - print ''; - print '
'; - - print dol_get_fiche_end(); - - print '
'; - print ''; - print '     '; - print ''; - print '
'; - - print '
'; } -} elseif ($id > 0 || !empty($ref)) -{ + + if ($object->id > 0 && $object->statut == Project::STATUS_DRAFT) { + print '
'; + $langs->load("errors"); + print $langs->trans("WarningProjectDraft"); + print '
'; + } + + print '
'; + print ''; + print ''; + print ''; + if (!empty($object->id)) print ''; + + print dol_get_fiche_head(''); + + print ''; + + $defaultref = ''; + $obj = empty($conf->global->PROJECT_TASK_ADDON) ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON; + if (!empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.".php")) + { + require_once DOL_DOCUMENT_ROOT."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.'.php'; + $modTask = new $obj; + $defaultref = $modTask->getNextValue($object->thirdparty, null); + } + + if (is_numeric($defaultref) && $defaultref <= 0) $defaultref = ''; + + // Ref + print ''; + + print ''; + + // List of projects + print ''; + + print ''; + + // Date start + print ''; + + // Date end + print ''; + + // Planned workload + print ''; + + // Progress + print ''; + + // Description + print ''; + print ''; + + // Other options + $parameters = array(); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $taskstatic, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + if (empty($reshook) && !empty($extrafields->attributes[$taskstatic->table_element]['label'])) + { + print $taskstatic->showOptionals($extrafields, 'edit'); // Do not use $object here that is object of project but use $taskstatic + } + + print '
'.$langs->trans("Ref").''; + if (empty($duplicate_code_error)) + { + print (GETPOSTISSET("ref") ?GETPOST("ref", 'alpha') : $defaultref); + } else { + print $defaultref; + } + print ''; + print '
'.$langs->trans("Label").''; + print ''; + print '
'.$langs->trans("ChildOfProjectTask").''; + print $formother->selectProjectTasks(GETPOST('task_parent'), $projectid ? $projectid : $object->id, 'task_parent', 0, 0, 1, 1, 0, '0,1', 'maxwidth500'); + print '
'.$langs->trans("AffectedTo").''; + $contactsofproject = (!empty($object->id) ? $object->getListContactId('internal') : ''); + if (is_array($contactsofproject) && count($contactsofproject)) + { + print $form->select_dolusers($user->id, 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 0, '', 'maxwidth300'); + } else { + print $langs->trans("NoUserAssignedToTheProject"); + } + print '
'.$langs->trans("DateStart").''; + print $form->selectDate(($date_start ? $date_start : ''), 'dateo', 1, 1, 0, '', 1, 1); + print '
'.$langs->trans("DateEnd").''; + print $form->selectDate(($date_end ? $date_end : -1), 'datee', -1, 1, 0, '', 1, 1); + print '
'.$langs->trans("PlannedWorkload").''; + print $form->select_duration('planned_workload', $planned_workload ? $planned_workload : 0, 0, 'text'); + print '
'.$langs->trans("ProgressDeclared").''; + print $formother->select_percent($progress, 'progress', 0, 5, 0, 100, 1); + print '
'.$langs->trans("Description").''; + print ''; + print '
'; + + print dol_get_fiche_end(); + + print '
'; + print ''; + print '     '; + print ''; + print '
'; + + print '
'; +} elseif ($id > 0 || !empty($ref)) { $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields /*