From cf13e466c584c5b3de64fd701575d1d6545a9cbe Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 28 Jan 2010 14:52:45 +0000 Subject: [PATCH] Works on enhancement of project tasks --- htdocs/projet/fiche.php | 2 ++ htdocs/projet/tasks/fiche.php | 46 ++++++----------------------------- htdocs/projet/tasks/index.php | 2 +- 3 files changed, 11 insertions(+), 39 deletions(-) diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php index 0b8aedaff8f..c336045cc28 100644 --- a/htdocs/projet/fiche.php +++ b/htdocs/projet/fiche.php @@ -86,6 +86,8 @@ if ($_POST["action"] == 'add' && $user->rights->projet->creer) $result = $project->create($user); if ($result > 0) { + $result = $project->add_contact($_POST["officer_project"], 'PROJECTLEADER', 'internal'); + Header("Location:fiche.php?id=".$project->id); exit; } diff --git a/htdocs/projet/tasks/fiche.php b/htdocs/projet/tasks/fiche.php index 67faf57fea9..701ddd43c44 100644 --- a/htdocs/projet/tasks/fiche.php +++ b/htdocs/projet/tasks/fiche.php @@ -48,9 +48,9 @@ if ($_POST["action"] == 'createtask' && $user->rights->projet->creer) if (empty($_POST["cancel"])) { - if (empty($_POST['task_parent'])) + if (empty($_POST['label'])) { - $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("ChildOfTask")); + $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")); $_GET["action"]='create'; $error++; } @@ -59,11 +59,12 @@ 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 '' $task_parent=$tmparray[1]; - if (empty($task_parent)) $task_parent=0; // If task_parent is '' + if (empty($task_parent)) $task_parent = 0; // If task_parent is '' $task = new Task($db); - + $task->fk_project = $projectid; $task->label = $_POST["label"]; $task->description = $_POST['description']; @@ -90,43 +91,12 @@ if ($_POST["action"] == 'createtask' && $user->rights->projet->creer) } else { - Header("Location: ".DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$projectid); + Header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$taskid); exit; } } } -if ($_POST["action"] == 'addtime' && $user->rights->projet->creer) -{ - $task = new Task($db); - $result = $task->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) - { - $post=intval($post)+(($post-intval($post))*(1+2/3)); - $post=price2num($post); - - $id = str_replace("task","",$key); - - $date = dol_mktime(12,0,0,$_POST["$id"."month"],$_POST["$id"."day"],$_POST["$id"."year"]); - $task->addTimeSpent($user, $post, $date); - } - } - } - - Header("Location:fiche.php?id=".$task->id); - exit; - } -} - - /* * View */ @@ -157,13 +127,13 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) print '
'; print ''; print ''; - if ($_GET['id']) print ''; + if ($_GET['id']) print ''; if ($_GET['mode']) print ''; print ''; print ''; print '
'.$langs->trans("Label").''; - print ''; + print ''; print '
'.$langs->trans("ChildOfTask").''; diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php index 86963f358ad..ddbcf665e9e 100644 --- a/htdocs/projet/tasks/index.php +++ b/htdocs/projet/tasks/index.php @@ -67,7 +67,7 @@ $task = new Task($db); // can have a parent that is not affected to him). $tasksarray=$task->getTasksArray(0, 0, 0, $socid); // We load also tasks limited to a particular user -$tasksrole = $task->getTasksRoleForUser($user); var_dump($tasksrole); +$tasksrole = $task->getTasksRoleForUser($user); $tasksrole=($_REQUEST["mode"]=='mine' ? $task->getTasksRoleForUser($user) : ''); print '';