diff --git a/ChangeLog b/ChangeLog index 35202561b9b5aec95e58cf895ecdf8e23b2a16f8..863326937e8c53ff152d9ad6910333e8ff96a860 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 3a8bd016e210f0701d47e1da29db8eccdffe4dc8..e673b2d6a2fe456b0bb10d9ef73461aa0634e9d0 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 '</td>'; + // Duration + print '<td align="center">'; + print $lines[$i]->duration_planned.' '.$langs->trans('Hours'); + print '</td>'; + // Progress print '<td align="right">'; 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 '<td align="center" class="tdlineupdown hideonsmartphone"> </td>'; + print '<td align="center" class="tdlineupdown"> </td>'; } print "</tr>\n"; @@ -466,6 +471,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t print '<td></td>'; print '<td></td>'; print '<td></td>'; + print '<td></td>'; if ($addordertick) print '<td class="hideonsmartphone"></td>'; print '<td align="right" class="nowrap liste_total">'.convertSecondToTime($total).'</td>'; print '</tr>'; @@ -549,6 +555,11 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr print dol_print_date($lines[$i]->date_end,'day'); print '</td>'; + // Duration + print '<td align="center">'; + print $lines[$i]->duration_planned.' '.$langs->trans('Hours'); + print '</td>'; + // Progress print '<td align="right">'; 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 5dd2ae691421dd2dd211a7298454ba865211057e..8d6cc91d1d1fa50ba3a4fe070533a08240f98590 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 ff54d3cec21084c6677684df81be5008dd64b548..8e12ec8f973897162d6dd810a9b6d230deb4ac19 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 a177ddf838b5e420a5f07619e0a293ddedeae138..18824f811404dde0c68473df86333cca8ffc58f4 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 0cd8fd9ca6431ba511302157b65d1405cf8b0a28..fc17df207d5415807b328053bbe5a7277ae24abc 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -1,21 +1,21 @@ <?php /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> - * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com> - * - * 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 <http://www.gnu.org/licenses/>. - */ +* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com> +* +* 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 <http://www.gnu.org/licenses/>. +*/ /** * \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 "</table>"; +print '</td></tr></table>'; print '</div></div></div>'; +print '<div class="fichecenter">'; +print '<BR>'; +print '<table class="noborder" width="100%">'; +print '<tr class="liste_titre">'; +print '<th>'.$langs->trans('TaskRessourceLinks').'</th>'; +print '<th>'.$langs->trans('Projects').'</th>'; +print '<th>'.$langs->trans('Task').'</th>'; +print '<th>'.$langs->trans('DateStart').'</th>'; +print '<th>'.$langs->trans('DateEnd').'</th>'; +print '<th>'.$langs->trans('TaskRessourceLinks').' %</th>'; +print '</tr>'; + + +$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 "<tr $bc[$var]>"; + print '<td>'.$username.'</td>'; + print '<td><a href="'.DOL_URL_ROOT.'/projet/fiche.php?id="'.$obj->projectid.'">'.$obj->title.'</a></td>'; + print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/task.php?id='.$obj->taskid.'&withproject=1">'.$obj->label.'</a></td>'; + print '<td>'.dol_print_date($db->jdate($obj->dateo)).'</td>'; + print '<td>'.dol_print_date($db->jdate($obj->datee)).'</td>'; + if (empty($obj->duration_planned)) { + $percentcompletion = '0'; + } else { + $percentcompletion = intval(($obj->totaltime*100)/$obj->duration_planned); + } + print '<td>'.$percentcompletion.' %</td>'; + print "</tr>\n"; + + $i++; + } + + $db->free($resql); +} +else +{ + dol_print_error($db); +} +print "</table></div>"; + + + + llxFooter(); $db->close(); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index b79bb65ed7421a0df0a85c304e8a11d53bb524a9..ac41ebaa384e5a600b4f8d0c572b513d7cf72e1e 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 '</td></tr>'; + // Duration planned + print '<tr><td>'.$langs->trans("Duration").'</td><td>'; + print '<input type="text" size="7" name="duration_planned" class="flat" value="'.$duration_planned.'"> '.$langs->trans('Hours'); + print '</td></tr>'; + // Progress print '<tr><td>'.$langs->trans("Progress").'</td><td colspan="3">'; print $formother->select_percent($progress,'progress'); @@ -391,6 +398,7 @@ else print '<td>'.$langs->trans("LabelTask").'</td>'; print '<td align="center">'.$langs->trans("DateStart").'</td>'; print '<td align="center">'.$langs->trans("DateEnd").'</td>'; + print '<td align="right">'.$langs->trans("Duration").'</td>'; print '<td align="right">'.$langs->trans("Progress").'</td>'; print '<td align="right">'.$langs->trans("TimeSpent").'</td>'; print '<td> </td>'; diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php index d61198c8183fa79c60b4b25fd37a49a4df4dbbbb..c7a8647bfbf1b629950e6128925c32db0b97ef6f 100644 --- a/htdocs/projet/tasks/index.php +++ b/htdocs/projet/tasks/index.php @@ -100,6 +100,7 @@ print '<td width="80">'.$langs->trans("RefTask").'</td>'; print '<td>'.$langs->trans("LabelTask").'</td>'; print '<td align="center">'.$langs->trans("DateStart").'</td>'; print '<td align="center">'.$langs->trans("DateEnd").'</td>'; +print '<td align="center">'.$langs->trans("Duration").'</td>'; print '<td align="right">'.$langs->trans("Progress").'</td>'; print '<td align="right">'.$langs->trans("TimeSpent").'</td>'; print "</tr>\n"; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 275f54c5c445ea675fda5ae822610f7829c291a0..84479231daaa21a48cea645f53a6bcd819e6db1a 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 '</td></tr>'; + // Duration planned + print '<tr><td>'.$langs->trans("Duration").'</td><td>'; + print '<input type="text" size="7" name="duration_planned" class="flat" value="'.$object->duration_planned.'"> '.$langs->trans('Hours'); + print '</td></tr>'; + // Progress print '<tr><td>'.$langs->trans("Progress").'</td><td colspan="3">'; 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 '</td></tr>'; + // Duration planned + print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="3">'; + print $object->duration_planned.' '.$langs->trans('Hours'); + print '</td></tr>'; + // Progress print '<tr><td>'.$langs->trans("Progress").'</td><td colspan="3">'; print $object->progress.' %'; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 7f32feadccb7d2402e5531f202ffdd1ca2d73c4e..5d789ee720e13a7230d17ce2630ad490019a2874 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -264,6 +264,9 @@ if ($id > 0 || ! empty($ref)) // Label print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$object->label.'</td></tr>'; + // Duration planned + print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="3">'.$object->duration_planned.' '.$langs->trans('Hours').'</td></tr>'; + // Project if (empty($withproject)) {