Skip to content
Snippets Groups Projects
Commit 429dcd3b authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Minor changes in task management

parent 811959e7
No related branches found
No related tags found
No related merge requests found
...@@ -60,14 +60,14 @@ class modProjet extends DolibarrModules ...@@ -60,14 +60,14 @@ class modProjet extends DolibarrModules
$this->special = 0; $this->special = 0;
$this->picto='email'; $this->picto='email';
// Dpendances // Dependancies
$this->depends = array(); $this->depends = array();
$this->requiredby = array(); $this->requiredby = array();
// Constantes // Constants
$this->const = array(); $this->const = array();
// Boites // Boxes
$this->boxes = array(); $this->boxes = array();
// Permissions // Permissions
......
...@@ -5,9 +5,11 @@ Myprojects=My projects ...@@ -5,9 +5,11 @@ Myprojects=My projects
ProjectsArea=Projects area ProjectsArea=Projects area
NewProject=New project NewProject=New project
AddProject=Add project AddProject=Add project
DeleteAProject=Supprimer un projet DeleteAProject=Delete a project
OfficerProject=Officer project DeleteATask=Delete a task
ConfirmDeleteAProject=Are you sure you want to delete this project ? ConfirmDeleteAProject=Are you sure you want to delete this project ?
ConfirmDeleteATask=Are you sure you want to delete this task ?
OfficerProject=Officer project
LastProjects=Last %s projects LastProjects=Last %s projects
AllProjects=All projects AllProjects=All projects
ProjectsList=List of projects ProjectsList=List of projects
......
...@@ -6,8 +6,10 @@ ProjectsArea=Espace projet ...@@ -6,8 +6,10 @@ ProjectsArea=Espace projet
NewProject=Nouveau projet NewProject=Nouveau projet
AddProject=Crer projet AddProject=Crer projet
DeleteAProject=Supprimer un projet DeleteAProject=Supprimer un projet
OfficerProject=Responsable du projet DeleteATask=Supprimer une tche
ConfirmDeleteAProject=tes-vous sr de vouloir supprimer ce projet ? ConfirmDeleteAProject=tes-vous sr de vouloir supprimer ce projet ?
ConfirmDeleteATask=tes-vous sr de vouloir supprimer cette tche ?
OfficerProject=Responsable du projet
LastProjects=Les %s derniers projets LastProjects=Les %s derniers projets
AllProjects=Tous les projets AllProjects=Tous les projets
ProjectsList=Liste des projets ProjectsList=Liste des projets
......
...@@ -188,7 +188,7 @@ else ...@@ -188,7 +188,7 @@ else
if ($_GET["action"] == 'delete') if ($_GET["action"] == 'delete')
{ {
$html->form_confirm("fiche.php?id=".$_GET["id"],$langs->trans("DeleteAProject"),$langs->trans("ConfirmDeleteAProject"),"confirm_delete"); $html->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("DeleteAProject"),$langs->trans("ConfirmDeleteAProject"),"confirm_delete");
print "<br>"; print "<br>";
} }
......
...@@ -119,8 +119,7 @@ if ($_GET["id"]) ...@@ -119,8 +119,7 @@ if ($_GET["id"])
if ($_GET["action"] == 'create' && $user->rights->projet->creer) if ($_GET["action"] == 'create' && $user->rights->projet->creer)
{ {
print_titre($langs->trans("NewTask")); print_fiche_titre($langs->trans("NewTask"));
print '<br>';
$tasksarray=$projet->getTasksArray(); $tasksarray=$projet->getTasksArray();
...@@ -171,11 +170,12 @@ else ...@@ -171,11 +170,12 @@ else
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td>'.$projet->ref.'</td></tr>'; print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td>'.$projet->ref.'</td></tr>';
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projet->title.'</td></tr>'; print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projet->title.'</td></tr>';
print '<td>'.$langs->trans("Company").'</td><td>'; print '<td>'.$langs->trans("Company").'</td><td>';
if (! empty($projet->societe->id)) print $projet->societe->getNomUrl(1); if (! empty($projet->societe->id)) print $projet->societe->getNomUrl(1);
else print '&nbsp;'; else print '&nbsp;';
print '</td></tr>'; print '</td>';
//print '<td>&nbsp;</td>';
print '</tr>';
$tasksarray=$projet->getTasksArray(); $tasksarray=$projet->getTasksArray();
...@@ -191,6 +191,7 @@ else ...@@ -191,6 +191,7 @@ else
print '<td>'.$langs->trans("RefTask").'</td>'; print '<td>'.$langs->trans("RefTask").'</td>';
print '<td>'.$langs->trans("LabelTask").'</td>'; print '<td>'.$langs->trans("LabelTask").'</td>';
print '<td align="right">'.$langs->trans("TimeSpent").'</td>'; print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
print "</tr>\n"; print "</tr>\n";
$j=0; $j=0;
PLines($j, 0, $tasksarray, $level, true); PLines($j, 0, $tasksarray, $level, true);
...@@ -205,7 +206,12 @@ else ...@@ -205,7 +206,12 @@ else
* Actions * Actions
*/ */
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($user->rights->projet->creer)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$projet->id.'&amp;action=create">'.$langs->trans('AddTask').'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$projet->id.'&amp;action=create">'.$langs->trans('AddTask').'</a>';
}
print '</div>'; print '</div>';
} }
......
...@@ -29,6 +29,35 @@ require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php"); ...@@ -29,6 +29,35 @@ require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php");
if (!$user->rights->projet->lire) accessforbidden(); if (!$user->rights->projet->lire) accessforbidden();
/*
* Actions
*/
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->projet->creer)
{
$task = new Task($db);
if ($task->fetch($_GET["id"]) >= 0 )
{
$projet = new Project($db);
$result=$projet->fetch($task->fk_projet);
if (! empty($projet->socid))
{
$projet->societe->fetch($projet->socid);
}
if ($task->delete($user) >= 0)
{
Header("Location: index.php");
exit;
}
else
{
$mesg=$task->error;
$_POST["action"]='';
}
}
}
/* /*
* View * View
...@@ -36,6 +65,8 @@ if (!$user->rights->projet->lire) accessforbidden(); ...@@ -36,6 +65,8 @@ if (!$user->rights->projet->lire) accessforbidden();
llxHeader("",$langs->trans("Task")); llxHeader("",$langs->trans("Task"));
$html = new Form($db);
$projectstatic = new Project($db); $projectstatic = new Project($db);
...@@ -63,6 +94,12 @@ if ($_GET["id"] > 0) ...@@ -63,6 +94,12 @@ if ($_GET["id"] > 0)
dolibarr_fiche_head($head, 'tasks', $langs->trans("Tasks")); dolibarr_fiche_head($head, 'tasks', $langs->trans("Tasks"));
if ($_GET["action"] == 'delete')
{
$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("DeleteATask"),$langs->trans("ConfirmDeleteATask"),"confirm_delete");
print "<br>";
}
print '<form method="POST" action="fiche.php?id='.$projet->id.'">'; print '<form method="POST" action="fiche.php?id='.$projet->id.'">';
print '<input type="hidden" name="action" value="createtask">'; print '<input type="hidden" name="action" value="createtask">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
...@@ -78,7 +115,7 @@ if ($_GET["id"] > 0) ...@@ -78,7 +115,7 @@ if ($_GET["id"] > 0)
/* Liste des tches */ /* Liste des tches */
$sql = "SELECT t.task_date, t.task_duration, t.fk_user, u.login"; $sql = "SELECT t.task_date, t.task_duration, t.fk_user, u.login, u.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t";
$sql .= " , ".MAIN_DB_PREFIX."user as u"; $sql .= " , ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE t.fk_task =".$task->id; $sql .= " WHERE t.fk_task =".$task->id;
...@@ -113,8 +150,8 @@ if ($_GET["id"] > 0) ...@@ -113,8 +150,8 @@ if ($_GET["id"] > 0)
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Date").'</td>'; print '<td>'.$langs->trans("Date").'</td>';
print '<td>'.$langs->trans("TimeSpent").'</td>'; print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
print '<td colspan="2">'.$langs->trans("User").'</td>'; print '<td align="right">'.$langs->trans("User").'</td>';
print "</tr>\n"; print "</tr>\n";
foreach ($tasks as $task_time) foreach ($tasks as $task_time)
...@@ -122,13 +159,27 @@ if ($_GET["id"] > 0) ...@@ -122,13 +159,27 @@ if ($_GET["id"] > 0)
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print '<td>'.dolibarr_print_date($task_time[0],'day').'</td>'; print '<td>'.dolibarr_print_date($task_time[0],'day').'</td>';
print '<td>'.$task_time[1].'</td>'; print '<td align="right">'.$task_time[1].'</td>';
print '<td>'.$task_time[3].'</td>'; $user->id=$task_time[4];
$user->nom=$task_time[3];
print '<td align="right">'.$user->getNomUrl(1).'</td>';
print "</tr>\n"; print "</tr>\n";
} }
print "</table>"; print "</table>";
print '</div>'; print '</div>';
/*
* Actions
*/
print '<div class="tabsAction">';
if ($user->rights->projet->creer)
{
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$task->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>';
}
print '</div>';
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment