Minor changes in task management

This commit is contained in:
Laurent Destailleur 2009-01-12 09:53:45 +00:00
parent 811959e763
commit 429dcd3b6a
6 changed files with 78 additions and 17 deletions

View File

@ -60,14 +60,14 @@ class modProjet extends DolibarrModules
$this->special = 0; $this->special = 0;
$this->picto='email'; $this->picto='email';
// D<EFBFBD>pendances // 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

View File

@ -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

View File

@ -6,8 +6,10 @@ ProjectsArea=Espace projet
NewProject=Nouveau projet NewProject=Nouveau projet
AddProject=Créer projet AddProject=Créer projet
DeleteAProject=Supprimer un projet DeleteAProject=Supprimer un projet
OfficerProject=Responsable du projet DeleteATask=Supprimer une tâche
ConfirmDeleteAProject=Êtes-vous sûr de vouloir supprimer ce projet ? ConfirmDeleteAProject=Êtes-vous sûr de vouloir supprimer ce projet ?
ConfirmDeleteATask=Êtes-vous sûr de vouloir supprimer cette tâche ?
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

View File

@ -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>";
} }

View File

@ -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
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
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
* Actions * Actions
*/ */
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$projet->id.'&amp;action=create">'.$langs->trans('AddTask').'</a>';
if ($user->rights->projet->creer)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$projet->id.'&amp;action=create">'.$langs->trans('AddTask').'</a>';
}
print '</div>'; print '</div>';
} }

View File

@ -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();
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)
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)
/* Liste des tâches */ /* Liste des tâches */
$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)
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)
$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>';
} }
} }