From a71e75c7c7d7ff3c8c734510e95eabd1773fd623 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 28 Jan 2010 11:08:11 +0000 Subject: [PATCH] Works on enhancement of project tasks --- .../install/mysql/migration/2.7.0-2.8.0.sql | 8 +- .../install/mysql/tables/llx_facturedet.sql | 32 +-- htdocs/install/mysql/tables/llx_projet.sql | 19 +- .../install/mysql/tables/llx_projet_task.sql | 2 +- htdocs/projet/fiche.php | 57 +++- htdocs/projet/project.class.php | 130 +++------ htdocs/projet/tasks/task.class.php | 6 +- htdocs/projet/tasks/task.php | 263 +++++++++++------- 8 files changed, 289 insertions(+), 228 deletions(-) diff --git a/htdocs/install/mysql/migration/2.7.0-2.8.0.sql b/htdocs/install/mysql/migration/2.7.0-2.8.0.sql index 3b07c3d29ba..028c1dac9db 100755 --- a/htdocs/install/mysql/migration/2.7.0-2.8.0.sql +++ b/htdocs/install/mysql/migration/2.7.0-2.8.0.sql @@ -117,7 +117,8 @@ ALTER TABLE llx_projet_task ADD COLUMN dateo datetime AFTER tms; ALTER TABLE llx_projet_task ADD COLUMN datee datetime AFTER dateo; ALTER TABLE llx_projet_task ADD COLUMN datev datetime AFTER datee; ALTER TABLE llx_projet_task CHANGE title label varchar(255) NOT NULL; -ALTER TABLE llx_projet_task ADD COLUMN description varchar(255) AFTER label; +ALTER TABLE llx_projet_task ADD COLUMN description text AFTER label; +ALTER TABLE llx_projet_task MODIFY description text; ALTER TABLE llx_projet_task ADD COLUMN progress integer DEFAULT 0 AFTER duration_effective; ALTER TABLE llx_projet_task ADD COLUMN priority integer DEFAULT 0 AFTER progress; ALTER TABLE llx_projet_task ADD COLUMN fk_user_modif integer AFTER fk_user_creat; @@ -143,4 +144,7 @@ insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) v insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (190, 'project_task', 'external', 'TASKEXECUTIVE', 'Responsable', 1); insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (191, 'project_task', 'external', 'CONTRIBUTOR', 'Intervenant', 1); - +ALTER TABLE llx_projet ADD COLUMN description text AFTER title; +ALTER TABLE llx_projet CHANGE note note_private text; +ALTER TABLE llx_projet ADD COLUMN note_public text AFTER note_private; +ALTER TABLE llx_projet CHANGE fk_statut smallint DEFAULT 0 NOT NULL; diff --git a/htdocs/install/mysql/tables/llx_facturedet.sql b/htdocs/install/mysql/tables/llx_facturedet.sql index 2a75d2f4547..2ca9dda5d56 100644 --- a/htdocs/install/mysql/tables/llx_facturedet.sql +++ b/htdocs/install/mysql/tables/llx_facturedet.sql @@ -24,26 +24,26 @@ create table llx_facturedet ( rowid integer AUTO_INCREMENT PRIMARY KEY, fk_facture integer NOT NULL, - fk_product integer NULL, -- Doit pouvoir etre nul pour ligne detail sans produits + fk_product integer NULL, -- Doit pouvoir etre nul pour ligne detail sans produits description text, - tva_taux real, -- Taux tva produit/service (exemple 19.6) - qty real, -- Quantity (exemple 2) - remise_percent real DEFAULT 0, -- % de la remise ligne (exemple 20%) - remise real DEFAULT 0, -- Montant calcul� de la remise % sur PU HT (exemple 20) - fk_remise_except integer NULL, -- Lien vers table des remises fixes - subprice real, -- P.U. HT (exemple 100) - price real, -- P.U. HT apres remise % de ligne - total_ht real, -- Total HT de la ligne toute quantit� et incluant remise ligne et globale - total_tva real, -- Total TVA de la ligne toute quantit� et incluant remise ligne et globale - total_ttc real, -- Total TTC de la ligne toute quantit� et incluant remise ligne et globale + tva_taux real, -- Taux tva produit/service (exemple 19.6) + qty real, -- Quantity (exemple 2) + remise_percent real DEFAULT 0, -- % de la remise ligne (exemple 20%) + remise real DEFAULT 0, -- Montant calcule de la remise % sur PU HT (exemple 20) + fk_remise_except integer NULL, -- Lien vers table des remises fixes + subprice real, -- P.U. HT (exemple 100) + price real, -- P.U. HT apres remise % de ligne + total_ht real, -- Total HT de la ligne toute quantite et incluant remise ligne et globale + total_tva real, -- Total TVA de la ligne toute quantite et incluant remise ligne et globale + total_ttc real, -- Total TTC de la ligne toute quantite et incluant remise ligne et globale product_type integer DEFAULT 0, - date_start datetime DEFAULT NULL, -- date debut si service - date_end datetime DEFAULT NULL, -- date fin si service - info_bits integer DEFAULT 0, -- TVA NPR ou non + date_start datetime DEFAULT NULL, -- date debut si service + date_end datetime DEFAULT NULL, -- date fin si service + info_bits integer DEFAULT 0, -- TVA NPR ou non fk_code_ventilation integer DEFAULT 0 NOT NULL, fk_export_compta integer DEFAULT 0 NOT NULL, - special_code integer UNSIGNED DEFAULT 0, -- code pour les lignes speciales - rang integer DEFAULT 0, -- ordre d'affichage + special_code integer UNSIGNED DEFAULT 0, -- code pour les lignes speciales + rang integer DEFAULT 0, -- ordre d'affichage import_key varchar(14) )type=innodb; diff --git a/htdocs/install/mysql/tables/llx_projet.sql b/htdocs/install/mysql/tables/llx_projet.sql index 40fa87df98b..e8697c4f4a4 100644 --- a/htdocs/install/mysql/tables/llx_projet.sql +++ b/htdocs/install/mysql/tables/llx_projet.sql @@ -1,5 +1,6 @@ -- =========================================================================== -- Copyright (C) 2002 Rodolphe Quiedeville +-- Copyright (C) 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 @@ -22,15 +23,17 @@ create table llx_projet ( rowid integer AUTO_INCREMENT PRIMARY KEY, fk_soc integer, - fk_statut smallint NOT NULL, - datec date, -- date creation project + datec date, -- date creation project tms timestamp, - dateo date, -- date start project - datee date, -- date end project + dateo date, -- date start project + datee date, -- date end project ref varchar(50), - entity integer DEFAULT 1 NOT NULL, -- multi company id - title varchar(255), - fk_user_creat integer, -- createur du projet - note text, + entity integer DEFAULT 1 NOT NULL, -- multi company id + title varchar(255) NOT NULL, + description text, + fk_user_creat integer, -- createur du projet + fk_statut smallint DEFAULT 0 NOT NULL, + note_private text, + note_public text, model_pdf varchar(50) )type=innodb; diff --git a/htdocs/install/mysql/tables/llx_projet_task.sql b/htdocs/install/mysql/tables/llx_projet_task.sql index 3c6901513dd..7ab302cca87 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 datee datetime, -- date end task datev datetime, -- date validation label varchar(255) NOT NULL, - description varchar(255), + description text, duration_effective real NOT NULL, progress integer DEFAULT 0, -- percentage increase priority integer DEFAULT 0, -- priority diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php index 76887713031..0b8aedaff8f 100644 --- a/htdocs/projet/fiche.php +++ b/htdocs/projet/fiche.php @@ -77,6 +77,7 @@ if ($_POST["action"] == 'add' && $user->rights->projet->creer) $project->ref = $_POST["ref"]; $project->title = $_POST["title"]; $project->socid = $_POST["socid"]; + $project->description = $_POST["description"]; $project->user_resp_id = $_POST["officer_project"]; $project->datec=dol_now('tzserver'); $project->dateo=dol_mktime(12,0,0,$_POST['projectmonth'],$_POST['projectday'],$_POST['projectyear']); @@ -125,7 +126,7 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"] && $user->rights->projet- $project->ref = $_POST["ref"]; $project->title = $_POST["title"]; $project->socid = $_POST["socid"]; - $project->user_resp_id = $_POST["officer_project"]; + $project->description = $_POST["description"]; $project->date_start = dol_mktime(12,0,0,$_POST['projectmonth'],$_POST['projectday'],$_POST['projectyear']); $project->date_end = dol_mktime(12,0,0,$_POST['projectendmonth'],$_POST['projectendday'],$_POST['projectendyear']); @@ -230,6 +231,8 @@ llxHeader("",$langs->trans("Projects"),$help_url); $html = new Form($db); $formfile = new FormFile($db); +$userstatic=new User($db); + if ($_GET["action"] == 'create' && $user->rights->projet->creer) { /* @@ -259,7 +262,7 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) } // Ref - print ''.$langs->trans("Ref").'*'; + print ''.$langs->trans("Ref").'*'; // Label print ''.$langs->trans("Label").'*'; @@ -291,6 +294,12 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) print ''.$langs->trans("DateEnd").''; print $html->select_date(-1,'projectend'); print ''; + + // Description + print ''.$langs->trans("Description").''; + print ''; + print ''; + print ''; print ''; print ''; @@ -349,19 +358,41 @@ else print ''; // Ref - print ''; + print ''; + print ''; // Label - print ''; + print ''; + print ''; // Customer print ''; - // Responsable du projet + // Project leader print ''; // Statut @@ -376,6 +407,12 @@ else print ''; + + // Description + print ''; + print ''; print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'
'.$langs->trans("Label").'
'.$langs->trans("Label").'
'.$langs->trans("Company").''; print $html->select_societes($project->societe->id,'socid','',1,1); print '
'.$langs->trans("OfficerProject").''; - $html->select_users($project->user_resp_id,'officer_project',1); + $contact = $project->liste_contact(4,'internal'); + $num=sizeof($contact); + if ($num) + { + $i = 0; + while ($i < $num) + { + if ($contact[$i]['code'] == 'PROJECTLEADER') + { + $userstatic->id = $contact[$i]['id']; + $userstatic->fetch(); + print $userstatic->getNomUrl(1); + print '
'; + } + $i++; + } + } + else + { + print $langs->trans('SharedProject'); + } print '
'.$langs->trans("DateEnd").''; print $html->select_date($project->date_end?$project->date_end:-1,'projectend'); print '
'.$langs->trans("Description").''; + print ''; + print '
'; print '   '; @@ -385,8 +422,7 @@ else } else { - $userstatic=new User($db); - + print ''; // Ref @@ -440,6 +476,11 @@ else print ''; + + // Description + print ''; print '
'.$langs->trans("DateEnd").''; print dol_print_date($project->date_end,'day'); print '
'.$langs->trans("Description").''; + print nl2br($project->description); + print '
'; } diff --git a/htdocs/projet/project.class.php b/htdocs/projet/project.class.php index 8d1e2e2e940..c6daa94cfed 100644 --- a/htdocs/projet/project.class.php +++ b/htdocs/projet/project.class.php @@ -40,6 +40,7 @@ class Project extends CommonObject var $id; var $ref; + var $description; var $statut; var $title; var $date_c; @@ -48,6 +49,8 @@ class Project extends CommonObject var $date_end; var $socid; var $user_resp_id; + var $note_private; + var $note_public; var $statuts_short; var $statuts; @@ -80,15 +83,25 @@ class Project extends CommonObject return -1; } - $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet (ref, title, fk_soc, fk_user_creat, fk_user_resp, datec, dateo, datee, fk_statut)"; - $sql.= " VALUES ('".addslashes($this->ref)."', '".addslashes($this->title)."',"; - $sql.= " ".($this->socid > 0?$this->socid:"null").","; - $sql.= " ".$user->id.","; - $sql.= " ".($this->user_resp_id>0?$this->user_resp_id:'null').","; - $sql.= " ".($this->datec!=''?$this->db->idate($this->datec):'null').","; - $sql.= " ".($this->dateo!=''?$this->db->idate($this->dateo):'null').","; - $sql.= " ".($this->datee!=''?$this->db->idate($this->datee):'null').","; - $sql.= " 0)"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet ("; + $sql.= "ref"; + $sql.= ", title"; + $sql.= ", description"; + $sql.= ", fk_soc"; + $sql.= ", fk_user_creat"; + $sql.= ", datec"; + $sql.= ", dateo"; + $sql.= ", datee"; + $sql.= ") VALUES ("; + $sql.= "'".addslashes($this->ref)."'"; + $sql.= ", '".addslashes($this->title)."'"; + $sql.= ", '".addslashes($this->description)."'"; + $sql.= ", ".($this->socid > 0?$this->socid:"null"); + $sql.= ", ".($this->user_resp_id>0?$this->user_resp_id:'null'); + $sql.= ", ".($this->datec!=''?$this->db->idate($this->datec):'null'); + $sql.= ", ".($this->dateo!=''?$this->db->idate($this->dateo):'null'); + $sql.= ", ".($this->datee!=''?$this->db->idate($this->datee):'null'); + $sql.= ")"; dol_syslog("Project::create sql=".$sql,LOG_DEBUG); $resql=$this->db->query($sql); @@ -116,13 +129,17 @@ class Project extends CommonObject */ function update($user) { + // Clean parameters + $this->title = trim($this->title); + $this->description = trim($this->description); + if (strlen(trim($this->ref)) > 0) { - $sql = "UPDATE ".MAIN_DB_PREFIX."projet"; - $sql.= " SET ref='".$this->ref."'"; - $sql.= ", title = '".$this->title."'"; + $sql = "UPDATE ".MAIN_DB_PREFIX."projet SET"; + $sql.= " ref='".$this->ref."'"; + $sql.= ", title = '".addslashes($this->title)."'"; + $sql.= ", description = '".addslashes($this->description)."'"; $sql.= ", fk_soc = ".($this->socid > 0?$this->socid:"null"); - $sql.= ", fk_user_resp = ".$this->user_resp_id; $sql.= ", fk_statut = ".$this->statut; $sql.= ", datec=".($this->date_c!=''?$this->db->idate($this->date_c):'null'); $sql.= ", dateo=".($this->date_start!=''?$this->db->idate($this->date_start):'null'); @@ -161,7 +178,8 @@ class Project extends CommonObject { if (empty($id) && empty($ref)) return -1; - $sql = "SELECT rowid, ref, title, datec, tms, dateo, datee, fk_soc, fk_user_creat, fk_statut, note"; + $sql = "SELECT rowid, ref, title, description, datec"; + $sql.= ", tms, dateo, datee, fk_soc, fk_user_creat, fk_statut, note_private, note_public"; $sql.= " FROM ".MAIN_DB_PREFIX."projet"; if ($ref) $sql.= " WHERE ref='".$ref."'"; else $sql.= " WHERE rowid=".$id; @@ -178,13 +196,15 @@ class Project extends CommonObject $this->ref = $obj->ref; $this->title = $obj->title; $this->titre = $obj->title; // TODO deprecated + $this->description = $obj->description; $this->date_c = $this->db->jdate($obj->datec); $this->datec = $this->db->jdate($obj->datec); // TODO deprecated $this->date_m = $this->db->jdate($obj->tms); $this->datem = $this->db->jdate($obj->tms); // TODO deprecated $this->date_start = $this->db->jdate($obj->dateo); $this->date_end = $this->db->jdate($obj->datee); - $this->note = $obj->note; + $this->note_private = $obj->note_private; + $this->note_public = $obj->note_public; $this->socid = $obj->fk_soc; $this->societe->id = $obj->fk_soc; // TODO For backward compatibility $this->user_author_id = $obj->fk_user_creat; @@ -218,7 +238,8 @@ class Project extends CommonObject $projects = array(); - $sql = "SELECT rowid, title FROM ".MAIN_DB_PREFIX."projet"; + $sql = "SELECT rowid, title"; + $sql.= " FROM ".MAIN_DB_PREFIX."projet"; $sql.= " WHERE entity = ".$conf->entity; if (! empty($socid)) $sql.= " AND fk_soc = ".$socid; @@ -423,83 +444,6 @@ class Project extends CommonObject } } - /** - * \brief Create a task into project - * \param user Id user that create - * \param title Title of task - * \param parent Id task parent - * \param id_resp Id of responsible user - * \return int Task id if succes, <0 if KO - * @obsolete now use task.class.php - */ - function CreateTask($user, $title, $parent=0, $id_resp=0) - { - $result = 0; - $task_id = -1; - - if (trim($title)) - { - $this->db->begin(); - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task (fk_projet, title, fk_user_creat, fk_task_parent, duration_effective)"; - $sql.= " VALUES (".$this->id.",'".addslashes($title)."', ".$user->id.",".($parent>0?$parent:'0').", 0)"; - - dol_syslog("Project::CreateTask sql=".$sql, LOG_DEBUG); - if ($this->db->query($sql)) - { - $task_id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet_task"); - $result = $task_id; - } - else - { - $this->error=$this->db->lasterror(); - dol_syslog("Project::CreateTask error -1 ".$this->error, LOG_ERR); - $result = -1; - } - - if ($result >= 0) - { - if ($id_resp > 0) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task_actors (fk_projet_task, fk_user)"; - $sql.= " VALUES (".$task_id.",".($id_resp>0?$id_resp:'null').")"; - - dol_syslog("Project::CreateTask sql=".$sql, LOG_DEBUG); - if ($this->db->query($sql) ) - { - $this->db->commit(); - return $task_id; - } - else - { - $this->error=$this->db->lasterror(); - dol_syslog("Project::CreateTask error -3 ".$this->error, LOG_ERR); - $this->db->rollback(); - return -3; - } - } - else - { - $this->db->commit(); - return $task_id; - } - } - else - { - dol_syslog("Project::CreateTask error -2 ".$this->error,LOG_ERR); - $this->db->rollback(); - return -2; - } - } - else - { - dol_syslog("Project::CreateTask error -1 ref null"); - $result = -1; - } - - return $result; - } - /** * \brief Return status label of object * \param mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto diff --git a/htdocs/projet/tasks/task.class.php b/htdocs/projet/tasks/task.class.php index f494fd4094a..8f2dd1191ed 100644 --- a/htdocs/projet/tasks/task.class.php +++ b/htdocs/projet/tasks/task.class.php @@ -82,8 +82,6 @@ class Task extends CommonObject // Clean parameters $this->label = trim($this->label); $this->description = trim($this->description); - $this->note_private = trim($this->note_private); - $this->note_public = trim($this->note_public); // Check parameters // Put here code to add control on parameters values @@ -164,6 +162,8 @@ class Task extends CommonObject $sql.= " t.fk_user_creat,"; $sql.= " t.fk_user_valid,"; $sql.= " t.fk_statut,"; + $sql.= " t.progress,"; + $sql.= " t.priority,"; $sql.= " t.note_private,"; $sql.= " t.note_public"; $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as t"; @@ -190,6 +190,8 @@ class Task extends CommonObject $this->fk_user_creat = $obj->fk_user_creat; $this->fk_user_valid = $obj->fk_user_valid; $this->fk_statut = $obj->fk_statut; + $this->progress = $obj->progress; + $this->priority = $obj->priority; $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; } diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index a576c8b3256..ea9b91a6e59 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -27,6 +27,7 @@ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/html.formother.class.php"); if (!$user->rights->projet->lire) accessforbidden(); @@ -68,124 +69,190 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user- llxHeader("",$langs->trans("Task")); $html = new Form($db); +$formother = new FormOther($db); $projectstatic = new Project($db); if ($_GET["id"] > 0) { - /* - * Fiche projet en mode visu - * - */ $task = new Task($db); + if ($task->fetch($_GET["id"]) >= 0 ) { $projet = new Project($db); $result=$projet->fetch($task->fk_project); if (! empty($projet->socid)) $projet->societe->fetch($projet->socid); - + $head=task_prepare_head($task); - + dol_fiche_head($head, 'task', $langs->trans("Task"),0,'projecttask'); - - if ($mesg) print $mesg.'
'; - - if ($_GET["action"] == 'delete') + + if ($_GET["action"] == 'edit' && $user->rights->projet->creer) { - $ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("DeleteATask"),$langs->trans("ConfirmDeleteATask"),"confirm_delete"); - if ($ret == 'html') print '
'; + print '
'; + print ''; + print ''; + print ''; + + if ($mesg) print $mesg.'
'; + + // Ref + print ''; + print ''; + + // Label + print ''; + + print ''; + + print ''; + + // Date start + print ''; + + // Date end + print ''; + + // Progress + print ''; + + // Description + print ''; + + print '
'; + print $langs->trans("Ref"); + print ''; + print $html->showrefnav($task,'id','',1,'rowid','ref','',''); + print '
'.$langs->trans("Label").''.$task->label.'
'.$langs->trans("Project").''; + print $projet->getNomUrl(1); + print '
'.$langs->trans("Company").''; + if ($projet->societe->id) print $projet->societe->getNomUrl(1); + else print ' '; + print '
'.$langs->trans("DateStart").''; + print dol_print_date($task->date_start,'day'); + print '
'.$langs->trans("DateEnd").''; + print dol_print_date($task->date_end,'day'); + print '
'.$langs->trans("Progress").''; + print $formother->select_percent($task->progress,'progress'); + print '
'.$langs->trans("Description").''; + print nl2br($task->description); + print '
'; + print ''; } - - print '
'; - print ''; - print ''; - print ''; - - // Ref - print ''; - print ''; - - // Label - print ''; - - print ''; - - print ''; - - // Date start - print ''; - - // Date end - print ''; - - // Description - print ''; - - /* List of time spent */ - - $sql = "SELECT t.task_date, t.task_duration, t.fk_user, u.login, u.rowid"; - $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; - $sql .= " , ".MAIN_DB_PREFIX."user as u"; - $sql .= " WHERE t.fk_task =".$task->id; - $sql .= " AND t.fk_user = u.rowid"; - $sql .= " ORDER BY t.task_date DESC"; - - $var=true; - $resql = $db->query($sql); - if ($resql) + else { - $num = $db->num_rows($resql); - $i = 0; - $tasks = array(); - while ($i < $num) + /* + * Fiche tache en mode visu + */ + + if ($_GET["action"] == 'delete') { - $row = $db->fetch_object($resql); - $tasks[$i] = $row; - $i++; + $ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("DeleteATask"),$langs->trans("ConfirmDeleteATask"),"confirm_delete"); + if ($ret == 'html') print '
'; } - $db->free($resql); + + print '
'; - print $langs->trans("Ref"); - print ''; - print $html->showrefnav($task,'id','',1,'rowid','ref','',''); - print '
'.$langs->trans("Label").''.$task->label.'
'.$langs->trans("Project").''; - print $projet->getNomUrl(1); - print '
'.$langs->trans("Company").''; - if ($projet->societe->id) print $projet->societe->getNomUrl(1); - else print ' '; - print '
'.$langs->trans("DateStart").''; - print dol_print_date($task->date_start,'day'); - print '
'.$langs->trans("DateEnd").''; - print dol_print_date($task->date_end,'day'); - print '
'.$langs->trans("Description").''; - print nl2br($task->description); - print '
'; + + // Ref + print ''; + print ''; + + // Label + print ''; + + print ''; + + print ''; + + // Date start + print ''; + + // Date end + print ''; + + // Progress + print ''; + + // Description + print ''; + + /* List of time spent */ + + $sql = "SELECT t.task_date, t.task_duration, t.fk_user, u.login, u.rowid"; + $sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; + $sql.= ", ".MAIN_DB_PREFIX."user as u"; + $sql.= " WHERE t.fk_task =".$task->id; + $sql.= " AND t.fk_user = u.rowid"; + $sql.= " ORDER BY t.task_date DESC"; + + $var=true; + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + $tasks = array(); + while ($i < $num) + { + $row = $db->fetch_object($resql); + $tasks[$i] = $row; + $i++; + } + $db->free($resql); + } + else + { + dol_print_error($db); + } + + print '
'; + print $langs->trans("Ref"); + print ''; + print $html->showrefnav($task,'id','',1,'rowid','ref','',''); + print '
'.$langs->trans("Label").''.$task->label.'
'.$langs->trans("Project").''; + print $projet->getNomUrl(1); + print '
'.$langs->trans("Company").''; + if ($projet->societe->id) print $projet->societe->getNomUrl(1); + else print ' '; + print '
'.$langs->trans("DateStart").''; + print dol_print_date($task->date_start,'day'); + print '
'.$langs->trans("DateEnd").''; + print dol_print_date($task->date_end,'day'); + print '
'.$langs->trans("Progress").''; + print $task->progress.' %'; + print '
'.$langs->trans("Description").''; + print nl2br($task->description); + print '
'; + print ''; + + /* + * Actions + */ + print '
'; + + // Modify + if ($user->rights->projet->creer) + { + print ''.$langs->trans('Modify').''; + } + else + { + print ''.$langs->trans('Modify').''; + } + + // Delete + if ($user->rights->projet->supprimer) + { + print ''.$langs->trans('Delete').''; + } + else + { + print ''.$langs->trans('Delete').''; + } + + print '
'; } - else - { - dol_print_error($db); - } - - print '
'; - print ''; - - - /* - * Actions - */ - print '
'; - - if ($user->rights->projet->supprimer) - { - print ''.$langs->trans('Delete').''; - } - else - { - print ''.$langs->trans('Delete').''; - } - - print '
'; - } }