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

Works on enhancement of project tasks

parent cf13e466
No related branches found
No related tags found
No related merge requests found
<?php <?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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"); ...@@ -32,7 +32,7 @@ require_once(DOL_DOCUMENT_ROOT."/projet/tasks/task.class.php");
require_once(DOL_DOCUMENT_ROOT."/html.formother.class.php"); require_once(DOL_DOCUMENT_ROOT."/html.formother.class.php");
$projectid=''; $projectid='';
$projectid=isset($_REQUEST["id"])?$_REQUEST["id"]:$_POST["projectid"]; $projectid=isset($_REQUEST["id"])?$_REQUEST["id"]:$_POST["id"];
// Security check // Security check
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
...@@ -59,7 +59,7 @@ if ($_POST["action"] == 'createtask' && $user->rights->projet->creer) ...@@ -59,7 +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 '' if (empty($projectid)) $projectid = $_POST["id"]; // 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 ''
...@@ -72,13 +72,15 @@ if ($_POST["action"] == 'createtask' && $user->rights->projet->creer) ...@@ -72,13 +72,15 @@ if ($_POST["action"] == 'createtask' && $user->rights->projet->creer)
$task->date_c = dol_now('tzserver'); $task->date_c = dol_now('tzserver');
$task->date_start = dol_mktime(12,0,0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear']); $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->date_end = dol_mktime(12,0,0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear']);
$task->progress = $_POST['progress'];
$taskid = $task->create($user); $taskid = $task->create($user);
if ($taskid > 0) if ($taskid > 0)
{ {
$task->update($user); $task->update($user);
}
$result = $task->add_contact($_POST["userid"], 'TASKEXECUTIVE', 'internal');
} }
} }
...@@ -96,13 +98,14 @@ if ($_POST["action"] == 'createtask' && $user->rights->projet->creer) ...@@ -96,13 +98,14 @@ if ($_POST["action"] == 'createtask' && $user->rights->projet->creer)
} }
} }
} }
}
/* /*
* View * View
*/ */
$form=new Form($db); $form=new Form($db);
$htmlother=new FormOther($db); $formother=new FormOther($db);
$help_url="EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos"; $help_url="EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
llxHeader("",$langs->trans("Tasks"),$help_url); llxHeader("",$langs->trans("Tasks"),$help_url);
...@@ -127,7 +130,7 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) ...@@ -127,7 +130,7 @@ 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="projectid" value="'.$_GET['id'].'">'; if ($_GET['id']) print '<input type="hidden" name="id" 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%">';
...@@ -137,7 +140,7 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) ...@@ -137,7 +140,7 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("ChildOfTask").'</td><td>'; print '<tr><td>'.$langs->trans("ChildOfTask").'</td><td>';
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 '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("AffectedTo").'</td><td>'; print '<tr><td>'.$langs->trans("AffectedTo").'</td><td>';
...@@ -154,6 +157,11 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) ...@@ -154,6 +157,11 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
print $form->select_date(-1,'datee'); print $form->select_date(-1,'datee');
print '</td></tr>'; print '</td></tr>';
// Progress
print '<tr><td>'.$langs->trans("Progress").'</td><td colspan="3">';
print $formother->select_percent($task->progress,'progress');
print '</td></tr>';
// Description // Description
print '<tr><td valign="top">'.$langs->trans("Description").'</td>'; print '<tr><td valign="top">'.$langs->trans("Description").'</td>';
print '<td>'; print '<td>';
......
...@@ -49,6 +49,8 @@ class Task extends CommonObject ...@@ -49,6 +49,8 @@ class Task extends CommonObject
var $date_c; var $date_c;
var $date_start; var $date_start;
var $date_end; var $date_end;
var $progress;
var $priority;
var $fk_user_creat; var $fk_user_creat;
var $fk_user_valid; var $fk_user_valid;
var $statut; var $statut;
...@@ -238,7 +240,8 @@ class Task extends CommonObject ...@@ -238,7 +240,8 @@ class Task extends CommonObject
$sql.= " description=".(isset($this->description)?"'".addslashes($this->description)."'":"null").","; $sql.= " description=".(isset($this->description)?"'".addslashes($this->description)."'":"null").",";
$sql.= " duration_effective=".(isset($this->duration_effective)?$this->duration_effective:"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.= " 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; $sql.= " WHERE rowid=".$this->id;
$this->db->begin(); $this->db->begin();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment