diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index d70719c4d4f..ab4ded9f296 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -2965,7 +2965,7 @@ function print_fiche_titre($title, $mesg='', $picto='title_generic.png', $pictoi
* @param int $pictoisfullpath 1=Icon name is a full absolute url of image
* @param int $id To force an id on html objects
* @return string
- * @see print_barre_list
+ * @see print_barre_liste
*/
function load_fiche_titre($titre, $mesg='', $picto='title_generic.png', $pictoisfullpath=0, $id=0)
{
diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php
index 3d4c0594208..92229a72d23 100644
--- a/htdocs/core/lib/project.lib.php
+++ b/htdocs/core/lib/project.lib.php
@@ -260,9 +260,10 @@ function project_admin_prepare_head()
* @param int $taskrole Array of roles of user for each tasks
* @param int $projectsListId List of id of project allowed to user (string separated with comma)
* @param int $addordertick Add a tick to move task
+ * @param int $projectidfortotallink 0 or Id of project to use on total line (link to see all time consumed for project)
* @return void
*/
-function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId='', $addordertick=0)
+function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId='', $addordertick=0, $projectidfortotallink=0)
{
global $user, $bc, $langs;
global $projectstatic, $taskstatic;
@@ -492,7 +493,9 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
print convertSecondToTime($total_projectlinesa_planned, 'allhourmin');
print '';
print '
';
+ if ($projectidfortotallink > 0) print '';
print convertSecondToTime($total_projectlinesa_spent, 'allhourmin');
+ if ($projectidfortotallink > 0) print '';
print ' | ';
print '';
if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned,2).' %';
diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang
index 0e4dfe82b9c..5470374b5e4 100644
--- a/htdocs/langs/en_US/projects.lang
+++ b/htdocs/langs/en_US/projects.lang
@@ -74,6 +74,9 @@ Progress=Progress
ProgressDeclared=Declared progress
ProgressCalculated=Calculated progress
Time=Time
+ListOfTasks=List of tasks
+GoToListOfTimeConsumed=Go to list of time consumed
+GoToListOfTasks=Go to list of tasks
ListProposalsAssociatedProject=List of the commercial proposals associated with the project
ListOrdersAssociatedProject=List of customer's orders associated with the project
ListInvoicesAssociatedProject=List of customer's invoices associated with the project
diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php
index 4abb9122eb2..434b8e79886 100644
--- a/htdocs/projet/tasks.php
+++ b/htdocs/projet/tasks.php
@@ -207,7 +207,7 @@ if ($id > 0 || ! empty($ref))
print '';
$linkback = ''.$langs->trans("BackToList").'';
-
+
// Ref
print '';
print $langs->trans("Ref");
@@ -391,25 +391,12 @@ else if ($id > 0 || ! empty($ref))
print '';
- print ' ';
-
-
- // Link to switch in "my task" / "all task"
- print '';
+ $title=$langs->trans("ListOfTasks");
+ $linktotasks=''.$langs->trans("GoToListOfTimeConsumed").'';
+ //print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $linktotasks, $num, $totalnboflines, 'title_generic.png', 0, '', '', 0, 1);
+ print load_fiche_titre($title,$linktotasks,'title_generic.png');
+
// Get list of tasks in tasksarray and taskarrayfiltered
// We need all tasks (even not limited to a user because a task to user can have a parent that is not affected to him).
$tasksarray=$taskstatic->getTasksArray(0, 0, $object->id, $socid, 0);
@@ -436,11 +423,24 @@ else if ($id > 0 || ! empty($ref))
print ' | '.$langs->trans("ProgressDeclared").' | ';
print ' | ';
print " \n";
+
if (count($tasksarray) > 0)
{
- // Show all lines in taskarray (recursive function to go down on tree)
+ // Link to switch in "my task" / "all task"
+ print '| ';
+ if ($mode == 'mine')
+ {
+ print 'id.'">'.$langs->trans("DoNotShowMyTasksOnly").'';
+ }
+ else
+ {
+ print 'id.'&mode=mine">'.$langs->trans("ShowMyTasksOnly").'';
+ }
+ print ' | ';
+
+ // Show all lines in taskarray (recursive function to go down on tree)
$j=0; $level=0;
- $nboftaskshown=projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, $id, 1);
+ $nboftaskshown=projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, $object->id, 1, $object->id);
}
else
{
diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php
index 3804715cb7c..1a3b1921713 100644
--- a/htdocs/projet/tasks/task.php
+++ b/htdocs/projet/tasks/task.php
@@ -220,6 +220,8 @@ if ($id > 0 || ! empty($ref))
print '';
+ $linkback = ''.$langs->trans("BackToList").'';
+
// Ref
print '| ';
print $langs->trans("Ref");
@@ -230,7 +232,7 @@ if ($id > 0 || ! empty($ref))
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0);
$projectstatic->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")";
}
- print $form->showrefnav($projectstatic,'project_ref','',1,'ref','ref','',$param.'&withproject=1');
+ print $form->showrefnav($projectstatic,'project_ref',$linkback,1,'ref','ref','',$param.'&withproject=1');
print ' | ';
print '| '.$langs->trans("Label").' | '.$projectstatic->title.' | ';
diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index 5ed3655615e..976e0013431 100644
--- a/htdocs/projet/tasks/time.php
+++ b/htdocs/projet/tasks/time.php
@@ -194,7 +194,16 @@ if (! empty($project_ref) && ! empty($withproject))
}
}
+// To show all time lines for project
+$projectidforalltimes=0;
+if (GETPOST('projectid'))
+{
+ $projectidforalltimes=GETPOST('projectid','int');
+
+}
+
+
/*
* View
*/
@@ -205,20 +214,28 @@ $form = new Form($db);
$formother = new FormOther($db);
$userstatic = new User($db);
-if ($id > 0 || ! empty($ref))
+if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
{
/*
* Fiche projet en mode visu
*/
- if ($object->fetch($id, $ref) >= 0)
+ if ($projectidforalltimes)
+ {
+ $result=$projectstatic->fetch($projectidforalltimes);
+ if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
+ }
+ elseif ($object->fetch($id, $ref) >= 0)
{
$result=$projectstatic->fetch($object->fk_project);
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
$object->project = clone $projectstatic;
+ }
+
+ $userWrite = $projectstatic->restrictedProjectArea($user,'write');
- $userWrite = $projectstatic->restrictedProjectArea($user,'write');
-
+ if ($projectstatic->id > 0)
+ {
if ($withproject)
{
// Tabs for project
@@ -230,6 +247,8 @@ if ($id > 0 || ! empty($ref))
print '';
+ $linkback = ''.$langs->trans("BackToList").'';
+
// Ref
print '| ';
print $langs->trans("Ref");
@@ -240,7 +259,7 @@ if ($id > 0 || ! empty($ref))
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0);
$projectstatic->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")";
}
- print $form->showrefnav($projectstatic,'project_ref','',1,'ref','ref','',$param.'&withproject=1');
+ print $form->showrefnav($projectstatic,'project_ref',$linkback,1,'ref','ref','',$param.'&withproject=1');
print ' | ';
// Label
@@ -275,8 +294,35 @@ if ($id > 0 || ! empty($ref))
print ' ';
dol_fiche_end();
+
+
+ /*
+ * Actions
+ */
+ print '';
}
-
+ }
+
+ if (empty($projectidforalltimes))
+ {
$head=task_prepare_head($object);
dol_fiche_head($head, 'task_time', $langs->trans("Task"),0,'projecttask');
@@ -423,21 +469,24 @@ if ($id > 0 || ! empty($ref))
print '';
print ' ';
+
+ print ' ';
}
-
- print ' ';
-
+ }
+
+ if ($projectstatic->id > 0)
+ {
/*
* List of time spent
*/
$tasks = array();
- $sql = "SELECT t.rowid, t.task_date, t.task_datehour, t.task_date_withhour, t.task_duration, t.fk_user, t.note, t.thm";
+ $sql = "SELECT t.rowid, t.fk_task, t.task_date, t.task_datehour, t.task_date_withhour, t.task_duration, t.fk_user, t.note, t.thm";
$sql.= ", u.lastname, u.firstname";
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t";
$sql .= " , ".MAIN_DB_PREFIX."user as u";
- $sql .= " WHERE t.fk_task =".$object->id;
- $sql .= " AND t.fk_user = u.rowid";
+ $sql .= " WHERE t.fk_user = u.rowid";
+ if (empty($projectidforalltimes)) $sql .= " AND t.fk_task =".$object->id;
$sql .= " ORDER BY t.task_date DESC, t.task_datehour DESC, t.rowid DESC";
$var=true;
@@ -445,6 +494,16 @@ if ($id > 0 || ! empty($ref))
if ($resql)
{
$num = $db->num_rows($resql);
+ $totalnboflines=$num;
+
+ if (! empty($projectidforalltimes))
+ {
+ $title=$langs->trans("ListTaskTimeUserProject");
+ $linktotasks=''.$langs->trans("GoToListOfTasks").'';
+ //print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $linktotasks, $num, $totalnboflines, 'title_generic.png', 0, '', '', 0, 1);
+ print load_fiche_titre($title,$linktotasks,'title_generic.png');
+ }
+
$i = 0;
while ($i < $num)
{
@@ -569,12 +628,12 @@ if ($id > 0 || ! empty($ref))
else if ($user->rights->projet->creer)
{
print ' ';
- print 'id.'&action=editline&lineid='.$task_time->rowid.($withproject?'&withproject=1':'').'">';
+ print 'fk_task.'&action=editline&lineid='.$task_time->rowid.($withproject?'&withproject=1':'').'">';
print img_edit();
print '';
print ' ';
- print 'id.'&action=deleteline&lineid='.$task_time->rowid.($withproject?'&withproject=1':'').'">';
+ print 'fk_task.'&action=deleteline&lineid='.$task_time->rowid.($withproject?'&withproject=1':'').'">';
print img_delete();
print '';
}
|