Clean project pages to work like other modules
This commit is contained in:
parent
8e882b4cc2
commit
0f456c46ab
@ -348,6 +348,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
|||||||
$projectstatic->id=$lines[$i]->fk_project;
|
$projectstatic->id=$lines[$i]->fk_project;
|
||||||
$projectstatic->ref=$lines[$i]->projectref;
|
$projectstatic->ref=$lines[$i]->projectref;
|
||||||
$projectstatic->public=$lines[$i]->public;
|
$projectstatic->public=$lines[$i]->public;
|
||||||
|
$projectstatic->title=$lines[$i]->projectlabel;
|
||||||
if ($lines[$i]->public || in_array($lines[$i]->fk_project,$projectsArrayId) || ! empty($user->rights->projet->all->lire)) print $projectstatic->getNomUrl(1);
|
if ($lines[$i]->public || in_array($lines[$i]->fk_project,$projectsArrayId) || ! empty($user->rights->projet->all->lire)) print $projectstatic->getNomUrl(1);
|
||||||
else print $projectstatic->getNomUrl(1,'nolink');
|
else print $projectstatic->getNomUrl(1,'nolink');
|
||||||
//if ($showlineingray) print '</i>';
|
//if ($showlineingray) print '</i>';
|
||||||
|
|||||||
@ -31,6 +31,7 @@ AllProjects=All projects
|
|||||||
OpenedProjects=Opened projects
|
OpenedProjects=Opened projects
|
||||||
OpenedTasks=Opened tasks
|
OpenedTasks=Opened tasks
|
||||||
OpportunitiesStatusForOpenedProjects=Opportunities amount of opened projects by status
|
OpportunitiesStatusForOpenedProjects=Opportunities amount of opened projects by status
|
||||||
|
OpportunitiesStatusForProjects=Opportunities amount of projects by status
|
||||||
ProjectsList=List of projects
|
ProjectsList=List of projects
|
||||||
ShowProject=Show project
|
ShowProject=Show project
|
||||||
SetProject=Set project
|
SetProject=Set project
|
||||||
|
|||||||
@ -48,6 +48,7 @@ $langs->load("projects");
|
|||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
$projectstatic=new Project($db);
|
$projectstatic=new Project($db);
|
||||||
|
$taskstatic=new Task($db);
|
||||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1); // Return all projects I have permission on because I want my tasks and some of my task may be on a public projet that is not my project
|
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1); // Return all projects I have permission on because I want my tasks and some of my task may be on a public projet that is not my project
|
||||||
$tasktmp=new Task($db);
|
$tasktmp=new Task($db);
|
||||||
|
|
||||||
@ -94,6 +95,7 @@ if (count($listofsearchfields))
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||||
|
|
||||||
/* Affichage de la liste des projets d'aujourd'hui */
|
/* Affichage de la liste des projets d'aujourd'hui */
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
@ -150,7 +152,6 @@ print "</table>";
|
|||||||
// TODO Do not use date_add function to be compatible with all database
|
// TODO Do not use date_add function to be compatible with all database
|
||||||
if ($db->type != 'pgsql')
|
if ($db->type != 'pgsql')
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Affichage de la liste des projets d'hier */
|
/* Affichage de la liste des projets d'hier */
|
||||||
print '<br><table class="noborder" width="100%">';
|
print '<br><table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -207,61 +208,60 @@ if ($db->type != 'pgsql')
|
|||||||
|
|
||||||
// TODO Do not use week function to be compatible with all database
|
// TODO Do not use week function to be compatible with all database
|
||||||
if ($db->type != 'pgsql')
|
if ($db->type != 'pgsql')
|
||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
/* Affichage de la liste des projets de la semaine */
|
/* Affichage de la liste des projets de la semaine */
|
||||||
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("ActivityOnProjectThisWeek").'</td>';
|
print '<td>'.$langs->trans("ActivityOnProjectThisWeek").'</td>';
|
||||||
print '<td align="right">'.$langs->trans("Time").'</td>';
|
print '<td align="right">'.$langs->trans("Time").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$sql = "SELECT p.rowid, p.ref, p.title, SUM(tt.task_duration) as nb";
|
$sql = "SELECT p.rowid, p.ref, p.title, SUM(tt.task_duration) as nb";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||||
$sql.= " , ".MAIN_DB_PREFIX."projet_task as t";
|
$sql.= " , ".MAIN_DB_PREFIX."projet_task as t";
|
||||||
$sql.= " , ".MAIN_DB_PREFIX."projet_task_time as tt";
|
$sql.= " , ".MAIN_DB_PREFIX."projet_task_time as tt";
|
||||||
$sql.= " WHERE t.fk_projet = p.rowid";
|
$sql.= " WHERE t.fk_projet = p.rowid";
|
||||||
$sql.= " AND p.entity = ".$conf->entity;
|
$sql.= " AND p.entity = ".$conf->entity;
|
||||||
$sql.= " AND tt.fk_task = t.rowid";
|
$sql.= " AND tt.fk_task = t.rowid";
|
||||||
$sql.= " AND tt.fk_user = ".$user->id;
|
$sql.= " AND tt.fk_user = ".$user->id;
|
||||||
$sql.= " AND week(task_date) = '".strftime("%W",time())."'";
|
$sql.= " AND week(task_date) = '".strftime("%W",time())."'";
|
||||||
$sql.= " AND p.rowid in (".$projectsListId.")";
|
$sql.= " AND p.rowid in (".$projectsListId.")";
|
||||||
$sql.= " GROUP BY p.rowid, p.ref, p.title";
|
$sql.= " GROUP BY p.rowid, p.ref, p.title";
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ( $resql )
|
if ( $resql )
|
||||||
{
|
{
|
||||||
$total = 0;
|
$total = 0;
|
||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
while ($row = $db->fetch_object($resql))
|
while ($row = $db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr ".$bc[$var].">";
|
print "<tr ".$bc[$var].">";
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$projectstatic->id=$row->rowid;
|
$projectstatic->id=$row->rowid;
|
||||||
$projectstatic->ref=$row->ref;
|
$projectstatic->ref=$row->ref;
|
||||||
$projectstatic->title=$row->title;
|
$projectstatic->title=$row->title;
|
||||||
print $projectstatic->getNomUrl(1, '', 1);
|
print $projectstatic->getNomUrl(1, '', 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right">'.convertSecondToTime($row->nb).'</td>';
|
print '<td align="right">'.convertSecondToTime($row->nb).'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$total += $row->nb;
|
$total += $row->nb;
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
print '<td>'.$langs->trans('Total').'</td>';
|
print '<td>'.$langs->trans('Total').'</td>';
|
||||||
print '<td align="right">'.convertSecondToTime($total).'</td>';
|
print '<td align="right">'.convertSecondToTime($total).'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
print "</table><br>";
|
print "</table><br>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Affichage de la liste des projets du mois */
|
/* Affichage de la liste des projets du mois */
|
||||||
@ -364,18 +364,16 @@ if (! empty($conf->global->PROJECT_TASK_TIME_YEAR))
|
|||||||
print "</table>";
|
print "</table>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_SHOW_TASK_LIST_ON_PROJECT_AREA))
|
||||||
|
|
||||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
|
||||||
|
|
||||||
|
|
||||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
|
||||||
{
|
{
|
||||||
// Tasks for all resources of all opened projects and time spent for each task/resource
|
// Tasks for all resources of all opened projects and time spent for each task/resource
|
||||||
|
// This list can be very long, so we don't show it by default on task area. We prefer to use the list page.
|
||||||
|
// Add constant PROJECT_SHOW_TASK_LIST_ON_PROJECT_AREA to show this list
|
||||||
|
|
||||||
$max = (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA);
|
$max = (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA);
|
||||||
|
|
||||||
$sql = "SELECT p.ref, p.title, p.rowid as projectid, p.fk_statut as status, p.fk_opp_status as opp_status, t.label, t.rowid as taskid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee, SUM(tasktime.task_duration) as timespent";
|
$sql = "SELECT p.ref, p.title, p.rowid as projectid, p.fk_statut as status, p.fk_opp_status as opp_status, p.dateo as projdateo, p.datee as projdatee,";
|
||||||
|
$sql.= " t.label, t.rowid as taskid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee, SUM(tasktime.task_duration) as timespent";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid";
|
||||||
@ -409,9 +407,9 @@ if (empty($conf->global->PROJECT_HIDE_TASKS))
|
|||||||
print '<th align="center">'.$langs->trans('DateStart').'</th>';
|
print '<th align="center">'.$langs->trans('DateStart').'</th>';
|
||||||
print '<th align="center">'.$langs->trans('DateEnd').'</th>';
|
print '<th align="center">'.$langs->trans('DateEnd').'</th>';
|
||||||
print '<th align="right">'.$langs->trans('PlannedWorkload').'</th>';
|
print '<th align="right">'.$langs->trans('PlannedWorkload').'</th>';
|
||||||
print '<th align="right">'.$langs->trans("ProgressDeclared").'</td>';
|
|
||||||
print '<th align="right">'.$langs->trans('TimeSpent').'</th>';
|
print '<th align="right">'.$langs->trans('TimeSpent').'</th>';
|
||||||
print '<th align="right">'.$langs->trans("ProgressCalculated").'</td>';
|
print '<th align="right">'.$langs->trans("ProgressCalculated").'</td>';
|
||||||
|
print '<th align="right">'.$langs->trans("ProgressDeclared").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
while ($i < $num && $i < $max)
|
while ($i < $num && $i < $max)
|
||||||
@ -433,8 +431,11 @@ if (empty($conf->global->PROJECT_HIDE_TASKS))
|
|||||||
$projectstatic->id=$obj->projectid;
|
$projectstatic->id=$obj->projectid;
|
||||||
$projectstatic->ref=$obj->ref;
|
$projectstatic->ref=$obj->ref;
|
||||||
$projectstatic->title=$obj->title;
|
$projectstatic->title=$obj->title;
|
||||||
print $projectstatic->getNomUrl(1,'',16,'','<br>');
|
$projectstatic->statut = $obj->status;
|
||||||
//print '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$obj->projectid.'">'.$obj->title.'</a>';
|
$projectstatic->dateo = $db->jdate($obj->projdateo);
|
||||||
|
$projectstatic->datee = $db->jdate($obj->projdatee);
|
||||||
|
|
||||||
|
print $projectstatic->getNomUrl(1,'',0,'','<br>');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||||
{
|
{
|
||||||
@ -453,14 +454,19 @@ if (empty($conf->global->PROJECT_HIDE_TASKS))
|
|||||||
}
|
}
|
||||||
else print $langs->trans("NoTasks");
|
else print $langs->trans("NoTasks");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
$taskstatic->projectstatus = $obj->projectstatus;
|
||||||
|
$taskstatic->progress = $obj->progress;
|
||||||
|
$taskstatic->fk_statut = $obj->status;
|
||||||
|
$taskstatic->dateo = $db->jdate($obj->dateo);
|
||||||
|
$taskstatic->datee = $db->jdate($obj->datee);
|
||||||
print '<td align="center">'.dol_print_date($db->jdate($obj->dateo),'day').'</td>';
|
print '<td align="center">'.dol_print_date($db->jdate($obj->dateo),'day').'</td>';
|
||||||
print '<td align="center">'.dol_print_date($db->jdate($obj->datee),'day').'</td>';
|
print '<td align="center">'.dol_print_date($db->jdate($obj->datee),'day');
|
||||||
|
print dol_print_date($obj->date_end,'dayhour');
|
||||||
|
if ($taskstatic->hasDelay()) print img_warning($langs->trans("Late"));
|
||||||
|
print '</td>';
|
||||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$obj->taskid.'&withproject=1">';
|
print '<td align="right"><a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$obj->taskid.'&withproject=1">';
|
||||||
print convertSecondToTime($obj->planned_workload, 'all');
|
print convertSecondToTime($obj->planned_workload, 'all');
|
||||||
print '</a></td>';
|
print '</a></td>';
|
||||||
print '<td align="right">';
|
|
||||||
print ($obj->taskid>0)?$obj->progress.'%':'';
|
|
||||||
print '</td>';
|
|
||||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$obj->taskid.'&withproject=1">';
|
print '<td align="right"><a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$obj->taskid.'&withproject=1">';
|
||||||
print convertSecondToTime($obj->timespent, 'all');
|
print convertSecondToTime($obj->timespent, 'all');
|
||||||
print '</a></td>';
|
print '</a></td>';
|
||||||
@ -475,6 +481,9 @@ if (empty($conf->global->PROJECT_HIDE_TASKS))
|
|||||||
}
|
}
|
||||||
print $percentcompletion;
|
print $percentcompletion;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
print '<td align="right">';
|
||||||
|
print ($obj->taskid>0)?$obj->progress.'%':'';
|
||||||
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
|
|||||||
@ -57,7 +57,8 @@ class ProjectStats extends Stats
|
|||||||
$sql .= " SUM(t.opp_amount), t.fk_opp_status, cls.code, cls.label";
|
$sql .= " SUM(t.opp_amount), t.fk_opp_status, cls.code, cls.label";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as t, ".MAIN_DB_PREFIX."c_lead_status as cls";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as t, ".MAIN_DB_PREFIX."c_lead_status as cls";
|
||||||
$sql .= $this->buildWhere();
|
$sql .= $this->buildWhere();
|
||||||
$sql .= " AND t.fk_opp_status = cls.rowid AND t.fk_statut = 1";
|
$sql .= " AND t.fk_opp_status = cls.rowid";
|
||||||
|
$sql .= " AND t.fk_statut <> 0"; // We want historic also, so all projects
|
||||||
$sql .= " GROUP BY t.fk_opp_status, cls.code, cls.label";
|
$sql .= " GROUP BY t.fk_opp_status, cls.code, cls.label";
|
||||||
|
|
||||||
$result = array ();
|
$result = array ();
|
||||||
|
|||||||
@ -193,13 +193,15 @@ else
|
|||||||
}
|
}
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
|
if (! empty($conf->global->PROJECT_SHOW_PROJECT_LIST_ON_PROJECT_AREA))
|
||||||
print '<br>';
|
{
|
||||||
|
// This list can be very long, so we don't show it by default on task area. We prefer to use the list page.
|
||||||
|
// Add constant PROJECT_SHOW_PROJECT_LIST_ON_PROJECT_AREA to show this list
|
||||||
print_projecttasks_array($db, $form, $socid, $projectsListId, 0, 1, $listofoppstatus, array());
|
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
print_projecttasks_array($db, $form, $socid, $projectsListId, 0, 1, $listofoppstatus, array());
|
||||||
|
}
|
||||||
|
|
||||||
print '</div></div></div>';
|
print '</div></div></div>';
|
||||||
|
|
||||||
|
|||||||
@ -121,15 +121,15 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
|||||||
$px->setShowPointValue($showpointvalue);
|
$px->setShowPointValue($showpointvalue);
|
||||||
$px->setShowPercent(1);
|
$px->setShowPercent(1);
|
||||||
$px->SetMaxValue($px->GetCeilMaxValue());
|
$px->SetMaxValue($px->GetCeilMaxValue());
|
||||||
$px->SetWidth(300);
|
$px->SetWidth($WIDTH);
|
||||||
$px->SetHeight(300);
|
$px->SetHeight($HEIGHT);
|
||||||
$px->SetShading(3);
|
$px->SetShading(3);
|
||||||
$px->SetHorizTickIncrement(1);
|
$px->SetHorizTickIncrement(1);
|
||||||
$px->SetCssPrefix("cssboxes");
|
$px->SetCssPrefix("cssboxes");
|
||||||
$px->SetType(array (
|
$px->SetType(array (
|
||||||
'pie'
|
'pie'
|
||||||
));
|
));
|
||||||
$px->SetTitle($langs->trans('OpportunitiesStatusForOpenedProjects'));
|
$px->SetTitle($langs->trans('OpportunitiesStatusForProjects'));
|
||||||
$result=$px->draw($filenamenb, $fileurlnb);
|
$result=$px->draw($filenamenb, $fileurlnb);
|
||||||
if ($result<0) {
|
if ($result<0) {
|
||||||
setEventMessages($px->error, null, 'errors');
|
setEventMessages($px->error, null, 'errors');
|
||||||
@ -304,11 +304,11 @@ print '<br><br>';
|
|||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre" height="24">';
|
print '<tr class="liste_titre" height="24">';
|
||||||
print '<td align="center">'.$langs->trans("Year").'</td>';
|
print '<td align="center">'.$langs->trans("Year").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("NbOfProjects").'</td>';
|
print '<td align="right">'.$langs->trans("NbOfProjects").'</td>';
|
||||||
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||||
{
|
{
|
||||||
print '<td align="center">'.$langs->trans("AmountTotal").'</td>';
|
print '<td align="right">'.$langs->trans("OpportunityAmount").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("AmountAverage").'</td>';
|
print '<td align="right">'.$langs->trans("AmountAverage").'</td>';
|
||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
|||||||
@ -234,18 +234,6 @@ print "</table>";
|
|||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Actions
|
|
||||||
*/
|
|
||||||
if ($user->rights->projet->creer)
|
|
||||||
{
|
|
||||||
print '<div class="tabsAction">';
|
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/projet/tasks.php?action=create">'.$langs->trans('AddTask').'</a>';
|
|
||||||
print '</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user