diff --git a/htdocs/project.class.php b/htdocs/project.class.php index 24220c2a3a0..4d147002962 100644 --- a/htdocs/project.class.php +++ b/htdocs/project.class.php @@ -280,9 +280,10 @@ class Project extends CommonObject $result = 0; if (trim($title)) { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task (fk_projet, title, fk_user_creat, fk_task_parent) "; - $sql .= " VALUES (".$this->id.",'$title', ".$user->id.",".$parent.") ;"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task (fk_projet, title, fk_user_creat, fk_task_parent, duration_effective)"; + $sql.= " VALUES (".$this->id.",'$title', ".$user->id.",".$parent.", 0)"; + dolibarr_syslog("Project::CreateTask sql=".$sql,LOG_DEBUG); if ($this->db->query($sql) ) { $task_id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet_task"); @@ -290,26 +291,25 @@ class Project extends CommonObject } else { - dolibarr_syslog("Project::CreateTask error -2",LOG_ERR); - dolibarr_syslog($this->db->error(),LOG_ERR); $this->error=$this->db->error(); + dolibarr_syslog("Project::CreateTask error -2 ".$this->error,LOG_ERR); $result = -2; } if ($result == 0) { + $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task_actors (fk_projet_task, fk_user)"; + $sql.= " VALUES (".$task_id.",".$user->id.")"; - $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task_actors (fk_projet_task, fk_user) "; - $sql .= " VALUES (".$task_id.",".$user->id.") ;"; - + dolibarr_syslog("Project::CreateTask sql=".$sql,LOG_DEBUG); if ($this->db->query($sql) ) { $result = 0; } else { - dolibarr_syslog("Project::CreateTask error -3",LOG_ERR); $this->error=$this->db->error(); + dolibarr_syslog("Project::CreateTask error -3 ".$this->error,LOG_ERR); $result = -2; } } diff --git a/htdocs/projet/tasks/fiche.php b/htdocs/projet/tasks/fiche.php index d3b71e05e93..23e8907556b 100644 --- a/htdocs/projet/tasks/fiche.php +++ b/htdocs/projet/tasks/fiche.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2006 Laurent Destailleur + * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2007 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -19,11 +19,11 @@ */ /** - \file htdocs/projet/tasks/fiche.php - \ingroup projet - \brief Fiche taches d'un projet - \version $Id$ -*/ + \file htdocs/projet/tasks/fiche.php + \ingroup projet + \brief Fiche taches d'un projet + \version $Id$ + */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php"); @@ -46,6 +46,8 @@ Function PLines(&$inc, $parent, $lines, &$level, $tasksrole) $form = new Form($db); // $db est null ici mais inutile pour la fonction select_date() global $user, $bc, $langs; + $var=true; + for ($i = 0 ; $i < sizeof($lines) ; $i++) { if ($parent == 0) @@ -68,16 +70,18 @@ Function PLines(&$inc, $parent, $lines, &$level, $tasksrole) print ''.$lines[$i]->title."\n"; $heure = intval($lines[$i]->duration); - $minutes = (($lines[$i]->duration - $heure) * 60); + $minutes = round((($lines[$i]->duration - $heure) * 60),0); $minutes = substr("00"."$minutes", -2); print ''.$heure." h ".$minutes."\n"; if ($tasksrole[$lines[$i]->id] == 'admin') { - print ''; - print ' '; - print "\n"; + print ''; + print ''; + print ' '; + print ''; + print ""; print $form->select_date('',$lines[$i]->id,'','','',"addtime"); print ''; } @@ -128,44 +132,47 @@ Function PLineSelect(&$inc, $parent, $lines, &$level) if ($_POST["action"] == 'createtask' && $user->rights->projet->creer) { - $project = new Project($db); + $project = new Project($db); - $result = $project->fetch($_GET["id"]); - - if ($result == 0) - { - $task_parent = $_POST["task_parent"]?$_POST["task_parent"]:0; - $project->CreateTask($user, $_POST["task_name"], $task_parent); + $result = $project->fetch($_GET["id"]); - Header("Location:fiche.php?id=".$project->id); - } + if ($result == 0) + { + $task_parent = $_POST["task_parent"]?$_POST["task_parent"]:0; + $project->CreateTask($user, $_POST["task_name"], $task_parent); + + Header("Location:fiche.php?id=".$project->id); + } } if ($_POST["action"] == 'addtime' && $user->rights->projet->creer) { - $project = new Project($db); - $result = $project->fetch($_GET["id"]); - - if ($result == 0) - { - foreach ($_POST as $key => $post) - { - //$pro->CreateTask($user, $_POST["task_name"]); - if (substr($key,0,4) == 'task') - { - if ($post > 0) - { - $id = ereg_replace("task","",$key); + $project = new Project($db); + $result = $project->fetch($_GET["id"]); - $date = mktime(12,12,12,$_POST["$id"."month"],$_POST["$id"."day"],$_POST["$id"."year"]); - $project->TaskAddTime($user, $id , $post, $date); + if ($result == 0) + { + foreach ($_POST as $key => $post) + { + //$pro->CreateTask($user, $_POST["task_name"]); + if (substr($key,0,4) == 'task') + { + if ($post > 0) + { + $post=intval($post)+(($post-intval($post))*(1+2/3)); + $post=price2num($post); + + $id = ereg_replace("task","",$key); + + $date = dolibarr_mktime(12,0,0,$_POST["$id"."month"],$_POST["$id"."day"],$_POST["$id"."year"]); + $project->TaskAddTime($user, $id , $post, $date); + } + } } - } + + Header("Location:fiche.php?id=".$project->id); + exit; } - - Header("Location:fiche.php?id=".$project->id); - exit; - } } @@ -175,36 +182,36 @@ llxHeader("",$langs->trans("Tasks"),"Tasks"); if ($_GET["action"] == 'create' && $user->rights->projet->creer) { - print_titre($langs->trans("NewTask")); + print_titre($langs->trans("NewTask")); - if ($mesg) print $mesg; - - print '
'; + if ($mesg) print $mesg; - print ''; - print ''; + print ''; - print ''; - print ''; + print '
'.$langs->trans("Ref").'
'.$langs->trans("Label").'
'; + print ''; - print ''; + print ''; + print ''; - print ''; + print ''; - print ''; - print '
'.$langs->trans("Company").''; - $societe = new Societe($db); - $societe->fetch($_GET["socid"]); - print $societe->getNomUrl(1); - print '
'.$langs->trans("Ref").'
'.$langs->trans("Label").'
'.$langs->trans("Author").''.$user->fullname.'
'.$langs->trans("Company").''; + $societe = new Societe($db); + $societe->fetch($_GET["socid"]); + print $societe->getNomUrl(1); + print '
'; - print '
'; + print ''.$langs->trans("Author").''.$user->fullname.''; + + print ''; + print ''; + print ''; } else { /* - * Fiche projet en mode visu - * - */ + * Fiche projet en mode visu + * + */ $projet = new Project($db); $projet->fetch($_GET["id"]); @@ -226,8 +233,8 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) $tasksrole=$projet->getTasksRoleForUser($user); $tasksarray=$projet->getTasksArray(); - - /* Nouvelle t�che */ + + /* Nouvelle tache */ print ''.$langs->trans("NewTask").''; print ' '; if ($tasksarray) @@ -240,7 +247,7 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) print ' '; print ''; - print '
'; + print '
'; print '
'; print ''; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index e713161d151..cd0b14f0abd 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -15,16 +15,13 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ */ /** \file htdocs/projet/tasks/task.php \ingroup projet \brief Fiche tâches d'un projet - \version $Revision$ + \version $Id$ */ require("./pre.inc.php"); @@ -32,6 +29,9 @@ require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php"); if (!$user->rights->projet->lire) accessforbidden(); +/* + * View + */ llxHeader("",$langs->trans("Task")); @@ -110,7 +110,8 @@ if ($_GET["id"] > 0) foreach ($tasks as $task_time) { - print ""; + $var=!$var; + print ""; print ''.dolibarr_print_date($task_time[0]).''; print ''.$task_time[1].''; print ''.$task_time[3].'';