mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-09 02:58:23 +01:00
NEW Enhance navigation of project module
This commit is contained in:
@@ -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 $pictoisfullpath 1=Icon name is a full absolute url of image
|
||||||
* @param int $id To force an id on html objects
|
* @param int $id To force an id on html objects
|
||||||
* @return string
|
* @return string
|
||||||
* @see print_barre_list
|
* @see print_barre_liste
|
||||||
*/
|
*/
|
||||||
function load_fiche_titre($titre, $mesg='', $picto='title_generic.png', $pictoisfullpath=0, $id=0)
|
function load_fiche_titre($titre, $mesg='', $picto='title_generic.png', $pictoisfullpath=0, $id=0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -260,9 +260,10 @@ function project_admin_prepare_head()
|
|||||||
* @param int $taskrole Array of roles of user for each tasks
|
* @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 $projectsListId List of id of project allowed to user (string separated with comma)
|
||||||
* @param int $addordertick Add a tick to move task
|
* @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
|
* @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 $user, $bc, $langs;
|
||||||
global $projectstatic, $taskstatic;
|
global $projectstatic, $taskstatic;
|
||||||
@@ -492,7 +493,9 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
|||||||
print convertSecondToTime($total_projectlinesa_planned, 'allhourmin');
|
print convertSecondToTime($total_projectlinesa_planned, 'allhourmin');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" class="nowrap liste_total">';
|
print '<td align="right" class="nowrap liste_total">';
|
||||||
|
if ($projectidfortotallink > 0) print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?projectid='.$projectidfortotallink.($showproject?'':'&withproject=1').'">';
|
||||||
print convertSecondToTime($total_projectlinesa_spent, 'allhourmin');
|
print convertSecondToTime($total_projectlinesa_spent, 'allhourmin');
|
||||||
|
if ($projectidfortotallink > 0) print '</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" class="nowrap liste_total">';
|
print '<td align="right" class="nowrap liste_total">';
|
||||||
if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned,2).' %';
|
if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned,2).' %';
|
||||||
|
|||||||
@@ -74,6 +74,9 @@ Progress=Progress
|
|||||||
ProgressDeclared=Declared progress
|
ProgressDeclared=Declared progress
|
||||||
ProgressCalculated=Calculated progress
|
ProgressCalculated=Calculated progress
|
||||||
Time=Time
|
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
|
ListProposalsAssociatedProject=List of the commercial proposals associated with the project
|
||||||
ListOrdersAssociatedProject=List of customer's orders associated with the project
|
ListOrdersAssociatedProject=List of customer's orders associated with the project
|
||||||
ListInvoicesAssociatedProject=List of customer's invoices associated with the project
|
ListInvoicesAssociatedProject=List of customer's invoices associated with the project
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td width="30%">';
|
print '<tr><td width="30%">';
|
||||||
print $langs->trans("Ref");
|
print $langs->trans("Ref");
|
||||||
@@ -391,25 +391,12 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
|
|
||||||
// Link to switch in "my task" / "all task"
|
|
||||||
print '<table width="100%"><tr><td align="right">';
|
|
||||||
if ($mode == 'mine')
|
|
||||||
{
|
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">'.$langs->trans("DoNotShowMyTasksOnly").'</a>';
|
|
||||||
//print ' - ';
|
|
||||||
//print $langs->trans("ShowMyTaskOnly");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//print $langs->trans("DoNotShowMyTaskOnly");
|
|
||||||
//print ' - ';
|
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&mode=mine">'.$langs->trans("ShowMyTasksOnly").'</a>';
|
|
||||||
}
|
|
||||||
print '</td></tr></table>';
|
|
||||||
|
|
||||||
|
$title=$langs->trans("ListOfTasks");
|
||||||
|
$linktotasks='<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?projectid='.$object->id.'&withproject=1">'.$langs->trans("GoToListOfTimeConsumed").'</a>';
|
||||||
|
//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
|
// 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).
|
// 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);
|
$tasksarray=$taskstatic->getTasksArray(0, 0, $object->id, $socid, 0);
|
||||||
@@ -436,11 +423,24 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
print '<td align="right">'.$langs->trans("ProgressDeclared").'</td>';
|
print '<td align="right">'.$langs->trans("ProgressDeclared").'</td>';
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
if (count($tasksarray) > 0)
|
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 '<tr class="liste_titre nodrag nodrop"><td colspan="9">';
|
||||||
|
if ($mode == 'mine')
|
||||||
|
{
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">'.$langs->trans("DoNotShowMyTasksOnly").'</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&mode=mine">'.$langs->trans("ShowMyTasksOnly").'</a>';
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Show all lines in taskarray (recursive function to go down on tree)
|
||||||
$j=0; $level=0;
|
$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
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -220,6 +220,8 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td width="30%">';
|
print '<tr><td width="30%">';
|
||||||
print $langs->trans("Ref");
|
print $langs->trans("Ref");
|
||||||
@@ -230,7 +232,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0);
|
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0);
|
||||||
$projectstatic->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'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 '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projectstatic->title.'</td></tr>';
|
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projectstatic->title.'</td></tr>';
|
||||||
|
|||||||
@@ -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
|
* View
|
||||||
*/
|
*/
|
||||||
@@ -205,20 +214,28 @@ $form = new Form($db);
|
|||||||
$formother = new FormOther($db);
|
$formother = new FormOther($db);
|
||||||
$userstatic = new User($db);
|
$userstatic = new User($db);
|
||||||
|
|
||||||
if ($id > 0 || ! empty($ref))
|
if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Fiche projet en mode visu
|
* 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);
|
$result=$projectstatic->fetch($object->fk_project);
|
||||||
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
||||||
|
|
||||||
$object->project = clone $projectstatic;
|
$object->project = clone $projectstatic;
|
||||||
|
}
|
||||||
|
|
||||||
|
$userWrite = $projectstatic->restrictedProjectArea($user,'write');
|
||||||
|
|
||||||
$userWrite = $projectstatic->restrictedProjectArea($user,'write');
|
if ($projectstatic->id > 0)
|
||||||
|
{
|
||||||
if ($withproject)
|
if ($withproject)
|
||||||
{
|
{
|
||||||
// Tabs for project
|
// Tabs for project
|
||||||
@@ -230,6 +247,8 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td width="30%">';
|
print '<tr><td width="30%">';
|
||||||
print $langs->trans("Ref");
|
print $langs->trans("Ref");
|
||||||
@@ -240,7 +259,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0);
|
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0);
|
||||||
$projectstatic->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'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 '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
@@ -275,8 +294,35 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
|
if ($user->rights->projet->all->creer || $user->rights->projet->creer)
|
||||||
|
{
|
||||||
|
if ($object->public || $userWrite > 0)
|
||||||
|
{
|
||||||
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=create'.$param.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id).'">'.$langs->trans('AddTask').'</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('AddTask').'</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans('AddTask').'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($projectidforalltimes))
|
||||||
|
{
|
||||||
$head=task_prepare_head($object);
|
$head=task_prepare_head($object);
|
||||||
dol_fiche_head($head, 'task_time', $langs->trans("Task"),0,'projecttask');
|
dol_fiche_head($head, 'task_time', $langs->trans("Task"),0,'projecttask');
|
||||||
|
|
||||||
@@ -423,21 +469,24 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table></form>';
|
print '</table></form>';
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
print '<br>';
|
|
||||||
|
if ($projectstatic->id > 0)
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
* List of time spent
|
* List of time spent
|
||||||
*/
|
*/
|
||||||
$tasks = array();
|
$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.= ", u.lastname, u.firstname";
|
||||||
$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 =".$object->id;
|
$sql .= " WHERE t.fk_user = u.rowid";
|
||||||
$sql .= " AND 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";
|
$sql .= " ORDER BY t.task_date DESC, t.task_datehour DESC, t.rowid DESC";
|
||||||
|
|
||||||
$var=true;
|
$var=true;
|
||||||
@@ -445,6 +494,16 @@ if ($id > 0 || ! empty($ref))
|
|||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
$totalnboflines=$num;
|
||||||
|
|
||||||
|
if (! empty($projectidforalltimes))
|
||||||
|
{
|
||||||
|
$title=$langs->trans("ListTaskTimeUserProject");
|
||||||
|
$linktotasks='<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'">'.$langs->trans("GoToListOfTasks").'</a>';
|
||||||
|
//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;
|
$i = 0;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
@@ -569,12 +628,12 @@ if ($id > 0 || ! empty($ref))
|
|||||||
else if ($user->rights->projet->creer)
|
else if ($user->rights->projet->creer)
|
||||||
{
|
{
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=editline&lineid='.$task_time->rowid.($withproject?'&withproject=1':'').'">';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?'.($projectidforalltimes?'projectid='.$projectidforalltimes.'&':'').'id='.$task_time->fk_task.'&action=editline&lineid='.$task_time->rowid.($withproject?'&withproject=1':'').'">';
|
||||||
print img_edit();
|
print img_edit();
|
||||||
print '</a>';
|
print '</a>';
|
||||||
|
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=deleteline&lineid='.$task_time->rowid.($withproject?'&withproject=1':'').'">';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?'.($projectidforalltimes?'projectid='.$projectidforalltimes.'&':'').'id='.$task_time->fk_task.'&action=deleteline&lineid='.$task_time->rowid.($withproject?'&withproject=1':'').'">';
|
||||||
print img_delete();
|
print img_delete();
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user