diff --git a/ChangeLog b/ChangeLog index 35202561b9b..863326937e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,7 +6,8 @@ English Dolibarr ChangeLog For users: - New: [ task #877 ] Reorganize menus - New: [ task #858 ] Holiday module: note on manual holiday assignation -- New : [ task #892 ] Add option in thridparty customer/supplier admin to hide non active in select_company method +- New: [ task #892 ] Add option in thridparty customer/supplier admin to hide non active in select_company method +- New: [ task #531 ] Add a duration on tasks ***** ChangeLog for 3.4 compared to 3.3.2 ***** diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 3a8bd016e21..e673b2d6a2f 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -420,6 +420,11 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t print dol_print_date($lines[$i]->date_end,'day'); print ''; + // Duration + print ''; + print $lines[$i]->duration_planned.' '.$langs->trans('Hours'); + print ''; + // Progress print ''; print $lines[$i]->progress.' %'; @@ -438,7 +443,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t // Tick to drag and drop if ($addordertick) { - print ' '; + print ' '; } print "\n"; @@ -466,6 +471,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t print ''; print ''; print ''; + print ''; if ($addordertick) print ''; print ''.convertSecondToTime($total).''; print ''; @@ -549,6 +555,11 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr print dol_print_date($lines[$i]->date_end,'day'); print ''; + // Duration + print ''; + print $lines[$i]->duration_planned.' '.$langs->trans('Hours'); + print ''; + // Progress print ''; print $lines[$i]->progress.' %'; diff --git a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql index 5dd2ae69142..8d6cc91d1d1 100755 --- a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql +++ b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql @@ -18,4 +18,8 @@ -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); -DELETE FROM llx_menu where module='holiday'; \ No newline at end of file +DELETE FROM llx_menu where module='holiday'; + +ALTER TABLE llx_projet_task ADD COLUMN duration_planned real DEFAULT 0 NOT NULL AFTER duration_effective; + + diff --git a/htdocs/install/mysql/tables/llx_projet_task.sql b/htdocs/install/mysql/tables/llx_projet_task.sql index ff54d3cec21..8e12ec8f973 100644 --- a/htdocs/install/mysql/tables/llx_projet_task.sql +++ b/htdocs/install/mysql/tables/llx_projet_task.sql @@ -29,7 +29,8 @@ create table llx_projet_task datev datetime, -- date validation label varchar(255) NOT NULL, description text, - duration_effective real DEFAULT 0 NOT NULL, + duration_effective real DEFAULT 0 NOT NULL, + duration_planned real DEFAULT 0 NOT NULL, progress integer DEFAULT 0, -- percentage increase priority integer DEFAULT 0, -- priority fk_user_creat integer, -- user who created the task diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index a177ddf838b..18824f81140 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -41,6 +41,7 @@ class Task extends CommonObject var $label; var $description; var $duration_effective; + var $duration_planned; var $date_c; var $date_start; var $date_end; @@ -101,6 +102,7 @@ class Task extends CommonObject $sql.= ", fk_user_creat"; $sql.= ", dateo"; $sql.= ", datee"; + $sql.= ", duration_planned"; $sql.= ", progress"; $sql.= ") VALUES ("; $sql.= $this->fk_project; @@ -111,6 +113,7 @@ class Task extends CommonObject $sql.= ", ".$user->id; $sql.= ", ".($this->date_start!=''?"'".$this->db->idate($this->date_start)."'":'null'); $sql.= ", ".($this->date_end!=''?"'".$this->db->idate($this->date_end)."'":'null'); + $sql.= ", ".($this->duration_planned!=''?$this->duration_planned:0); $sql.= ", ".($this->progress!=''?$this->progress:0); $sql.= ")"; @@ -183,6 +186,7 @@ class Task extends CommonObject $sql.= " t.label,"; $sql.= " t.description,"; $sql.= " t.duration_effective,"; + $sql.= " t.duration_planned,"; $sql.= " t.datec,"; $sql.= " t.dateo,"; $sql.= " t.datee,"; @@ -211,6 +215,7 @@ class Task extends CommonObject $this->label = $obj->label; $this->description = $obj->description; $this->duration_effective = $obj->duration_effective; + $this->duration_planned = $obj->duration_planned; $this->date_c = $this->db->jdate($obj->datec); $this->date_start = $this->db->jdate($obj->dateo); $this->date_end = $this->db->jdate($obj->datee); @@ -254,6 +259,7 @@ class Task extends CommonObject if (isset($this->label)) $this->label=trim($this->label); if (isset($this->description)) $this->description=trim($this->description); if (isset($this->duration_effective)) $this->duration_effective=trim($this->duration_effective); + if (isset($this->duration_planned)) $this->duration_planned=trim($this->duration_planned); // Check parameters // Put here code to add control on parameters values @@ -265,6 +271,7 @@ class Task extends CommonObject $sql.= " label=".(isset($this->label)?"'".$this->db->escape($this->label)."'":"null").","; $sql.= " description=".(isset($this->description)?"'".$this->db->escape($this->description)."'":"null").","; $sql.= " duration_effective=".(isset($this->duration_effective)?$this->duration_effective:"null").","; + $sql.= " duration_planned=".(isset($this->duration_planned)?$this->duration_planned:"0").","; $sql.= " dateo=".($this->date_start!=''?$this->db->idate($this->date_start):'null').","; $sql.= " datee=".($this->date_end!=''?$this->db->idate($this->date_end):'null').","; $sql.= " progress=".$this->progress; @@ -524,7 +531,7 @@ class Task extends CommonObject // List of tasks (does not care about permissions. Filtering will be done later) $sql = "SELECT p.rowid as projectid, p.ref, p.title as plabel, p.public,"; $sql.= " t.rowid as taskid, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress,"; - $sql.= " t.dateo as date_start, t.datee as date_end"; + $sql.= " t.dateo as date_start, t.datee as date_end, t.duration_planned"; if ($mode == 0) { $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; @@ -586,6 +593,7 @@ class Task extends CommonObject $tasks[$i]->description = $obj->description; $tasks[$i]->fk_parent = $obj->fk_task_parent; $tasks[$i]->duration = $obj->duration_effective; + $tasks[$i]->duration_planned= $obj->duration_planned; $tasks[$i]->progress = $obj->progress; $tasks[$i]->public = $obj->public; $tasks[$i]->date_start = $this->db->jdate($obj->date_start); @@ -997,6 +1005,7 @@ class Task extends CommonObject $clone_task->fk_project = $project_id; $clone_task->fk_task_parent = $parent_task_id; $clone_task->date_c = $datec; + $clone_task->duration_planned = $clone_task->duration_planned; //Manage Task Date if ($clone_change_dt) diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 0cd8fd9ca64..fc17df207d5 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -1,21 +1,21 @@ * Copyright (C) 2004-2010 Laurent Destailleur - * Copyright (C) 2005-2010 Regis Houssin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +* Copyright (C) 2005-2010 Regis Houssin +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*/ /** * \file htdocs/projet/index.php @@ -44,7 +44,7 @@ $sortorder = GETPOST("sortorder",'alpha'); /* * View - */ +*/ $socstatic=new Societe($db); $projectstatic=new Project($db); @@ -132,10 +132,82 @@ else } print ""; +print ''; print ''; +print '
'; +print '
'; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + + +$sql = "SELECT p.title, p.rowid as projectid, t.label, t.rowid as taskid, u.rowid as userid, t.duration_planned, t.dateo, t.datee, (tasktime.task_duration/3600) as totaltime"; +$sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; +$sql.= " INNER JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid"; +$sql.= " INNER JOIN ".MAIN_DB_PREFIX."projet_task_time as tasktime on tasktime.fk_task = t.rowid"; +$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u on tasktime.fk_user = u.rowid"; +$sql.= " WHERE p.entity = ".$conf->entity; +if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; +if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; +$sql.= " ORDER BY u.rowid, t.dateo, t.datee"; + +$userstatic=new User($db); + +$resql = $db->query($sql); +if ( $resql ) +{ + $num = $db->num_rows($resql); + $i = 0; + + while ($i < $num) + { + $obj = $db->fetch_object($resql); + $var=!$var; + + $username=''; + $userstatic->fetch($obj->userid); + if (!empty($userstatic->id)) { + $username = $userstatic->getNomUrl(0,0); + } + + print ""; + print ''; + print ''; + print ''; + print ''; + print ''; + if (empty($obj->duration_planned)) { + $percentcompletion = '0'; + } else { + $percentcompletion = intval(($obj->totaltime*100)/$obj->duration_planned); + } + print ''; + print "\n"; + + $i++; + } + + $db->free($resql); +} +else +{ + dol_print_error($db); +} +print "
'.$langs->trans('TaskRessourceLinks').''.$langs->trans('Projects').''.$langs->trans('Task').''.$langs->trans('DateStart').''.$langs->trans('DateEnd').''.$langs->trans('TaskRessourceLinks').' %
'.$username.'projectid.'">'.$obj->title.''.$obj->label.''.dol_print_date($db->jdate($obj->dateo)).''.dol_print_date($db->jdate($obj->datee)).''.$percentcompletion.' %
"; + + + + llxFooter(); $db->close(); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index b79bb65ed74..ac41ebaa384 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -71,6 +71,7 @@ $hookmanager->initHooks(array('projecttaskcard')); $progress=GETPOST('progress', 'int'); $label=GETPOST('label', 'alpha'); $description=GETPOST('description'); +$duration_planned=GETPOST('duration_planned'); $userAccess=0; @@ -115,6 +116,7 @@ if ($action == 'createtask' && $user->rights->projet->creer) $task->fk_project = $projectid; $task->label = $label; $task->description = $description; + $task->duration_planned = $duration_planned; $task->fk_task_parent = $task_parent; $task->date_c = dol_now(); $task->date_start = $date_start; @@ -292,6 +294,11 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->socie print $form->select_date(($date_end?$date_end:-1),'datee',0,0,0,'',1,1); print ''; + // Duration planned + print ''.$langs->trans("Duration").''; + print ' '.$langs->trans('Hours'); + print ''; + // Progress print ''.$langs->trans("Progress").''; print $formother->select_percent($progress,'progress'); @@ -391,6 +398,7 @@ else print ''.$langs->trans("LabelTask").''; print ''.$langs->trans("DateStart").''; print ''.$langs->trans("DateEnd").''; + print ''.$langs->trans("Duration").''; print ''.$langs->trans("Progress").''; print ''.$langs->trans("TimeSpent").''; print ' '; diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php index d61198c8183..c7a8647bfbf 100644 --- a/htdocs/projet/tasks/index.php +++ b/htdocs/projet/tasks/index.php @@ -100,6 +100,7 @@ print ''.$langs->trans("RefTask").''; print ''.$langs->trans("LabelTask").''; print ''.$langs->trans("DateStart").''; print ''.$langs->trans("DateEnd").''; +print ''.$langs->trans("Duration").''; print ''.$langs->trans("Progress").''; print ''.$langs->trans("TimeSpent").''; print "\n"; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 275f54c5c44..84479231daa 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -36,6 +36,7 @@ $action=GETPOST('action','alpha'); $confirm=GETPOST('confirm','alpha'); $withproject=GETPOST('withproject','int'); $project_ref=GETPOST('project_ref','alpha'); +$duration_planned=GETPOST('duration_planned'); // Security check $socid=0; @@ -75,6 +76,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer) $object->label = $_POST["label"]; $object->description = $_POST['description']; $object->fk_task_parent = $task_parent; + $object->duration_planned = $duration_planned; $object->date_start = dol_mktime(0,0,0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear']); $object->date_end = dol_mktime(0,0,0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear']); $object->progress = $_POST['progress']; @@ -283,6 +285,11 @@ if ($id > 0 || ! empty($ref)) print $form->select_date($object->date_end?$object->date_end:-1,'datee'); print ''; + // Duration planned + print ''.$langs->trans("Duration").''; + print ' '.$langs->trans('Hours'); + print ''; + // Progress print ''.$langs->trans("Progress").''; print $formother->select_percent($object->progress,'progress'); @@ -368,6 +375,11 @@ if ($id > 0 || ! empty($ref)) print dol_print_date($object->date_end,'day'); print ''; + // Duration planned + print ''.$langs->trans("Duration").''; + print $object->duration_planned.' '.$langs->trans('Hours'); + print ''; + // Progress print ''.$langs->trans("Progress").''; print $object->progress.' %'; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 7f32feadccb..5d789ee720e 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -264,6 +264,9 @@ if ($id > 0 || ! empty($ref)) // Label print ''.$langs->trans("Label").''.$object->label.''; + // Duration planned + print ''.$langs->trans("Duration").''.$object->duration_planned.' '.$langs->trans('Hours').''; + // Project if (empty($withproject)) {