Skip to content
Snippets Groups Projects
Commit cf13e466 authored by Regis Houssin's avatar Regis Houssin
Browse files

Works on enhancement of project tasks

parent 5c0d4b89
No related branches found
No related tags found
No related merge requests found
...@@ -86,6 +86,8 @@ if ($_POST["action"] == 'add' && $user->rights->projet->creer) ...@@ -86,6 +86,8 @@ if ($_POST["action"] == 'add' && $user->rights->projet->creer)
$result = $project->create($user); $result = $project->create($user);
if ($result > 0) if ($result > 0)
{ {
$result = $project->add_contact($_POST["officer_project"], 'PROJECTLEADER', 'internal');
Header("Location:fiche.php?id=".$project->id); Header("Location:fiche.php?id=".$project->id);
exit; exit;
} }
......
...@@ -48,9 +48,9 @@ if ($_POST["action"] == 'createtask' && $user->rights->projet->creer) ...@@ -48,9 +48,9 @@ if ($_POST["action"] == 'createtask' && $user->rights->projet->creer)
if (empty($_POST["cancel"])) 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'; $_GET["action"]='create';
$error++; $error++;
} }
...@@ -59,6 +59,7 @@ if ($_POST["action"] == 'createtask' && $user->rights->projet->creer) ...@@ -59,6 +59,7 @@ if ($_POST["action"] == 'createtask' && $user->rights->projet->creer)
{ {
$tmparray=explode('_',$_POST['task_parent']); $tmparray=explode('_',$_POST['task_parent']);
$projectid=$tmparray[0]; $projectid=$tmparray[0];
if (empty($projectid)) $projectid = $_POST["projectid"]; // If projectid is ''
$task_parent=$tmparray[1]; $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 ''
...@@ -90,43 +91,12 @@ if ($_POST["action"] == 'createtask' && $user->rights->projet->creer) ...@@ -90,43 +91,12 @@ if ($_POST["action"] == 'createtask' && $user->rights->projet->creer)
} }
else else
{ {
Header("Location: ".DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$projectid); Header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$taskid);
exit; 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 * View
*/ */
...@@ -157,13 +127,13 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) ...@@ -157,13 +127,13 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">'; print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="createtask">'; print '<input type="hidden" name="action" value="createtask">';
if ($_GET['id']) print '<input type="hidden" name="id" value="'.$_GET['id'].'">'; if ($_GET['id']) print '<input type="hidden" name="projectid" value="'.$_GET['id'].'">';
if ($_GET['mode']) print '<input type="hidden" name="mode" value="'.$_GET['mode'].'">'; if ($_GET['mode']) print '<input type="hidden" name="mode" value="'.$_GET['mode'].'">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td>'.$langs->trans("Label").'</td><td>'; print '<tr><td>'.$langs->trans("Label").'</td><td>';
print '<input type="text" size="25" name="label" class="flat">'; print '<input type="text" size="25" name="label" class="flat" value="'.$_POST["label"].'">';
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("ChildOfTask").'</td><td>'; print '<tr><td>'.$langs->trans("ChildOfTask").'</td><td>';
......
...@@ -67,7 +67,7 @@ $task = new Task($db); ...@@ -67,7 +67,7 @@ $task = new Task($db);
// can have a parent that is not affected to him). // can have a parent that is not affected to him).
$tasksarray=$task->getTasksArray(0, 0, 0, $socid); $tasksarray=$task->getTasksArray(0, 0, 0, $socid);
// We load also tasks limited to a particular user // 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) : ''); $tasksrole=($_REQUEST["mode"]=='mine' ? $task->getTasksRoleForUser($user) : '');
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment