diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index ea9b91a6e59..14cc2cf29a4 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -29,12 +29,47 @@ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php"); require_once(DOL_DOCUMENT_ROOT."/html.formother.class.php"); +$taskid = (isset($_GET["id"])?$_GET["id"]:(isset($_POST["id"])?$_POST["id"]:'')); +$taskref = (isset($_GET["ref"])?$_GET["ref"]:''); + if (!$user->rights->projet->lire) accessforbidden(); /* * Actions */ +if ($_POST["action"] == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer) +{ + $error=0; + + if (empty($_POST["label"])) + { + $error++; + $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")).'
'; + } + if (! $error) + { + $task = new Task($db); + $task->fetch($_POST["id"]); + + $task->label = $_POST["label"]; + $task->description = $_POST['description']; + //$task->fk_task_parent = $task_parent; + $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']; + + $result=$task->update($user); + + $taskid=$task->id; // On retourne sur la fiche tache + } + else + { + $taskid=$_POST["id"]; + $_GET['action']='edit'; + } +} + if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->projet->creer) { $task = new Task($db); @@ -74,11 +109,11 @@ $formother = new FormOther($db); $projectstatic = new Project($db); -if ($_GET["id"] > 0) +if ($taskid) { $task = new Task($db); - if ($task->fetch($_GET["id"]) >= 0 ) + if ($task->fetch($taskid) >= 0 ) { $projet = new Project($db); $result=$projet->fetch($task->fk_project); @@ -90,23 +125,22 @@ if ($_GET["id"] > 0) if ($_GET["action"] == 'edit' && $user->rights->projet->creer) { - print '
'; + print ''; print ''; - print ''; + print ''; + print ''; + print ''; if ($mesg) print $mesg.'
'; // Ref - print ''; - print ''; + print ''; + print ''; // Label - print ''; + print ''; + print ''; print ''; // Date start - print ''; // Date end - print ''; // Progress @@ -133,12 +167,16 @@ if ($_GET["id"] > 0) print ''; // Description - print ''; + print ''; - print '
'; - print $langs->trans("Ref"); - print ''; - print $html->showrefnav($task,'id','',1,'rowid','ref','',''); - print '
'.$langs->trans("Ref").''.$task->ref.'
'.$langs->trans("Label").''.$task->label.'
'.$langs->trans("Label").'
'.$langs->trans("Project").''; print $projet->getNomUrl(1); @@ -118,13 +152,13 @@ if ($_GET["id"] > 0) print '
'.$langs->trans("DateStart").''; - print dol_print_date($task->date_start,'day'); + print '
'.$langs->trans("DateStart").''; + print $html->select_date($task->date_start,'dateo'); print '
'.$langs->trans("DateEnd").''; - print dol_print_date($task->date_end,'day'); + print '
'.$langs->trans("DateEnd").''; + print $html->select_date($task->date_end?$task->date_end:-1,'datee'); print '
'.$langs->trans("Description").''; - print nl2br($task->description); + print '
'.$langs->trans("Description").''; + print ''; print '
'; - print ''; + print ''; + print '   '; + print ''; + print ''; + print ''; } else {