diff --git a/htdocs/projet/tasks/fiche.php b/htdocs/projet/tasks/fiche.php index 701ddd43c44..109be4cd16f 100644 --- a/htdocs/projet/tasks/fiche.php +++ b/htdocs/projet/tasks/fiche.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin + * 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 @@ -32,7 +32,7 @@ require_once(DOL_DOCUMENT_ROOT."/projet/tasks/task.class.php"); require_once(DOL_DOCUMENT_ROOT."/html.formother.class.php"); $projectid=''; -$projectid=isset($_REQUEST["id"])?$_REQUEST["id"]:$_POST["projectid"]; +$projectid=isset($_REQUEST["id"])?$_REQUEST["id"]:$_POST["id"]; // Security check if ($user->societe_id) $socid=$user->societe_id; @@ -59,7 +59,7 @@ if ($_POST["action"] == 'createtask' && $user->rights->projet->creer) { $tmparray=explode('_',$_POST['task_parent']); $projectid=$tmparray[0]; - if (empty($projectid)) $projectid = $_POST["projectid"]; // If projectid is '' + if (empty($projectid)) $projectid = $_POST["id"]; // If projectid is '' $task_parent=$tmparray[1]; if (empty($task_parent)) $task_parent = 0; // If task_parent is '' @@ -72,27 +72,30 @@ if ($_POST["action"] == 'createtask' && $user->rights->projet->creer) $task->date_c = dol_now('tzserver'); $task->date_start = dol_mktime(12,0,0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear']); $task->date_end = dol_mktime(12,0,0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear']); + $task->progress = $_POST['progress']; $taskid = $task->create($user); if ($taskid > 0) { $task->update($user); + + $result = $task->add_contact($_POST["userid"], 'TASKEXECUTIVE', 'internal'); } } - } - - if (! $error) - { - if (empty($projectid)) + + if (! $error) { - Header("Location: ".DOL_URL_ROOT.'/projet/tasks/index.php'.(empty($_REQUEST["mode"])?'':'?mode='.$_REQUEST["mode"])); - exit; - } - else - { - Header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$taskid); - exit; + if (empty($projectid)) + { + Header("Location: ".DOL_URL_ROOT.'/projet/tasks/index.php'.(empty($_REQUEST["mode"])?'':'?mode='.$_REQUEST["mode"])); + exit; + } + else + { + Header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$taskid); + exit; + } } } } @@ -102,7 +105,7 @@ if ($_POST["action"] == 'createtask' && $user->rights->projet->creer) */ $form=new Form($db); -$htmlother=new FormOther($db); +$formother=new FormOther($db); $help_url="EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; llxHeader("",$langs->trans("Tasks"),$help_url); @@ -127,7 +130,7 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) print '
'; print ''; print ''; - if ($_GET['id']) print ''; + if ($_GET['id']) print ''; if ($_GET['mode']) print ''; print ''; @@ -137,7 +140,7 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) print ''; print ''; print ''; + // Progress + print ''; + // Description print ''; print '
'.$langs->trans("ChildOfTask").''; - print $htmlother->selectProjectTasks($projectid, 'task_parent', $user->admin?0:1, 0, 1); + print $formother->selectProjectTasks($projectid, 'task_parent', $user->admin?0:1, 0, 1); print '
'.$langs->trans("AffectedTo").''; @@ -154,6 +157,11 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) print $form->select_date(-1,'datee'); print '
'.$langs->trans("Progress").''; + print $formother->select_percent($task->progress,'progress'); + print '
'.$langs->trans("Description").''; diff --git a/htdocs/projet/tasks/task.class.php b/htdocs/projet/tasks/task.class.php index 8f2dd1191ed..5dda1ec81e6 100644 --- a/htdocs/projet/tasks/task.class.php +++ b/htdocs/projet/tasks/task.class.php @@ -49,6 +49,8 @@ class Task extends CommonObject var $date_c; var $date_start; var $date_end; + var $progress; + var $priority; var $fk_user_creat; var $fk_user_valid; var $statut; @@ -238,7 +240,8 @@ class Task extends CommonObject $sql.= " description=".(isset($this->description)?"'".addslashes($this->description)."'":"null").","; $sql.= " duration_effective=".(isset($this->duration_effective)?$this->duration_effective:"null").","; $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.= " datee=".($this->date_end!=''?$this->db->idate($this->date_end):'null').","; + $sql.= " progress=".$this->progress; $sql.= " WHERE rowid=".$this->id; $this->db->begin();