From 5cff4c152b28441ddfd04329804b12cde4dddcef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 May 2018 11:25:21 +0200 Subject: [PATCH] Add tab "time spent" in project view. Can swith gantt/list. --- htdocs/core/lib/project.lib.php | 8 +++--- htdocs/langs/en_US/projects.lang | 1 + htdocs/projet/ganttview.php | 42 ++++++++++++-------------------- htdocs/projet/tasks.php | 5 ++-- htdocs/projet/tasks/time.php | 11 +++++---- htdocs/theme/eldy/style.css.php | 3 +++ 6 files changed, 32 insertions(+), 38 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 06d0b7aa6d3..6a8ef760a04 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -104,10 +104,10 @@ function project_prepare_head($object) $head[$h][2] = 'tasks'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/projet/ganttview.php?id='.$object->id; - $head[$h][1] = $langs->trans("Gantt"); - if ($nbTasks > 0) $head[$h][1].= ' '.($nbTasks).''; - $head[$h][2] = 'gantt'; + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&projectid='.$object->id; + $head[$h][1] = $langs->trans("TimeSpent"); + //if ($nbTasks > 0) $head[$h][1].= ' '.($nbTasks).''; + $head[$h][2] = 'timespent'; $h++; } diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 85937ad827a..6dfb11e2284 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -77,6 +77,7 @@ Time=Time ListOfTasks=List of tasks GoToListOfTimeConsumed=Go to list of time consumed GoToListOfTasks=Go to list of tasks +GoToGanttView=Go to Gantt view GanttView=Gantt View ListProposalsAssociatedProject=List of the commercial proposals associated with the project ListOrdersAssociatedProject=List of customer orders associated with the project diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 0c1e86c8ab5..248eb1a63b3 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -80,7 +80,8 @@ if (! empty($conf->use_javascript_ajax)) ); } -$title=$langs->trans("Project").' - '.$langs->trans("Gantt").($object->ref?' - '.$object->ref.' '.$object->name:''); +//$title=$langs->trans("Gantt").($object->ref?' - '.$object->ref.' '.$object->name:''); +$title=$langs->trans("Gantt"); if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=($object->ref?$object->ref.' '.$object->name.' - ':'').$langs->trans("Gantt"); $help_url="EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; llxHeader("",$title,$help_url,'',0,0,$arrayofjs,$arrayofcss); @@ -93,7 +94,7 @@ if (($id > 0 && is_numeric($id)) || ! empty($ref)) //$userDelete = $object->restrictedProjectArea($user,'delete'); //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete; - $tab='gantt'; + $tab='tasks'; $head=project_prepare_head($object); dol_fiche_head($head, $tab, $langs->trans("Project"), -1, ($object->public?'projectpub':'project')); @@ -187,43 +188,32 @@ if (($id > 0 && is_numeric($id)) || ! empty($ref)) print '
'; dol_fiche_end(); + + print '
'; } - -/* - * Buttons actions - */ - -if ($id > 0 && is_numeric($id)) +// Link to create task +if ($user->rights->projet->all->creer || $user->rights->projet->creer) { - - print '
'; - - if ($user->rights->projet->all->creer || $user->rights->projet->creer) + if ($object->public || $userWrite > 0) { - if ($object->public || $userWrite > 0) - { - print ''.$langs->trans('AddTask').''; - } - else - { - print ''.$langs->trans('AddTask').''; - } + $linktocreatetask = ''.$langs->trans('AddTask').''; } else { - print ''.$langs->trans('AddTask').''; + $linktocreatetask = ''.$langs->trans('AddTask').''; } - - print '
'; - - print '
'; } else { - print_fiche_titre($langs->trans("GanttView")); + $linktocreatetask = ''.$langs->trans('AddTask').''; } +$linktolist=''.$langs->trans("GoToListOfTasks").' '; + +//print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $linktotasks, $num, $totalnboflines, 'title_generic.png', 0, '', '', 0, 1); +print load_fiche_titre($title, $linktolist.'   '.$linktocreatetask, 'title_generic.png'); + // Get list of tasks in tasksarray and taskarrayfiltered // We need all tasks (even not limited to a user because a task to user diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 67dd84a1572..22fe740a63b 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -31,8 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -$langs->load("users"); -$langs->load("projects"); +$langs->loadLangs(array("users", "projects")); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); @@ -489,7 +488,7 @@ else if ($id > 0 || ! empty($ref)) print ''; $title=$langs->trans("ListOfTasks"); - $linktotasks=''.$langs->trans("GoToListOfTimeConsumed").''; + $linktotasks=''.$langs->trans("GoToGanttView").' '; //print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $linktotasks, $num, $totalnboflines, 'title_generic.png', 0, '', '', 0, 1); print load_fiche_titre($title, $linktotasks.'   '.$linktocreatetask, 'title_generic.png'); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 0f2ec5f9fcd..86a2027b3b7 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -320,7 +320,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) if ($withproject) { // Tabs for project - $tab='tasks'; + if (empty($id)) $tab='timespent'; + else $tab='tasks'; $head=project_prepare_head($projectstatic); dol_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public?'projectpub':'project')); @@ -695,9 +696,9 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print ''."\n"; $title=$langs->trans("ListTaskTimeUserProject"); - $linktotasks=''.$langs->trans("GoToListOfTasks").''; + //$linktotasks=''.$langs->trans("GoToListOfTasks").''; //print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $linktotasks, $num, $totalnboflines, 'title_generic.png', 0, '', '', 0, 1); - print load_fiche_titre($title,$linktotasks.'   '.$linktocreatetime, 'title_generic.png'); + print load_fiche_titre($title, $linktocreatetime, 'title_generic.png'); } $i = 0; @@ -868,8 +869,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) if (! empty($arrayfields['t.task_date']['checked'])) { print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; $formother->select_year($search_year,'search_year',1, 20, 5); print ''; } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 8eb6f0b98c8..a8798901a21 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -822,6 +822,9 @@ select.flat.selectlimit { .fa-trash, .fa-crop, .fa-pencil { font-size: 1.4em; } +.fa-15 { + font-size: 1.5em; +} /* DOL_XXX for future usage (when left menu has been removed). If we do not use datatable */ /*.table-responsive {