From aa7e3c2fdd09bcc1decbc4bdd371b17b513961c2 Mon Sep 17 00:00:00 2001 From: fhenry Date: Sat, 11 May 2013 17:10:11 +0200 Subject: [PATCH 01/10] [ task #892 ] Add option in thridparty customer/supplier admin to hide non active in select_company method --- htdocs/core/class/html.form.class.php | 1 + htdocs/core/modules/modSociete.class.php | 7 +++++ htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/fr_FR/admin.lang | 1 + htdocs/societe/admin/societe.php | 37 ++++++++++++++++++++++++ 5 files changed, 47 insertions(+) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 000f14ee59f..4a03afcbb4b 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -681,6 +681,7 @@ class Form if (! empty($user->societe_id)) $sql.= " AND s.rowid = ".$user->societe_id; if ($filter) $sql.= " AND (".$filter.")"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if (! empty($conf->global->COMPANY_HIDE_INACTIVE_IN_COMBOBOX)) $sql.= " AND s.status<>0 "; $sql.= " ORDER BY nom ASC"; dol_syslog(get_class($this)."::select_company sql=".$sql); diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 6bb15f60a38..9c122e43280 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -116,6 +116,13 @@ class modSociete extends DolibarrModules $this->const[$r][4] = 0; $r++; + $this->const[$r][0] = "COMPANY_HIDE_INACTIVE_IN_COMBOBOX"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "0"; + $this->const[$r][3] = "hide thirdparty customer inative in combobox"; + $this->const[$r][4] = 0; + $r++; + // Boxes $this->boxes = array(); $r=0; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index f13698ad1a1..cac27722e61 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -53,6 +53,7 @@ ConfirmAjax=Use Ajax confirmation popups UseSearchToSelectCompany=Use autocompletion fields to choose third parties (instead of using a list box).

Also if you have a large number of third parties (> 100 000), you can increase speed by setting constant SOCIETE_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string. ActivityStateToSelectCompany= Add a filter option to show/hide thirdparties which are currently in activity or has ceased it UseSearchToSelectContact=Use autocompletion fields to choose contact (instead of using a list box).

Also if you have a large number of third parties (> 100 000), you can increase speed by setting constant CONTACT_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string. +HideClosedThirdpartyComboBox=Hide Third party with Status to Closed into customer select list (or combobox) SearchFilter=Search filters options NumberOfKeyToSearch=Nbr of characters to trigger search: %s ViewFullDateActions=Show full dates events in the third sheet diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 4bb7b833596..29333762881 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -52,6 +52,7 @@ ConfirmAjax= Utiliser les popups de confirmation Ajax UseSearchToSelectCompany= Utiliser un champ avec autocomplétion pour choisir un tiers (plutôt qu'une liste déroulante).

Notez que si vous avez un nombre important de tiers (> 100 000), vous pouvez améliorer les performances en définissant la constante SOCIETE_DONOTSEARCH_ANYWHERE à 1 dans Configuration->Divers. La recherche sera alors limitée au début de la chaine. ActivityStateToSelectCompany= Ajouter une option de filtrage lors des recherches pour afficher/masquer les tiers en exercice ou ayant cessés d'exercer UseSearchToSelectContact= Utiliser un champ avec autocomplétion pour choisir un contact (plutôt qu'une liste déroulante).

Notez que si vous avez un nombre important de contacts (> 100 000), vous pouvez améliorer les performances en définissant la constante CONTACT_DONOTSEARCH_ANYWHERE à 1 dans Configuration->Divers. La recherche sera alors limitée au début de la chaine. +HideClosedThirdpartyComboBox=Ne pas afficher les clients à l'état "Clos" dans les listes déroulantes (ou champ avec autocomplétion) SearchFilter=Options des filtres de recherche NumberOfKeyToSearch=Nb carac. déclenchant recherche: %s ViewFullDateActions= Visualiser les dates des actions en entier dans la fiche tiers diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index c8dcbb5d7f2..85768ba5c8c 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -245,6 +245,22 @@ if ($action == 'setprofidinvoicemandatory') } } +//Set hide closed customer into combox or select +if ($action == 'sethideinactivethirdparty') +{ + $status = GETPOST('status','alpha'); + + if (dolibarr_set_const($db, "COMPANY_HIDE_INACTIVE_IN_COMBOBOX",$status,'chaine',0,'',$conf->entity) > 0) + { + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + dol_print_error($db); + } +} + /* * View */ @@ -728,6 +744,27 @@ else print ""; } print ''; + + +// COMPANY_USE_SEARCH_TO_SELECT +$var=!$var; +print ""; +print ''.$langs->trans("HideClosedThirdpartyComboBox").''; +if (! empty($conf->global->COMPANY_HIDE_INACTIVE_IN_COMBOBOX)) +{ + print ''; + print img_picto($langs->trans("Activated"),'switch_on'); + print ''; +} +else +{ + print ''; + print img_picto($langs->trans("Disabled"),'switch_off'); + print ''; +} +print ''; + + print ''; From 772804312285e564d5c9a781a6dd76562a3eae4e Mon Sep 17 00:00:00 2001 From: fhenry Date: Sun, 12 May 2013 11:46:30 +0200 Subject: [PATCH 02/10] Changelog update --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index e7e9a17f089..35202561b9b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ 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 ***** ChangeLog for 3.4 compared to 3.3.2 ***** From 760ae88f39caa09042bf28a20c6e780c19291588 Mon Sep 17 00:00:00 2001 From: fhenry Date: Mon, 13 May 2013 17:08:36 +0200 Subject: [PATCH 03/10] [ task #531 ] Add a duration on tasks --- ChangeLog | 3 +- htdocs/core/lib/project.lib.php | 13 ++- .../install/mysql/migration/3.4.0-3.5.0.sql | 6 +- .../install/mysql/tables/llx_projet_task.sql | 3 +- htdocs/projet/class/task.class.php | 11 +- htdocs/projet/index.php | 104 +++++++++++++++--- htdocs/projet/tasks.php | 8 ++ htdocs/projet/tasks/index.php | 1 + htdocs/projet/tasks/task.php | 12 ++ htdocs/projet/tasks/time.php | 3 + 10 files changed, 143 insertions(+), 21 deletions(-) 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)) { From f98442d7001ab239fd1fe1edc726656afe413ae9 Mon Sep 17 00:00:00 2001 From: fhenry Date: Tue, 14 May 2013 09:24:05 +0200 Subject: [PATCH 04/10] Remove the option into admin screen --- htdocs/core/modules/modSociete.class.php | 4 +++- htdocs/societe/admin/societe.php | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 9c122e43280..83e78cd0479 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -116,12 +116,14 @@ class modSociete extends DolibarrModules $this->const[$r][4] = 0; $r++; + /* $this->const[$r][0] = "COMPANY_HIDE_INACTIVE_IN_COMBOBOX"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "0"; $this->const[$r][3] = "hide thirdparty customer inative in combobox"; - $this->const[$r][4] = 0; + $this->const[$r][4] = 1; $r++; + */ // Boxes $this->boxes = array(); diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 85768ba5c8c..bd73628eec3 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -745,7 +745,7 @@ else } print ''; - +/* // COMPANY_USE_SEARCH_TO_SELECT $var=!$var; print ""; @@ -763,7 +763,7 @@ else print ''; } print ''; - +*/ print ''; From d0b4cef7a48621fa2b880731d9cb43b227332a6b Mon Sep 17 00:00:00 2001 From: fhenry Date: Tue, 14 May 2013 20:22:33 +0200 Subject: [PATCH 05/10] Change duration _planned by planned_workload --- htdocs/core/lib/project.lib.php | 4 +- htdocs/core/modules/modProjet.class.php | 6 +- .../install/mysql/migration/3.4.0-3.5.0.sql | 2 +- .../install/mysql/tables/llx_projet_task.sql | 2 +- htdocs/langs/en_US/projects.lang | 2 + htdocs/langs/fr_FR/projects.lang | 2 + htdocs/projet/class/task.class.php | 20 +- htdocs/projet/index.php | 9 +- htdocs/projet/tasks.php | 13 +- htdocs/projet/tasks/task.php | 22 +- htdocs/projet/tasks/time.php | 229 +++++++++--------- 11 files changed, 168 insertions(+), 143 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index e673b2d6a2f..c9a70c42519 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -422,7 +422,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t // Duration print ''; - print $lines[$i]->duration_planned.' '.$langs->trans('Hours'); + print $lines[$i]->planned_workload.' '.$langs->trans('Hours'); print ''; // Progress @@ -557,7 +557,7 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr // Duration print ''; - print $lines[$i]->duration_planned.' '.$langs->trans('Hours'); + print $lines[$i]->planned_workload.' '.$langs->trans('Hours'); print ''; // Progress diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index 9d75ffa6243..e5f956b0946 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -157,18 +157,18 @@ class modProjet extends DolibarrModules $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country', 's.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode', 'p.rowid'=>"ProjectId",'p.ref'=>"ProjectRef",'p.datec'=>"DateCreation",'p.dateo'=>"DateDebutProjet",'p.datee'=>"DateFinProjet",'p.fk_statut'=>'ProjectStatus','p.description'=>"projectNote", - 'pt.rowid'=>'RefTask','pt.dateo'=>"TaskDateo",'pt.datee'=>"TaskDatee",'pt.duration_effective'=>"DurationEffective",'pt.duration_planned'=>"DurationPlanned",'pt.progress'=>"Progress",'pt.description'=>"TaskDesc"); + 'pt.rowid'=>'RefTask','pt.dateo'=>"TaskDateo",'pt.datee'=>"TaskDatee",'pt.duration_effective'=>"DurationEffective",'pt.planned_workload'=>"DurationPlanned",'pt.progress'=>"Progress",'pt.description'=>"TaskDesc"); //$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_pays:libelle', $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_pays:libelle', 's.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text', 'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','p.description'=>"Text", - 'pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.duration_planned'=>"Duree",'pt.progress'=>"Number",'pt.description'=>"Text"); + 'pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Duree",'pt.progress'=>"Number",'pt.description'=>"Text"); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company', 's.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company', 'f.rowid'=>"project",'f.ref'=>"project",'f.datec'=>"project",'f.duree'=>"project",'f.fk_statut'=>"project",'f.description'=>"project", - 'pt.rowid'=>'task','pt.dateo'=>"task",'pt.datee'=>"task",'pt.duration_effective'=>"task",'pt.duration_planned'=>"task",'pt.progress'=>"task",'pt.description'=>"task"); + 'pt.rowid'=>'task','pt.dateo'=>"task",'pt.datee'=>"task",'pt.duration_effective'=>"task",'pt.planned_workload'=>"task",'pt.progress'=>"task",'pt.description'=>"task"); $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'projet as p, '.MAIN_DB_PREFIX.'projet_task as pt, '.MAIN_DB_PREFIX.'societe as s)'; 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 8d6cc91d1d1..03babcae351 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 @@ -20,6 +20,6 @@ DELETE FROM llx_menu where module='holiday'; -ALTER TABLE llx_projet_task ADD COLUMN duration_planned real DEFAULT 0 NOT NULL AFTER duration_effective; +ALTER TABLE llx_projet_task ADD COLUMN planned_workload 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 8e12ec8f973..1fc7325bea0 100644 --- a/htdocs/install/mysql/tables/llx_projet_task.sql +++ b/htdocs/install/mysql/tables/llx_projet_task.sql @@ -30,7 +30,7 @@ create table llx_projet_task label varchar(255) NOT NULL, description text, duration_effective real DEFAULT 0 NOT NULL, - duration_planned real DEFAULT 0 NOT NULL, + planned_workload 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/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 3851d6b9967..f98b2d303f8 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -105,3 +105,5 @@ TypeContact_project_task_internal_CONTRIBUTOR=Contributor TypeContact_project_task_external_CONTRIBUTOR=Contributor # Documents models DocumentModelBaleine=A complete project's report model (logo...) +PlannedWorkload = Planned workload +WorkloadOccupation= Workload affectation \ No newline at end of file diff --git a/htdocs/langs/fr_FR/projects.lang b/htdocs/langs/fr_FR/projects.lang index 78661416180..1dd45218fc7 100644 --- a/htdocs/langs/fr_FR/projects.lang +++ b/htdocs/langs/fr_FR/projects.lang @@ -107,3 +107,5 @@ TypeContact_project_task_external_CONTRIBUTOR=Intervenant DocumentModelBaleine=Modèle de rapport de projet complet (logo...) SelectElement=Eléments associable au projet : AddElement=Associer +PlannedWorkload = Charge de travail prévue +WorkloadOccupation= Pourcentage affectation \ No newline at end of file diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 18824f81140..57513250f0b 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -41,7 +41,7 @@ class Task extends CommonObject var $label; var $description; var $duration_effective; - var $duration_planned; + var $planned_workload; var $date_c; var $date_start; var $date_end; @@ -102,7 +102,7 @@ class Task extends CommonObject $sql.= ", fk_user_creat"; $sql.= ", dateo"; $sql.= ", datee"; - $sql.= ", duration_planned"; + $sql.= ", planned_workload"; $sql.= ", progress"; $sql.= ") VALUES ("; $sql.= $this->fk_project; @@ -113,7 +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->planned_workload!=''?$this->planned_workload:0); $sql.= ", ".($this->progress!=''?$this->progress:0); $sql.= ")"; @@ -186,7 +186,7 @@ class Task extends CommonObject $sql.= " t.label,"; $sql.= " t.description,"; $sql.= " t.duration_effective,"; - $sql.= " t.duration_planned,"; + $sql.= " t.planned_workload,"; $sql.= " t.datec,"; $sql.= " t.dateo,"; $sql.= " t.datee,"; @@ -215,7 +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->planned_workload = $obj->planned_workload; $this->date_c = $this->db->jdate($obj->datec); $this->date_start = $this->db->jdate($obj->dateo); $this->date_end = $this->db->jdate($obj->datee); @@ -259,7 +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); + if (isset($this->planned_workload)) $this->planned_workload=trim($this->planned_workload); // Check parameters // Put here code to add control on parameters values @@ -271,7 +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.= " planned_workload=".(isset($this->planned_workload)?$this->planned_workload:"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; @@ -531,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, t.duration_planned"; + $sql.= " t.dateo as date_start, t.datee as date_end, t.planned_workload"; if ($mode == 0) { $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; @@ -593,7 +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]->planned_workload= $obj->planned_workload; $tasks[$i]->progress = $obj->progress; $tasks[$i]->public = $obj->public; $tasks[$i]->date_start = $this->db->jdate($obj->date_start); @@ -1005,7 +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; + $clone_task->planned_workload = $clone_task->planned_workload; //Manage Task Date if ($clone_change_dt) diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index fc17df207d5..6ca7828f6c4 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -146,11 +146,11 @@ print ''.$langs->trans('Projects').''; print ''.$langs->trans('Task').''; print ''.$langs->trans('DateStart').''; print ''.$langs->trans('DateEnd').''; -print ''.$langs->trans('TaskRessourceLinks').' %'; +print ''.$langs->trans('WorkloadOccupation').''; 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 = "SELECT p.title, p.rowid as projectid, t.label, t.rowid as taskid, u.rowid as userid, t.planned_workload, t.dateo, t.datee, tasktime.task_duration"; $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"; @@ -159,6 +159,7 @@ $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.= " AND p.fk_statut=1"; $sql.= " ORDER BY u.rowid, t.dateo, t.datee"; $userstatic=new User($db); @@ -186,10 +187,10 @@ if ( $resql ) print ''.$obj->label.''; print ''.dol_print_date($db->jdate($obj->dateo)).''; print ''.dol_print_date($db->jdate($obj->datee)).''; - if (empty($obj->duration_planned)) { + if (empty($obj->planned_workload)) { $percentcompletion = '0'; } else { - $percentcompletion = intval(($obj->totaltime*100)/$obj->duration_planned); + $percentcompletion = intval(($obj->task_duration*100)/$obj->planned_workload); } print ''.$percentcompletion.' %'; print "\n"; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index ac41ebaa384..7e3a2afd281 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -71,7 +71,7 @@ $hookmanager->initHooks(array('projecttaskcard')); $progress=GETPOST('progress', 'int'); $label=GETPOST('label', 'alpha'); $description=GETPOST('description'); -$duration_planned=GETPOST('duration_planned'); +$planned_workload=GETPOST('planned_workload'); $userAccess=0; @@ -116,7 +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->planned_workload = $planned_workload * 3600;//We set the planned workload into minutes $task->fk_task_parent = $task_parent; $task->date_c = dol_now(); $task->date_start = $date_start; @@ -295,8 +295,13 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->socie print ''; // Duration planned - print ''.$langs->trans("Duration").''; - print ' '.$langs->trans('Hours'); + print ''.$langs->trans("PlannedWorkload").''; + if (!empty($object->planned_workload)) { + $planned_workload_hours = intval($object->planned_workload / 3600); + }else { + $planned_workload_hours = 0; + } + print ' '.$langs->trans('Hours'); print ''; // Progress diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 84479231daa..98a511b2929 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -36,7 +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'); +$planned_workload=GETPOST('planned_workload'); // Security check $socid=0; @@ -76,7 +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->planned_workload = $planned_workload*3600; //We set the planned workload into minutes $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']; @@ -286,8 +286,13 @@ if ($id > 0 || ! empty($ref)) print ''; // Duration planned - print ''.$langs->trans("Duration").''; - print ' '.$langs->trans('Hours'); + print ''.$langs->trans("PlannedWorkload").''; + if (!empty($object->planned_workload)) { + $planned_workload_hours = intval($object->planned_workload / 3600); + }else { + $planned_workload_hours = 0; + } + print ' '.$langs->trans('Hours'); print ''; // Progress @@ -376,8 +381,13 @@ if ($id > 0 || ! empty($ref)) print ''; // Duration planned - print ''.$langs->trans("Duration").''; - print $object->duration_planned.' '.$langs->trans('Hours'); + print ''.$langs->trans("PlannedWorkload").''; + if (!empty($object->planned_workload)) { + $planned_workload_hours = intval($object->planned_workload / 3600); + }else { + $planned_workload_hours = 0; + } + print $planned_workload_hours.' '.$langs->trans('Hours'); print ''; // Progress diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 5d789ee720e..1c7cd1bc9cc 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1,28 +1,28 @@ * Copyright (C) 2006-2012 Laurent Destailleur - * Copyright (C) 2010-2012 Regis Houssin - * Copyright (C) 2011 Juanjo Menent - * - * 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) 2010-2012 Regis Houssin +* Copyright (C) 2011 Juanjo Menent +* +* 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/tasks/time.php * \ingroup project * \brief Page to add new time spent on a task - */ +*/ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; @@ -50,7 +50,7 @@ $projectstatic = new Project($db); /* * Actions - */ +*/ if ($action == 'addtimespent' && $user->rights->projet->creer) { @@ -165,7 +165,7 @@ if (! empty($project_ref) && ! empty($withproject)) /* * View - */ +*/ llxHeader("",$langs->trans("Task")); @@ -176,7 +176,7 @@ if ($id > 0 || ! empty($ref)) { /* * Fiche projet en mode visu - */ + */ if ($object->fetch($id) >= 0) { $result=$projectstatic->fetch($object->fk_project); @@ -186,50 +186,50 @@ if ($id > 0 || ! empty($ref)) if ($withproject) { - // Tabs for project - $tab='tasks'; - $head=project_prepare_head($projectstatic); - dol_fiche_head($head, $tab, $langs->trans("Project"),0,($projectstatic->public?'projectpub':'project')); + // Tabs for project + $tab='tasks'; + $head=project_prepare_head($projectstatic); + dol_fiche_head($head, $tab, $langs->trans("Project"),0,($projectstatic->public?'projectpub':'project')); - $param=($mode=='mine'?'&mode=mine':''); + $param=($mode=='mine'?'&mode=mine':''); - print ''; + print '
'; - // Ref - print ''; + // Ref + print ''; - print ''; + print ''; - print ''; - print ''; + print ''; + print ''; - // Visibility - print ''; + // Visibility + print ''; - // Statut - print ''; + // Statut + print ''; - print '
'; - print $langs->trans("Ref"); - print ''; - // Define a complementary filter for search of next/prev ref. - if (! $user->rights->projet->all->lire) - { - $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,0); - $projectstatic->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")"; - } - print $form->showrefnav($projectstatic,'project_ref','',1,'ref','ref','',$param.'&withproject=1'); - print '
'; + print $langs->trans("Ref"); + print ''; + // Define a complementary filter for search of next/prev ref. + if (! $user->rights->projet->all->lire) + { + $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,0); + $projectstatic->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")"; + } + print $form->showrefnav($projectstatic,'project_ref','',1,'ref','ref','',$param.'&withproject=1'); + print '
'.$langs->trans("Label").''.$projectstatic->title.'
'.$langs->trans("Label").''.$projectstatic->title.'
'.$langs->trans("Company").''; - if (! empty($projectstatic->societe->id)) print $projectstatic->societe->getNomUrl(1); - else print ' '; - print '
'.$langs->trans("Company").''; + if (! empty($projectstatic->societe->id)) print $projectstatic->societe->getNomUrl(1); + else print ' '; + print '
'.$langs->trans("Visibility").''; - if ($projectstatic->public) print $langs->trans('SharedProject'); - else print $langs->trans('PrivateProject'); - print '
'.$langs->trans("Visibility").''; + if ($projectstatic->public) print $langs->trans('SharedProject'); + else print $langs->trans('PrivateProject'); + print '
'.$langs->trans("Status").''.$projectstatic->getLibStatut(4).'
'.$langs->trans("Status").''.$projectstatic->getLibStatut(4).'
'; + print ''; - dol_fiche_end(); + dol_fiche_end(); - print '
'; + print '
'; } $head=task_prepare_head($object); @@ -254,31 +254,36 @@ if ($id > 0 || ! empty($ref)) print ''; if (! GETPOST('withproject') || empty($projectstatic->id)) { - $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1); - $object->next_prev_filter=" fk_projet in (".$projectsListId.")"; + $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1); + $object->next_prev_filter=" fk_projet in (".$projectsListId.")"; } else $object->next_prev_filter=" fk_projet = ".$projectstatic->id; - print $form->showrefnav($object,'id',$linkback,1,'rowid','ref','',$param); + print $form->showrefnav($object,'id',$linkback,1,'rowid','ref','',$param); print ''; // Label print ''.$langs->trans("Label").''.$object->label.''; // Duration planned - print ''.$langs->trans("Duration").''.$object->duration_planned.' '.$langs->trans('Hours').''; - + if (!empty($object->planned_workload)) { + $planned_workload_hours = intval($object->planned_workload / 3600); + }else { + $planned_workload_hours = 0; + } + print ''.$langs->trans("PlannedWorkload").''.$planned_workload_hours.' '.$langs->trans('Hours').''; + // Project if (empty($withproject)) { - print ''.$langs->trans("Project").''; - print $projectstatic->getNomUrl(1); - print ''; + print ''.$langs->trans("Project").''; + print $projectstatic->getNomUrl(1); + print ''; - // Third party - print ''.$langs->trans("Company").''; - if ($projectstatic->societe->id) print $projectstatic->societe->getNomUrl(1); - else print ' '; - print ''; + // Third party + print ''.$langs->trans("Company").''; + if ($projectstatic->societe->id) print $projectstatic->societe->getNomUrl(1); + else print ' '; + print ''; } print ''; @@ -288,7 +293,7 @@ if ($id > 0 || ! empty($ref)) /* * Add time spent - */ + */ if ($user->rights->projet->creer) { print '
'; @@ -345,7 +350,7 @@ if ($id > 0 || ! empty($ref)) /* * List of time spent - */ + */ $sql = "SELECT t.rowid, t.task_date, t.task_duration, t.fk_user, t.note"; $sql.= ", u.lastname, u.firstname"; $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; @@ -392,21 +397,21 @@ if ($id > 0 || ! empty($ref)) foreach ($tasks as $task_time) { $var=!$var; - print ""; + print ""; - // Date - print ''; - if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) - { - print $form->select_date($db->jdate($task_time->task_date),'timeline','','','',"timespent_date"); - } - else - { - print dol_print_date($db->jdate($task_time->task_date),'day'); - } - print ''; + // Date + print ''; + if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) + { + print $form->select_date($db->jdate($task_time->task_date),'timeline','','','',"timespent_date"); + } + else + { + print dol_print_date($db->jdate($task_time->task_date),'day'); + } + print ''; - // User + // User print ''; if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) { @@ -419,43 +424,43 @@ if ($id > 0 || ! empty($ref)) $userstatic->firstname = $task_time->firstname; print $userstatic->getNomUrl(1); } - print ''; + print ''; - // Note - print ''; - if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) - { - print ''; - } - else - { - print dol_nl2br($task_time->note); - } - print ''; + // Note + print ''; + if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) + { + print ''; + } + else + { + print dol_nl2br($task_time->note); + } + print ''; - // Time spent - print ''; - if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) - { - print ''; - print $form->select_duration('new_duration',$task_time->task_duration); - } - else - { + // Time spent + print ''; + if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) + { + print ''; + print $form->select_duration('new_duration',$task_time->task_duration); + } + else + { print convertSecondToTime($task_time->task_duration,'all'); - } - print ''; + } + print ''; // Edit and delete icon print ''; if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) - { - print ''; - print ''; - print '
'; - print ''; - } - else if ($user->rights->projet->creer) + { + print ''; + print ''; + print '
'; + print ''; + } + else if ($user->rights->projet->creer) { print ' '; print 'rowid.($withproject?'&withproject=1':'').'">'; From 6727ab34edf10f5f6722d42be43fd07261fbd824 Mon Sep 17 00:00:00 2001 From: fhenry Date: Tue, 14 May 2013 20:25:34 +0200 Subject: [PATCH 06/10] Review style hideonsmartphone --- htdocs/core/lib/project.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index c9a70c42519..9f7ef3355e5 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -443,7 +443,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t // Tick to drag and drop if ($addordertick) { - print ' '; + print ' '; } print "\n"; From 7de861eee4bf078314da7113a4caab370fd4dbc4 Mon Sep 17 00:00:00 2001 From: fhenry Date: Tue, 14 May 2013 20:30:18 +0200 Subject: [PATCH 07/10] Beteer display --- htdocs/core/lib/project.lib.php | 32 +++++++++++++++++++++----------- htdocs/projet/tasks.php | 2 +- htdocs/projet/tasks/index.php | 2 +- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 9f7ef3355e5..ae124ebb484 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -49,8 +49,8 @@ function project_prepare_head($object) $h++; if (! empty($conf->fournisseur->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled) - || ! empty($conf->facture->enabled) || ! empty($conf->contrat->enabled) - || ! empty($conf->ficheinter->enabled) || ! empty($conf->agenda->enabled) || ! empty($conf->deplacement->enabled)) + || ! empty($conf->facture->enabled) || ! empty($conf->contrat->enabled) + || ! empty($conf->ficheinter->enabled) || ! empty($conf->agenda->enabled) || ! empty($conf->deplacement->enabled)) { $head[$h][0] = DOL_URL_ROOT.'/projet/element.php?id='.$object->id; $head[$h][1] = $langs->trans("Referers"); @@ -420,10 +420,15 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t print dol_print_date($lines[$i]->date_end,'day'); print ''; - // Duration - print ''; - print $lines[$i]->planned_workload.' '.$langs->trans('Hours'); - print ''; + // Planned Workload + print ''; + if (!empty($lines[$i]->planned_workload)) { + $planned_workload_hours = intval($lines[$i]->planned_workload / 3600); + }else { + $planned_workload_hours = 0; + } + print $planned_workload_hours.' '.$langs->trans('Hours'); + print ''; // Progress print ''; @@ -443,7 +448,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t // Tick to drag and drop if ($addordertick) { - print ' '; + print ' '; } print "\n"; @@ -555,10 +560,15 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr print dol_print_date($lines[$i]->date_end,'day'); print ''; - // Duration - print ''; - print $lines[$i]->planned_workload.' '.$langs->trans('Hours'); - print ''; + // Planned Workload + print ''; + if (!empty($lines[$i]->planned_workload)) { + $planned_workload_hours = intval($lines[$i]->planned_workload / 3600); + }else { + $planned_workload_hours = 0; + } + print $planned_workload_hours.' '.$langs->trans('Hours'); + print ''; // Progress print ''; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 7e3a2afd281..1bdb6711afb 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -403,7 +403,7 @@ else print ''.$langs->trans("LabelTask").''; print ''.$langs->trans("DateStart").''; print ''.$langs->trans("DateEnd").''; - print ''.$langs->trans("Duration").''; + print ''.$langs->trans("PlannedWorkload").''; print ''.$langs->trans("Progress").''; print ''.$langs->trans("TimeSpent").''; print ' '; diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php index c7a8647bfbf..5b42b76c221 100644 --- a/htdocs/projet/tasks/index.php +++ b/htdocs/projet/tasks/index.php @@ -100,7 +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("PlannedWorkload").''; print ''.$langs->trans("Progress").''; print ''.$langs->trans("TimeSpent").''; print "\n"; From b280bff809c1770efdff38f12da22b3cbf79d09e Mon Sep 17 00:00:00 2001 From: fhenry Date: Tue, 14 May 2013 20:33:56 +0200 Subject: [PATCH 08/10] Update comments0 --- htdocs/projet/tasks.php | 2 +- htdocs/projet/tasks/task.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 1bdb6711afb..ccfb5087fc5 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -116,7 +116,7 @@ if ($action == 'createtask' && $user->rights->projet->creer) $task->fk_project = $projectid; $task->label = $label; $task->description = $description; - $task->planned_workload = $planned_workload * 3600;//We set the planned workload into minutes + $task->planned_workload = $planned_workload * 3600;//We set the planned workload into seconds $task->fk_task_parent = $task_parent; $task->date_c = dol_now(); $task->date_start = $date_start; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 98a511b2929..c99318e9221 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -76,7 +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->planned_workload = $planned_workload*3600; //We set the planned workload into minutes + $object->planned_workload = $planned_workload*3600; //We set the planned workload into seconds $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']; From be525ad0e88e5a72cfab395fb774f92efacc9132 Mon Sep 17 00:00:00 2001 From: fhenry Date: Wed, 15 May 2013 14:19:16 +0200 Subject: [PATCH 09/10] Better code quality for [ task #531 ] Add a duration on tasks --- htdocs/core/class/html.form.class.php | 37 +++++++++++++++++---------- htdocs/core/lib/date.lib.php | 10 ++++++++ htdocs/core/lib/project.lib.php | 8 ++---- htdocs/projet/index.php | 3 ++- htdocs/projet/tasks.php | 13 +++------- htdocs/projet/tasks/index.php | 2 +- htdocs/projet/tasks/task.php | 21 +++++---------- htdocs/projet/tasks/time.php | 17 +++++------- 8 files changed, 56 insertions(+), 55 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 4a03afcbb4b..b29e9da546d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3518,10 +3518,13 @@ class Form * @param string $prefix prefix * @param int $iSecond Default preselected duration (number of seconds) * @param int $disabled Disable the combo box + * @param string $typehour if select then hour in select if text input in text * @return void */ - function select_duration($prefix,$iSecond='',$disabled=0) + function select_duration($prefix,$iSecond='',$disabled=0,$typehour='select') { + global $langs; + if ($iSecond) { require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -3529,19 +3532,27 @@ class Form $hourSelected = convertSecondToTime($iSecond,'hour'); $minSelected = convertSecondToTime($iSecond,'min'); } - - print ''; + for ($hour = 0; $hour < 24; $hour++) + { + print '"; + } + print ""; } - print ""; - print "H  "; + elseif ($typehour=='text') + { + $fullhours=convertSecondToTime($iSecond,'fullhour'); + print ''; + } + print $langs->trans('Hours'). " "; print '"; - print "M "; + print $langs->trans('Minutes'). " "; } diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index c7a7e1240dd..29870c1ce95 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -287,6 +287,16 @@ function convertSecondToTime($iSecond,$format='all',$lengthOfDay=86400,$lengthOf { $sTime=dol_print_date($iSecond,'%H',true); } + else if ($format == 'fullhour') + { + if (!empty($iSecond)) { + $iSecond=$iSecond/3600; + } + else { + $iSecond=0; + } + $sTime=$iSecond; + } else if ($format == 'min') { $sTime=dol_print_date($iSecond,'%M',true); diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index ae124ebb484..8409eed5c6e 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -422,12 +422,8 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t // Planned Workload print ''; - if (!empty($lines[$i]->planned_workload)) { - $planned_workload_hours = intval($lines[$i]->planned_workload / 3600); - }else { - $planned_workload_hours = 0; - } - print $planned_workload_hours.' '.$langs->trans('Hours'); + if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'all'); + else print '--:--'; print ''; // Progress diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 6ca7828f6c4..112816c9204 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -164,6 +164,7 @@ $sql.= " ORDER BY u.rowid, t.dateo, t.datee"; $userstatic=new User($db); +dol_syslog('projet:index.php: affectationpercent sql='.$sql,LOG_DEBUG); $resql = $db->query($sql); if ( $resql ) { @@ -192,7 +193,7 @@ if ( $resql ) } else { $percentcompletion = intval(($obj->task_duration*100)/$obj->planned_workload); } - print ''.$percentcompletion.' %'; + print ''.$percentcompletion.' %'; print "\n"; $i++; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index ccfb5087fc5..36ada461608 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -71,7 +71,7 @@ $hookmanager->initHooks(array('projecttaskcard')); $progress=GETPOST('progress', 'int'); $label=GETPOST('label', 'alpha'); $description=GETPOST('description'); -$planned_workload=GETPOST('planned_workload'); +$planned_workload=GETPOST('planned_workloadhour'); $userAccess=0; @@ -294,14 +294,9 @@ 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 + // planned workload print ''.$langs->trans("PlannedWorkload").''; - if (!empty($object->planned_workload)) { - $planned_workload_hours = intval($object->planned_workload / 3600); - }else { - $planned_workload_hours = 0; - } - print ' '.$langs->trans('Hours'); + print $form->select_duration('planned_workload',$object->planned_workload,0,'text'); print ''; // Progress @@ -403,7 +398,7 @@ else print ''.$langs->trans("LabelTask").''; print ''.$langs->trans("DateStart").''; print ''.$langs->trans("DateEnd").''; - print ''.$langs->trans("PlannedWorkload").''; + print ''.$langs->trans("PlannedWorkload").''; print ''.$langs->trans("Progress").''; print ''.$langs->trans("TimeSpent").''; print ' '; diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php index 5b42b76c221..cabcea2c48c 100644 --- a/htdocs/projet/tasks/index.php +++ b/htdocs/projet/tasks/index.php @@ -109,7 +109,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print ' '; print ''; print ''; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index c99318e9221..858e4612f1a 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $id=GETPOST('id','int'); $ref=GETPOST('ref','alpha'); @@ -36,7 +37,7 @@ $action=GETPOST('action','alpha'); $confirm=GETPOST('confirm','alpha'); $withproject=GETPOST('withproject','int'); $project_ref=GETPOST('project_ref','alpha'); -$planned_workload=GETPOST('planned_workload'); +$planned_workload=GETPOST('planned_workloadhour'); // Security check $socid=0; @@ -285,14 +286,9 @@ if ($id > 0 || ! empty($ref)) print $form->select_date($object->date_end?$object->date_end:-1,'datee'); print ''; - // Duration planned + // workload planned print ''.$langs->trans("PlannedWorkload").''; - if (!empty($object->planned_workload)) { - $planned_workload_hours = intval($object->planned_workload / 3600); - }else { - $planned_workload_hours = 0; - } - print ' '.$langs->trans('Hours'); + print $form->select_duration('planned_workload',$object->planned_workload,0,'text'); print ''; // Progress @@ -380,14 +376,9 @@ if ($id > 0 || ! empty($ref)) print dol_print_date($object->date_end,'day'); print ''; - // Duration planned + // planned Workload print ''.$langs->trans("PlannedWorkload").''; - if (!empty($object->planned_workload)) { - $planned_workload_hours = intval($object->planned_workload / 3600); - }else { - $planned_workload_hours = 0; - } - print $planned_workload_hours.' '.$langs->trans('Hours'); + print convertSecondToTime($object->planned_workload,'all'); print ''; // Progress diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 1c7cd1bc9cc..2b6306b5afd 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -56,7 +56,9 @@ if ($action == 'addtimespent' && $user->rights->projet->creer) { $error=0; - if (empty($_POST["timespent_durationhour"]) && empty($_POST["timespent_durationmin"])) + $timespent_durationhour = GETPOST('timespent_durationhour','int'); + $timespent_durationmin = GETPOST('timespent_durationmin','int'); + if (empty($timespent_durationhour) && empty($timespent_durationmin)) { $mesg='
'.$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Duration")).'
'; $error++; @@ -264,13 +266,8 @@ if ($id > 0 || ! empty($ref)) // Label print ''.$langs->trans("Label").''.$object->label.''; - // Duration planned - if (!empty($object->planned_workload)) { - $planned_workload_hours = intval($object->planned_workload / 3600); - }else { - $planned_workload_hours = 0; - } - print ''.$langs->trans("PlannedWorkload").''.$planned_workload_hours.' '.$langs->trans('Hours').''; + // planned workload + print ''.$langs->trans("PlannedWorkload").''.convertSecondToTime($object->planned_workload,'all').''; // Project if (empty($withproject)) @@ -336,7 +333,7 @@ if ($id > 0 || ! empty($ref)) // Duration print ''; - print $form->select_duration('timespent_duration',($_POST['timespent_duration']?$_POST['timespent_duration']:'')); + print $form->select_duration('timespent_duration',($_POST['timespent_duration']?$_POST['timespent_duration']:''),0,'text'); print ''; print ''; @@ -443,7 +440,7 @@ if ($id > 0 || ! empty($ref)) if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) { print ''; - print $form->select_duration('new_duration',$task_time->task_duration); + print $form->select_duration('new_duration',$task_time->task_duration,0,'text'); } else { From 721e074072054b2755d99f439597284b9461c247 Mon Sep 17 00:00:00 2001 From: fhenry Date: Wed, 15 May 2013 14:25:33 +0200 Subject: [PATCH 10/10] Better wulity code for Task 532 --- htdocs/core/lib/project.lib.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 8409eed5c6e..5dfd111e288 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -558,12 +558,8 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr // Planned Workload print ''; - if (!empty($lines[$i]->planned_workload)) { - $planned_workload_hours = intval($lines[$i]->planned_workload / 3600); - }else { - $planned_workload_hours = 0; - } - print $planned_workload_hours.' '.$langs->trans('Hours'); + if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'all'); + else print '--:--'; print ''; // Progress