diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index a67e47d5d47..1d8dd35f46f 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -2937,7 +2937,7 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide $out .= ''; - $out .= '
'; + $out .= '
'; $diffval = (float) $task->progress - (float) $progressCalculated; if ($diffval >= 0) { // good diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 84d78726599..5c82ff54f9b 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -2483,11 +2483,12 @@ class Task extends CommonObjectLine //$return .= '
'.$langs->trans("Budget").' : '.price($this->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).''; } if (property_exists($this, 'duration_effective')) { - $return .= '

'.getTaskProgressView($this, false, true).'
'; + $return .= '
'.getTaskProgressView($this, false, true).'
'; } $return .= '
'; $return .= '
'; $return .= ''; + return $return; } } diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index d0e044f03b3..bc0f4463f95 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -46,8 +46,15 @@ $langs->loadLangs($langsLoad); $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); -$show_files = GETPOSTINT('show_files'); +//$show_files = GETPOSTINT('show_files'); $confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'aZ09'); +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'projecttasklist'; +$backtopage = GETPOST('backtopage', 'alpha'); // if not set, a default page will be used +//$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // if not set, $backtopage will be used +//$backtopagejsfields = GETPOST('backtopagejsfields', 'alpha'); +$optioncss = GETPOST('optioncss', 'aZ'); +$backtopage = GETPOST('backtopage', 'alpha'); $toselect = GETPOST('toselect', 'array'); $id = GETPOSTINT('id'); @@ -66,9 +73,6 @@ $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -$backtopage = GETPOST('backtopage', 'alpha'); -$cancel = GETPOST('cancel', 'alpha'); - $search_user_id = GETPOSTINT('search_user_id'); $search_taskref = GETPOST('search_taskref'); $search_tasklabel = GETPOST('search_tasklabel'); @@ -103,8 +107,6 @@ $search_date_end_endyear = GETPOSTINT('search_date_end_endyear'); $search_date_end_endday = GETPOSTINT('search_date_end_endday'); $search_date_end_end = dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear); // Use tzserver -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'projecttasklist'; -$optioncss = GETPOST('optioncss', 'aZ'); //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects $object = new Project($db); @@ -147,9 +149,13 @@ $progress = GETPOSTINT('progress'); $budget_amount = GETPOSTFLOAT('budget_amount'); $label = GETPOST('label', 'alpha'); $description = GETPOST('description', 'restricthtml'); -$planned_workloadhour = (GETPOSTINT('planned_workloadhour') ? GETPOSTINT('planned_workloadhour') : 0); -$planned_workloadmin = (GETPOSTINT('planned_workloadmin') ? GETPOSTINT('planned_workloadmin') : 0); -$planned_workload = $planned_workloadhour * 3600 + $planned_workloadmin * 60; +$planned_workloadhour = (GETPOSTISSET('planned_workloadhour') ? GETPOSTINT('planned_workloadhour') : ''); +$planned_workloadmin = (GETPOSTISSET('planned_workloadmin') ? GETPOSTINT('planned_workloadmin') : ''); +if (GETPOSTISSET('planned_workloadhour') || GETPOSTISSET('planned_workloadmin')) { + $planned_workload = (int) $planned_workloadhour * 3600 + (int) $planned_workloadmin * 60; +} else { + $planned_workload = ''; +} // Definition of fields for list $arrayfields = array( @@ -186,7 +192,14 @@ $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; * Actions */ -if (GETPOST('cancel', 'alpha')) { +if ($cancel) { + if (!empty($backtopageforcancel)) { + header("Location: ".$backtopageforcancel); + exit; + } elseif (!empty($backtopage)) { + header("Location: ".$backtopage); + exit; + } $action = 'list'; $massaction = ''; } @@ -797,7 +810,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer') && (empty($object- // Planned workload print ''.$langs->trans("PlannedWorkload").''; print img_picto('', 'clock', 'class="pictofixedwidth"'); - print $form->select_duration('planned_workload', !empty($planned_workload) ? $planned_workload : 0, 0, 'text'); + print $form->select_duration('planned_workload', $planned_workload, 0, 'text'); print ''; // Progress diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 6aadd2c504d..ae4252ee4e9 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -155,20 +155,20 @@ if (empty($user->socid)) { } $arrayfields = array( + 't.ref' => array('label' => "RefTask", 'checked' => 1, 'position' => 50), 't.fk_task_parent' => array('label' => "RefTaskParent", 'checked' => 0, 'position' => 70), - 't.ref' => array('label' => "RefTask", 'checked' => 1, 'position' => 80), - 't.label' => array('label' => "LabelTask", 'checked' => 1, 'position' => 80), + 't.label' => array('label' => "LabelTask", 'checked' => 1, 'position' => 75), 't.description' => array('label' => "Description", 'checked' => 0, 'position' => 80), 't.dateo' => array('label' => "DateStart", 'checked' => 1, 'position' => 100), 't.datee' => array('label' => "Deadline", 'checked' => 1, 'position' => 101), 'p.ref' => array('label' => "ProjectRef", 'checked' => 1, 'position' => 151), 'p.title' => array('label' => "ProjectLabel", 'checked' => 0, 'position' => 152), - 's.nom' => array('label' => "ThirdParty", 'checked' => 1, 'csslist' => 'tdoverflowmax125', 'position' => 200), + 's.nom' => array('label' => "ThirdParty", 'checked' => -1, 'csslist' => 'tdoverflowmax125', 'position' => 200), 's.name_alias' => array('label' => "AliasNameShort", 'checked' => 0, 'csslist' => 'tdoverflowmax125', 'position' => 201), 'p.fk_statut' => array('label' => "ProjectStatus", 'checked' => 1, 'position' => 205), 't.planned_workload' => array('label' => "PlannedWorkload", 'checked' => 1, 'position' => 302), 't.duration_effective' => array('label' => "TimeSpent", 'checked' => 1, 'position' => 303), - 't.progress_calculated' => array('label' => "ProgressCalculated", 'checked' => 1, 'position' => 304), + 't.progress_calculated' => array('label' => "ProgressCalculated", 'checked' => -1, 'position' => 304), 't.progress' => array('label' => "ProgressDeclared", 'checked' => 1, 'position' => 305), 't.progress_summary' => array('label' => "TaskProgressSummary", 'checked' => 1, 'position' => 306), 't.budget_amount' => array('label' => "Budget", 'checked' => 0, 'position' => 307), @@ -746,7 +746,7 @@ $newcardbutton = ''; $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitleSeparator(); -$newcardbutton .= dolGetButtonTitle($langs->trans('NewTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?action=create', '', $permissiontocreate); +$newcardbutton .= dolGetButtonTitle($langs->trans('NewTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?action=create&backtopage='.urlencode(DOL_URL_ROOT.'/projet/tasks/list.php'), '', $permissiontocreate); // Show description of content @@ -853,16 +853,16 @@ if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print $searchpicto; print ''; } -if (!empty($arrayfields['t.fk_task_parent']['checked'])) { - print ''; - print ''; - print ''; -} if (!empty($arrayfields['t.ref']['checked'])) { print ''; print ''; print ''; } +if (!empty($arrayfields['t.fk_task_parent']['checked'])) { + print ''; + print ''; + print ''; +} if (!empty($arrayfields['t.label']['checked'])) { print ''; print ''; @@ -1011,14 +1011,14 @@ if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; $totalarray['nbfield']++; } -if (!empty($arrayfields['t.fk_task_parent']['checked'])) { - print_liste_field_titre($arrayfields['t.fk_task_parent']['label'], $_SERVER["PHP_SELF"], "t.fk_task_parent", "", $param, "", $sortfield, $sortorder); - $totalarray['nbfield']++; -} if (!empty($arrayfields['t.ref']['checked'])) { print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], "t.ref", "", $param, "", $sortfield, $sortorder); $totalarray['nbfield']++; } +if (!empty($arrayfields['t.fk_task_parent']['checked'])) { + print_liste_field_titre($arrayfields['t.fk_task_parent']['label'], $_SERVER["PHP_SELF"], "t.fk_task_parent", "", $param, "", $sortfield, $sortorder); + $totalarray['nbfield']++; +} if (!empty($arrayfields['t.label']['checked'])) { print_liste_field_titre($arrayfields['t.label']['label'], $_SERVER["PHP_SELF"], "t.label", "", $param, "", $sortfield, $sortorder); $totalarray['nbfield']++; @@ -1141,7 +1141,6 @@ while ($i < $imaxinloop) { $object->ref = $obj->ref; $object->label = $obj->label; $object->description = $obj->description; - $object->fk_statut = $obj->status; $object->status = $obj->status; $object->progress = $obj->progress; $object->budget_amount = $obj->budget_amount; @@ -1207,6 +1206,18 @@ while ($i < $imaxinloop) { $totalarray['nbfield']++; } } + // Ref + if (!empty($arrayfields['t.ref']['checked'])) { + print ''; + print $object->getNomUrl(1, 'withproject'); + if ($object->hasDelay()) { + print img_warning("Late"); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } // Ref Parent if (!empty($arrayfields['t.fk_task_parent']['checked'])) { print ''; @@ -1227,18 +1238,6 @@ while ($i < $imaxinloop) { $totalarray['nbfield']++; } } - // Ref - if (!empty($arrayfields['t.ref']['checked'])) { - print ''; - print $object->getNomUrl(1, 'withproject'); - if ($object->hasDelay()) { - print img_warning("Late"); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } // Label if (!empty($arrayfields['t.label']['checked'])) { print ''; @@ -1383,6 +1382,15 @@ while ($i < $imaxinloop) { } else { print ''; } + if (empty($arrayfields['t.progress_calculated']['checked'])) { + if ($obj->planned_workload || $obj->duration_effective) { + if ($obj->planned_workload) { + print ' ('.round(100 * $obj->duration_effective / $obj->planned_workload, 2).' %)'; + } else { + print $form->textwithpicto('', $langs->trans('WorkloadNotDefined'), 1, 'help'); + } + } + } print ''; if (!$i) { $totalarray['nbfield']++; @@ -1448,9 +1456,9 @@ while ($i < $imaxinloop) { // Progress summary if (!empty($arrayfields['t.progress_summary']['checked'])) { print ''; - if ($obj->progress != '' && $obj->duration_effective) { + //if ($obj->progress != '') { print getTaskProgressView($object, false, false); - } + //} print ''; if (!$i) { $totalarray['nbfield']++; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index c17d9c348cf..de8d0289330 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -40,13 +40,18 @@ $langs->loadlangs(array('projects', 'companies')); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); +//$cancel = GETPOST('cancel', 'aZ09'); +//$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search +//$backtopage = GETPOST('backtopage', 'alpha'); // if not set, a default page will be used +//$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // if not set, $backtopage will be used +//$backtopagejsfields = GETPOST('backtopagejsfields', 'alpha'); $id = GETPOSTINT('id'); $ref = GETPOST("ref", 'alpha', 1); // task ref $taskref = GETPOST("taskref", 'alpha'); // task ref $withproject = GETPOSTINT('withproject'); $project_ref = GETPOST('project_ref', 'alpha'); -$planned_workload = ((GETPOSTINT('planned_workloadhour') != '' || GETPOSTINT('planned_workloadmin') != '') ? (GETPOSTINT('planned_workloadhour') > 0 ? GETPOSTINT('planned_workloadhour') * 3600 : 0) + (GETPOSTINT('planned_workloadmin') > 0 ? GETPOSTINT('planned_workloadmin') * 60 : 0) : ''); +$planned_workload = ((GETPOST('planned_workloadhour') != '' || GETPOST('planned_workloadmin') != '') ? (GETPOSTINT('planned_workloadhour') > 0 ? GETPOSTINT('planned_workloadhour') * 3600 : 0) + (GETPOSTINT('planned_workloadmin') > 0 ? GETPOSTINT('planned_workloadmin') * 60 : 0) : ''); $mode = GETPOST('mode', 'alpha'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -611,7 +616,7 @@ if ($id > 0 || !empty($ref)) { // Progress declared print ''.$langs->trans("ProgressDeclared").''; - if ($object->progress != '') { + if ($object->progress != '' && $object->progress != '-1') { print $object->progress.' %'; } print '';