mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-09 11:08:34 +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 $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)
|
||||
{
|
||||
|
||||
@@ -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 '</td>';
|
||||
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');
|
||||
if ($projectidfortotallink > 0) print '</a>';
|
||||
print '</td>';
|
||||
print '<td align="right" class="nowrap liste_total">';
|
||||
if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned,2).' %';
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -391,24 +391,11 @@ else if ($id > 0 || ! empty($ref))
|
||||
|
||||
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
|
||||
// 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).
|
||||
@@ -436,11 +423,24 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<td align="right">'.$langs->trans("ProgressDeclared").'</td>';
|
||||
print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
if (count($tasksarray) > 0)
|
||||
{
|
||||
// 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;
|
||||
$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
|
||||
{
|
||||
|
||||
@@ -220,6 +220,8 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="30%">';
|
||||
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 '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projectstatic->title.'</td></tr>';
|
||||
|
||||
@@ -194,6 +194,15 @@ 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');
|
||||
|
||||
if ($projectstatic->id > 0)
|
||||
{
|
||||
if ($withproject)
|
||||
{
|
||||
// Tabs for project
|
||||
@@ -230,6 +247,8 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="30%">';
|
||||
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 '</td></tr>';
|
||||
|
||||
// Label
|
||||
@@ -275,8 +294,35 @@ if ($id > 0 || ! empty($ref))
|
||||
print '</table>';
|
||||
|
||||
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);
|
||||
dol_fiche_head($head, 'task_time', $langs->trans("Task"),0,'projecttask');
|
||||
|
||||
@@ -423,21 +469,24 @@ if ($id > 0 || ! empty($ref))
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table></form>';
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
}
|
||||
}
|
||||
|
||||
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='<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;
|
||||
while ($i < $num)
|
||||
{
|
||||
@@ -569,12 +628,12 @@ if ($id > 0 || ! empty($ref))
|
||||
else if ($user->rights->projet->creer)
|
||||
{
|
||||
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 '</a>';
|
||||
|
||||
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 '</a>';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user