Merge branch '3.9' of git@github.com:Dolibarr/dolibarr.git into 4.0
Conflicts: htdocs/core/lib/project.lib.php htdocs/projet/class/task.class.php
This commit is contained in:
commit
fed0f3d09e
@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
|||||||
function project_prepare_head($object)
|
function project_prepare_head($object)
|
||||||
{
|
{
|
||||||
global $db, $langs, $conf, $user;
|
global $db, $langs, $conf, $user;
|
||||||
|
|
||||||
$h = 0;
|
$h = 0;
|
||||||
$head = array();
|
$head = array();
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ function project_prepare_head($object)
|
|||||||
$head[$h][1] = $langs->trans("Info");
|
$head[$h][1] = $langs->trans("Info");
|
||||||
$head[$h][2] = 'info';
|
$head[$h][2] = 'info';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'project','remove');
|
complete_head_from_modules($conf,$langs,$object,$head,$h,'project','remove');
|
||||||
|
|
||||||
return $head;
|
return $head;
|
||||||
@ -487,7 +487,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
|||||||
if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick);
|
if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick);
|
||||||
$level--;
|
$level--;
|
||||||
}
|
}
|
||||||
|
|
||||||
$total_projectlinesa_spent += $lines[$i]->duration;
|
$total_projectlinesa_spent += $lines[$i]->duration;
|
||||||
$total_projectlinesa_planned += $lines[$i]->planned_workload;
|
$total_projectlinesa_planned += $lines[$i]->planned_workload;
|
||||||
if ($lines[$i]->planned_workload) $total_projectlinesa_spent_if_planned += $lines[$i]->duration;
|
if ($lines[$i]->planned_workload) $total_projectlinesa_spent_if_planned += $lines[$i]->duration;
|
||||||
@ -551,9 +551,9 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
|||||||
$lastprojectid=0;
|
$lastprojectid=0;
|
||||||
$workloadforid=array();
|
$workloadforid=array();
|
||||||
$lineswithoutlevel0=array();
|
$lineswithoutlevel0=array();
|
||||||
|
|
||||||
$numlines=count($lines);
|
$numlines=count($lines);
|
||||||
|
|
||||||
// Create a smaller array with sublevels only to be used later. This increase dramatically performances.
|
// Create a smaller array with sublevels only to be used later. This increase dramatically performances.
|
||||||
if ($parent == 0) // Always and only if at first level
|
if ($parent == 0) // Always and only if at first level
|
||||||
{
|
{
|
||||||
@ -561,10 +561,10 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
|||||||
{
|
{
|
||||||
if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i];
|
if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//dol_syslog('projectLinesPerDay inc='.$inc.' preselectedday='.$preselectedday.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0));
|
//dol_syslog('projectLinesPerDay inc='.$inc.' preselectedday='.$preselectedday.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0));
|
||||||
|
|
||||||
for ($i = 0 ; $i < $numlines ; $i++)
|
for ($i = 0 ; $i < $numlines ; $i++)
|
||||||
{
|
{
|
||||||
if ($parent == 0) $level = 0;
|
if ($parent == 0) $level = 0;
|
||||||
@ -575,7 +575,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
|||||||
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
|
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
|
||||||
{
|
{
|
||||||
//dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project);
|
//dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project);
|
||||||
|
|
||||||
// Break on a new project
|
// Break on a new project
|
||||||
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
|
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
|
||||||
{
|
{
|
||||||
@ -585,7 +585,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
|||||||
$projectstatic->id = $lines[$i]->fk_project;
|
$projectstatic->id = $lines[$i]->fk_project;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($workloadforid[$projectstatic->id]))
|
if (empty($workloadforid[$projectstatic->id]))
|
||||||
{
|
{
|
||||||
if ($preselectedday)
|
if ($preselectedday)
|
||||||
@ -594,7 +594,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
|||||||
$workloadforid[$projectstatic->id]=1;
|
$workloadforid[$projectstatic->id]=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$projectstatic->id=$lines[$i]->fk_project;
|
$projectstatic->id=$lines[$i]->fk_project;
|
||||||
$projectstatic->ref=$lines[$i]->projectref;
|
$projectstatic->ref=$lines[$i]->projectref;
|
||||||
$projectstatic->title=$lines[$i]->projectlabel;
|
$projectstatic->title=$lines[$i]->projectlabel;
|
||||||
@ -702,16 +702,16 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
|||||||
print '<textarea name="'.$lines[$i]->id.'note" rows="2" id="note">';
|
print '<textarea name="'.$lines[$i]->id.'note" rows="2" id="note">';
|
||||||
print '</textarea>';
|
print '</textarea>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$inc++;
|
$inc++;
|
||||||
$level++;
|
$level++;
|
||||||
if ($lines[$i]->id > 0)
|
if ($lines[$i]->id > 0)
|
||||||
{
|
{
|
||||||
if ($parent == 0) projectLinesPerDay($inc, $lines[$i]->id, $fuser, $lineswithoutlevel0, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $var);
|
if ($parent == 0) projectLinesPerDay($inc, $lines[$i]->id, $fuser, $lineswithoutlevel0, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $var);
|
||||||
else projectLinesPerDay($inc, $lines[$i]->id, $fuser, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $var);
|
else projectLinesPerDay($inc, $lines[$i]->id, $fuser, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $var);
|
||||||
}
|
}
|
||||||
$level--;
|
$level--;
|
||||||
}
|
}
|
||||||
@ -752,7 +752,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
|||||||
$lastprojectid=0;
|
$lastprojectid=0;
|
||||||
$workloadforid=array();
|
$workloadforid=array();
|
||||||
$lineswithoutlevel0=array();
|
$lineswithoutlevel0=array();
|
||||||
|
|
||||||
// Create a smaller array with sublevels only to be used later. This increase dramatically performances.
|
// Create a smaller array with sublevels only to be used later. This increase dramatically performances.
|
||||||
if ($parent == 0) // Always and only if at first level
|
if ($parent == 0) // Always and only if at first level
|
||||||
{
|
{
|
||||||
@ -763,18 +763,18 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
|||||||
}
|
}
|
||||||
|
|
||||||
//dol_syslog('projectLinesPerWeek inc='.$inc.' firstdaytoshow='.$firstdaytoshow.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0));
|
//dol_syslog('projectLinesPerWeek inc='.$inc.' firstdaytoshow='.$firstdaytoshow.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0));
|
||||||
|
|
||||||
for ($i = 0 ; $i < $numlines ; $i++)
|
for ($i = 0 ; $i < $numlines ; $i++)
|
||||||
{
|
{
|
||||||
if ($parent == 0) $level = 0;
|
if ($parent == 0) $level = 0;
|
||||||
|
|
||||||
if ($lines[$i]->fk_task_parent == $parent)
|
if ($lines[$i]->fk_task_parent == $parent)
|
||||||
{
|
{
|
||||||
// If we want all or we have a role on task, we show it
|
// If we want all or we have a role on task, we show it
|
||||||
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
|
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
|
||||||
{
|
{
|
||||||
//dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project);
|
//dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project);
|
||||||
|
|
||||||
// Break on a new project
|
// Break on a new project
|
||||||
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
|
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
|
||||||
{
|
{
|
||||||
@ -782,13 +782,13 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
|||||||
$lastprojectid=$lines[$i]->fk_project;
|
$lastprojectid=$lines[$i]->fk_project;
|
||||||
$projectstatic->id = $lines[$i]->fk_project;
|
$projectstatic->id = $lines[$i]->fk_project;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($workloadforid[$projectstatic->id]))
|
if (empty($workloadforid[$projectstatic->id]))
|
||||||
{
|
{
|
||||||
$projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week
|
$projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week
|
||||||
$workloadforid[$projectstatic->id]=1;
|
$workloadforid[$projectstatic->id]=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<tr ".$bc[$var].">\n";
|
print "<tr ".$bc[$var].">\n";
|
||||||
|
|
||||||
// Project
|
// Project
|
||||||
@ -868,7 +868,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
|||||||
}
|
}
|
||||||
|
|
||||||
//var_dump($projectstatic->weekWorkLoadPerTask);
|
//var_dump($projectstatic->weekWorkLoadPerTask);
|
||||||
|
|
||||||
// Fields to show current time
|
// Fields to show current time
|
||||||
$tableCell=''; $modeinput='hours';
|
$tableCell=''; $modeinput='hours';
|
||||||
for ($idw = 0; $idw < 7; $idw++)
|
for ($idw = 0; $idw < 7; $idw++)
|
||||||
@ -879,7 +879,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
|||||||
$alreadyspent='';
|
$alreadyspent='';
|
||||||
if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin');
|
if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin');
|
||||||
$alttitle=$langs->trans("AddHereTimeSpentForDay",$tmparray['day'],$tmparray['mon']);
|
$alttitle=$langs->trans("AddHereTimeSpentForDay",$tmparray['day'],$tmparray['mon']);
|
||||||
|
|
||||||
$tableCell ='<td align="center" class="hide'.$idw.'">';
|
$tableCell ='<td align="center" class="hide'.$idw.'">';
|
||||||
if ($alreadyspent)
|
if ($alreadyspent)
|
||||||
{
|
{
|
||||||
@ -895,7 +895,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
|||||||
print $tableCell;
|
print $tableCell;
|
||||||
}
|
}
|
||||||
dol_syslog("yyy");
|
dol_syslog("yyy");
|
||||||
|
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("YouAreNotContactOfProject"));
|
if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("YouAreNotContactOfProject"));
|
||||||
else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAffectedToYou"));
|
else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAffectedToYou"));
|
||||||
@ -907,7 +907,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
|||||||
// Call to show task with a lower level (task under the current task)
|
// Call to show task with a lower level (task under the current task)
|
||||||
$inc++;
|
$inc++;
|
||||||
$level++;
|
$level++;
|
||||||
if ($lines[$i]->id > 0)
|
if ($lines[$i]->id > 0)
|
||||||
{
|
{
|
||||||
if ($parent == 0) projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, $lineswithoutlevel0, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $var);
|
if ($parent == 0) projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, $lineswithoutlevel0, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $var);
|
||||||
else projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $var);
|
else projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $var);
|
||||||
@ -981,7 +981,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
|||||||
|
|
||||||
$projectstatic=new Project($db);
|
$projectstatic=new Project($db);
|
||||||
$thirdpartystatic=new Societe($db);
|
$thirdpartystatic=new Societe($db);
|
||||||
|
|
||||||
$sortfield='';
|
$sortfield='';
|
||||||
$sortorder='';
|
$sortorder='';
|
||||||
$project_year_filter=0;
|
$project_year_filter=0;
|
||||||
@ -990,7 +990,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
|||||||
if (strcmp($statut, '') && $statut >= 0) $title=$langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$statut]);
|
if (strcmp($statut, '') && $statut >= 0) $title=$langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$statut]);
|
||||||
|
|
||||||
$arrayidtypeofcontact=array();
|
$arrayidtypeofcontact=array();
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||||
@ -1033,11 +1033,11 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
|||||||
$sql.= " AND (p.datee IS NULL OR p.datee >= ".$db->idate(dol_get_first_day($project_year_filter,1,false)).")";
|
$sql.= " AND (p.datee IS NULL OR p.datee >= ".$db->idate(dol_get_first_day($project_year_filter,1,false)).")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get id of project we must show tasks
|
// Get id of project we must show tasks
|
||||||
$arrayidofprojects=array();
|
$arrayidofprojects=array();
|
||||||
$sql1 = "SELECT p.rowid as projectid";
|
$sql1 = "SELECT p.rowid as projectid";
|
||||||
$sql1.= $sql;
|
$sql1.= $sql;
|
||||||
$resql = $db->query($sql1);
|
$resql = $db->query($sql1);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -1052,7 +1052,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
|||||||
}
|
}
|
||||||
else dol_print_error($db);
|
else dol_print_error($db);
|
||||||
if (empty($arrayidofprojects)) $arrayidofprojects[0]=-1;
|
if (empty($arrayidofprojects)) $arrayidofprojects[0]=-1;
|
||||||
|
|
||||||
// Get list of project with calculation on tasks
|
// Get list of project with calculation on tasks
|
||||||
$sql2 = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_soc, s.nom as socname, p.fk_user_creat, p.public, p.fk_statut as status, p.fk_opp_status as opp_status, p.opp_amount,";
|
$sql2 = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_soc, s.nom as socname, p.fk_user_creat, p.public, p.fk_statut as status, p.fk_opp_status as opp_status, p.opp_amount,";
|
||||||
$sql2.= " p.dateo, p.datee,";
|
$sql2.= " p.dateo, p.datee,";
|
||||||
@ -1083,7 +1083,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
|||||||
print_liste_field_titre($langs->trans("OpportunityAmount"),"","","","",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("OpportunityAmount"),"","","","",'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("OpportunityStatus"),"","","","",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("OpportunityStatus"),"","","","",'align="right"',$sortfield,$sortorder);
|
||||||
}
|
}
|
||||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||||
{
|
{
|
||||||
print_liste_field_titre($langs->trans("Tasks"),"","","","",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Tasks"),"","","","",'align="right"',$sortfield,$sortorder);
|
||||||
if (! in_array('plannedworkload', $hiddenfields)) print_liste_field_titre($langs->trans("PlannedWorkload"),"","","","",'align="right"',$sortfield,$sortorder);
|
if (! in_array('plannedworkload', $hiddenfields)) print_liste_field_titre($langs->trans("PlannedWorkload"),"","","","",'align="right"',$sortfield,$sortorder);
|
||||||
@ -1091,7 +1091,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
|||||||
}
|
}
|
||||||
print_liste_field_titre($langs->trans("Status"),"","","","",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Status"),"","","","",'align="right"',$sortfield,$sortorder);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
@ -1109,7 +1109,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
|||||||
$projectstatic->title = $objp->title;
|
$projectstatic->title = $objp->title;
|
||||||
$projectstatic->datee = $db->jdate($objp->datee);
|
$projectstatic->datee = $db->jdate($objp->datee);
|
||||||
$projectstatic->dateo = $db->jdate($objp->dateo);
|
$projectstatic->dateo = $db->jdate($objp->dateo);
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr ".$bc[$var].">";
|
print "<tr ".$bc[$var].">";
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -1135,17 +1135,17 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
|||||||
if ($code) print $langs->trans("OppStatus".$code);
|
if ($code) print $langs->trans("OppStatus".$code);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||||
{
|
{
|
||||||
print '<td align="right">'.$objp->nb.'</td>';
|
print '<td align="right">'.$objp->nb.'</td>';
|
||||||
|
|
||||||
$plannedworkload=$objp->planned_workload;
|
$plannedworkload=$objp->planned_workload;
|
||||||
$total_plannedworkload+=$plannedworkload;
|
$total_plannedworkload+=$plannedworkload;
|
||||||
if (! in_array('plannedworkload', $hiddenfields))
|
if (! in_array('plannedworkload', $hiddenfields))
|
||||||
{
|
{
|
||||||
print '<td align="right">'.($plannedworkload?convertSecondToTime($plannedworkload):'').'</td>';
|
print '<td align="right">'.($plannedworkload?convertSecondToTime($plannedworkload):'').'</td>';
|
||||||
}
|
}
|
||||||
if (! in_array('declaredprogress', $hiddenfields))
|
if (! in_array('declaredprogress', $hiddenfields))
|
||||||
{
|
{
|
||||||
$declaredprogressworkload=$objp->declared_progess_workload;
|
$declaredprogressworkload=$objp->declared_progess_workload;
|
||||||
$total_declaredprogressworkload+=$declaredprogressworkload;
|
$total_declaredprogressworkload+=$declaredprogressworkload;
|
||||||
@ -1155,7 +1155,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td align="right">'.$projectstatic->getLibStatut(3).'</td>';
|
print '<td align="right">'.$projectstatic->getLibStatut(3).'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
@ -1174,7 +1174,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
|||||||
print '<td class="liste_total" align="right">'.price($total_opp_amount, 0, '', 1, -1, -1, $conf->currency).'</td>';
|
print '<td class="liste_total" align="right">'.price($total_opp_amount, 0, '', 1, -1, -1, $conf->currency).'</td>';
|
||||||
print '<td class="liste_total" align="right">'.$form->textwithpicto(price($ponderated_opp_amount, 0, '', 1, -1, -1, $conf->currency), $langs->trans("OpportunityPonderatedAmountDesc"), 1).'</td>';
|
print '<td class="liste_total" align="right">'.$form->textwithpicto(price($ponderated_opp_amount, 0, '', 1, -1, -1, $conf->currency), $langs->trans("OpportunityPonderatedAmountDesc"), 1).'</td>';
|
||||||
}
|
}
|
||||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||||
{
|
{
|
||||||
print '<td class="liste_total" align="right">'.$total_task.'</td>';
|
print '<td class="liste_total" align="right">'.$total_task.'</td>';
|
||||||
if (! in_array('plannedworkload', $hiddenfields)) print '<td class="liste_total" align="right">'.($total_plannedworkload?convertSecondToTime($total_plannedworkload):'').'</td>';
|
if (! in_array('plannedworkload', $hiddenfields)) print '<td class="liste_total" align="right">'.($total_plannedworkload?convertSecondToTime($total_plannedworkload):'').'</td>';
|
||||||
@ -1182,7 +1182,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
|||||||
}
|
}
|
||||||
print '<td class="liste_total"></td>';
|
print '<td class="liste_total"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -631,7 +631,7 @@ class Task extends CommonObject
|
|||||||
$sql.= ", ".MAIN_DB_PREFIX."element_contact as ec2";
|
$sql.= ", ".MAIN_DB_PREFIX."element_contact as ec2";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc2";
|
$sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc2";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$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";
|
||||||
}
|
}
|
||||||
@ -884,7 +884,7 @@ class Task extends CommonObject
|
|||||||
$tasktime_id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet_task_time");
|
$tasktime_id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet_task_time");
|
||||||
$ret = $tasktime_id;
|
$ret = $tasktime_id;
|
||||||
$this->timespent_id = $ret;
|
$this->timespent_id = $ret;
|
||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
@ -948,10 +948,10 @@ class Task extends CommonObject
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$id=$this->id;
|
$id=$this->id;
|
||||||
if (empty($id))
|
if (empty($id))
|
||||||
{
|
{
|
||||||
dol_syslog("getSummaryOfTimeSpent called on a not loaded task", LOG_ERR);
|
dol_syslog("getSummaryOfTimeSpent called on a not loaded task", LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result=array();
|
$result=array();
|
||||||
@ -963,7 +963,7 @@ class Task extends CommonObject
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t";
|
||||||
$sql.= " WHERE t.fk_task = ".$id;
|
$sql.= " WHERE t.fk_task = ".$id;
|
||||||
if ($userid > 0) $sql.=" AND t.fk_user = ".$userid;
|
if ($userid > 0) $sql.=" AND t.fk_user = ".$userid;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::getSummaryOfTimeSpent", LOG_DEBUG);
|
dol_syslog(get_class($this)."::getSummaryOfTimeSpent", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -1267,7 +1267,7 @@ class Task extends CommonObject
|
|||||||
$clone_task->fetch($fromid);
|
$clone_task->fetch($fromid);
|
||||||
$clone_task->fetch_optionals();
|
$clone_task->fetch_optionals();
|
||||||
//var_dump($clone_task->array_options);exit;
|
//var_dump($clone_task->array_options);exit;
|
||||||
|
|
||||||
$origin_task->fetch($fromid);
|
$origin_task->fetch($fromid);
|
||||||
|
|
||||||
$defaultref='';
|
$defaultref='';
|
||||||
@ -1581,7 +1581,7 @@ class Task extends CommonObject
|
|||||||
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
||||||
*
|
*
|
||||||
@ -1591,12 +1591,12 @@ class Task extends CommonObject
|
|||||||
function load_board($user)
|
function load_board($user)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$mine=0; $socid=$user->societe_id;
|
$mine=0; $socid=$user->societe_id;
|
||||||
|
|
||||||
$projectstatic = new Project($this->db);
|
$projectstatic = new Project($this->db);
|
||||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid);
|
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid);
|
||||||
|
|
||||||
// List of tasks (does not care about permissions. Filtering will be done later)
|
// List of tasks (does not care about permissions. Filtering will be done later)
|
||||||
$sql = "SELECT p.rowid as projectid, p.fk_statut as projectstatus,";
|
$sql = "SELECT p.rowid as projectid, p.fk_statut as projectstatus,";
|
||||||
$sql.= " t.rowid as taskid, t.progress as progress, t.fk_statut as status,";
|
$sql.= " t.rowid as taskid, t.progress as progress, t.fk_statut as status,";
|
||||||
@ -1619,29 +1619,29 @@ class Task extends CommonObject
|
|||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$task_static = new Task($this->db);
|
$task_static = new Task($this->db);
|
||||||
|
|
||||||
$response = new WorkboardResponse();
|
$response = new WorkboardResponse();
|
||||||
$response->warning_delay = $conf->projet->task->warning_delay/60/60/24;
|
$response->warning_delay = $conf->projet->task->warning_delay/60/60/24;
|
||||||
$response->label = $langs->trans("OpenedTasks");
|
$response->label = $langs->trans("OpenedTasks");
|
||||||
if ($user->rights->projet->all->lire) $response->url = DOL_URL_ROOT.'/projet/tasks/list.php?mainmenu=project';
|
if ($user->rights->projet->all->lire) $response->url = DOL_URL_ROOT.'/projet/tasks/list.php?mainmenu=project';
|
||||||
else $response->url = DOL_URL_ROOT.'/projet/tasks/list.php?mode=mine&mainmenu=project';
|
else $response->url = DOL_URL_ROOT.'/projet/tasks/list.php?mode=mine&mainmenu=project';
|
||||||
$response->img = img_object($langs->trans("Tasks"),"task");
|
$response->img = img_object($langs->trans("Tasks"),"task");
|
||||||
|
|
||||||
// This assignment in condition is not a bug. It allows walking the results.
|
// This assignment in condition is not a bug. It allows walking the results.
|
||||||
while ($obj=$this->db->fetch_object($resql))
|
while ($obj=$this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$response->nbtodo++;
|
$response->nbtodo++;
|
||||||
|
|
||||||
$task_static->projectstatus = $obj->projectstatus;
|
$task_static->projectstatus = $obj->projectstatus;
|
||||||
$task_static->progress = $obj->progress;
|
$task_static->progress = $obj->progress;
|
||||||
$task_static->fk_statut = $obj->status;
|
$task_static->fk_statut = $obj->status;
|
||||||
$task_static->date_end = $this->db->jdate($obj->datee);
|
$task_static->date_end = $this->db->jdate($obj->datee);
|
||||||
|
|
||||||
if ($task_static->hasDelay()) {
|
if ($task_static->hasDelay()) {
|
||||||
$response->nbtodolate++;
|
$response->nbtodolate++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1650,7 +1650,7 @@ class Task extends CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the task delayed?
|
* Is the task delayed?
|
||||||
*
|
*
|
||||||
@ -1659,7 +1659,7 @@ class Task extends CommonObject
|
|||||||
public function hasDelay()
|
public function hasDelay()
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
if (! ($this->progress >= 0 && $this->progress < 100)) {
|
if (! ($this->progress >= 0 && $this->progress < 100)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1669,5 +1669,5 @@ class Task extends CommonObject
|
|||||||
$datetouse = ($this->date_end > 0) ? $this->date_end : ($this->datee > 0 ? $this->datee : 0);
|
$datetouse = ($this->date_end > 0) ? $this->date_end : ($this->datee > 0 ? $this->datee : 0);
|
||||||
|
|
||||||
return ($datetouse > 0 && ($datetouse < ($now - $conf->projet->task->warning_delay)));
|
return ($datetouse > 0 && ($datetouse < ($now - $conf->projet->task->warning_delay)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user