From e0f86f0270e01b2c83d3c617f1b13fe6b05c78d4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Feb 2015 21:33:09 +0100 Subject: [PATCH] Oubli sur option PROJECT_HIDE_TASKS --- htdocs/projet/element.php | 3 + htdocs/projet/index.php | 208 +++++++++++++++++++------------------- 2 files changed, 108 insertions(+), 103 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index cf9ccbcc4ce..1abaa37cac1 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -364,6 +364,7 @@ foreach ($listofreferent as $key => $value) $total_ht_by_third=0; $total_ttc_by_third=0; } + $saved_third_id = $element->thirdparty->id; $qualifiedfortotal=true; if ($key == 'invoice') @@ -449,6 +450,8 @@ foreach ($listofreferent as $key => $value) $breakline.=''; $breakline.=''; } + + //var_dump($element->thirdparty->name.' - '.$saved_third_id.' - '.$element->thirdparty->id); } if ($breakline) print $breakline; diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index ec807f5a5a3..05123fb222c 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -155,124 +155,126 @@ print ""; print ''; -// Tasks for all resources of all opened projects and time spent for each task/resource -print '
'; - -$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, 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.= " 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_time as tasktime on tasktime.fk_task = t.rowid"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on tasktime.fk_user = u.rowid"; -$sql.= " WHERE p.entity = ".$conf->entity; -if ($mine || empty($user->rights->projet->all->lire)) $sql.= " AND p.rowid IN (".$projectsListId.")"; -if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; -$sql.= " AND p.fk_statut=1"; -$sql.= " GROUP BY p.ref, p.title, p.rowid, t.label, t.rowid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee"; -$sql.= " ORDER BY t.rowid, t.dateo, t.datee"; -$sql.= $db->plimit($max+1); // We want more to know if we have more than limit - -$var=true; - -dol_syslog('projet:index.php: affectationpercent', LOG_DEBUG); -$resql = $db->query($sql); -if ( $resql ) +if (empty($conf->global->PROJECT_HIDE_TASKS)) { - $num = $db->num_rows($resql); - $i = 0; + // Tasks for all resources of all opened projects and time spent for each task/resource + print '
'; - print '
'; + $max = (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA); - print_fiche_titre($langs->trans("TasksOnOpenedProject"),'','').'
'; + $sql = "SELECT p.ref, p.title, p.rowid as projectid, 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.= " 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_time as tasktime on tasktime.fk_task = t.rowid"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on tasktime.fk_user = u.rowid"; + $sql.= " WHERE p.entity = ".$conf->entity; + if ($mine || empty($user->rights->projet->all->lire)) $sql.= " AND p.rowid IN (".$projectsListId.")"; + if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; + $sql.= " AND p.fk_statut=1"; + $sql.= " GROUP BY p.ref, p.title, p.rowid, t.label, t.rowid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee"; + $sql.= " ORDER BY t.rowid, t.dateo, t.datee"; + $sql.= $db->plimit($max+1); // We want more to know if we have more than limit - print ''; - print ''; - //print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + $var=true; - while ($i < $num && $i < $max) + dol_syslog('projet:index.php: affectationpercent', LOG_DEBUG); + $resql = $db->query($sql); + if ( $resql ) { - $obj = $db->fetch_object($resql); - $var=!$var; + $num = $db->num_rows($resql); + $i = 0; - $username=''; - if ($obj->userid && $userstatic->id != $obj->userid) // We have a user and it is not last loaded user - { - $result=$userstatic->fetch($obj->userid); - if (! $result) $userstatic->id=0; - } - if ($userstatic->id) $username = $userstatic->getNomUrl(0,0); + print '
'; - print ""; - //print ''; - print ''; - print ''; - } - - print "
'.$langs->trans('TaskRessourceLinks').''.$langs->trans('Projects').''.$langs->trans('Task').''.$langs->trans('DateStart').''.$langs->trans('DateEnd').''.$langs->trans('PlannedWorkload').''.$langs->trans("ProgressDeclared").''; - print ''.$langs->trans('TimeSpent').''.$langs->trans("ProgressCalculated").''; - print '
'.$username.''; - $projectstatic->id=$obj->projectid; - $projectstatic->ref=$obj->ref; - $projectstatic->title=$obj->title; - print $projectstatic->getNomUrl(1,'',16); - //print ''.$obj->title.''; - print ''; - if (! empty($obj->taskid)) + print_fiche_titre($langs->trans("TasksOnOpenedProject"),'','').'
'; + + print ''; + print ''; + //print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + while ($i < $num && $i < $max) { - print ''.$obj->label.''; - } - else print $langs->trans("NoTasks"); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '"; + //print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + + $i++; } - print $percentcompletion; - print ''; - print "\n"; - $i++; + if ($num > $max) + { + print ''; + } + + print "
'.$langs->trans('TaskRessourceLinks').''.$langs->trans('Projects').''.$langs->trans('Task').''.$langs->trans('DateStart').''.$langs->trans('DateEnd').''.$langs->trans('PlannedWorkload').''.$langs->trans("ProgressDeclared").''; + print ''.$langs->trans('TimeSpent').''.$langs->trans("ProgressCalculated").''; + print '
'.dol_print_date($db->jdate($obj->dateo),'day').''.dol_print_date($db->jdate($obj->datee),'day').''; - print convertSecondToTime($obj->planned_workload, 'all'); - print ''; - print ($obj->taskid>0)?$obj->progress.'%':''; - print ''; - print convertSecondToTime($obj->timespent, 'all'); - print ''; - if (! empty($obj->taskid)) - { - if (empty($obj->planned_workload) > 0) { - $percentcompletion = $langs->trans("WorkloadNotDefined"); - } else { - $percentcompletion = intval($obj->duration_effective*100/$obj->planned_workload).'%'; + $obj = $db->fetch_object($resql); + $var=!$var; + + $username=''; + if ($obj->userid && $userstatic->id != $obj->userid) // We have a user and it is not last loaded user + { + $result=$userstatic->fetch($obj->userid); + if (! $result) $userstatic->id=0; } + if ($userstatic->id) $username = $userstatic->getNomUrl(0,0); + + print "
'.$username.''; + $projectstatic->id=$obj->projectid; + $projectstatic->ref=$obj->ref; + $projectstatic->title=$obj->title; + print $projectstatic->getNomUrl(1,'',16); + //print ''.$obj->title.''; + print ''; + if (! empty($obj->taskid)) + { + print ''.$obj->label.''; + } + else print $langs->trans("NoTasks"); + print ''.dol_print_date($db->jdate($obj->dateo),'day').''.dol_print_date($db->jdate($obj->datee),'day').''; + print convertSecondToTime($obj->planned_workload, 'all'); + print ''; + print ($obj->taskid>0)?$obj->progress.'%':''; + print ''; + print convertSecondToTime($obj->timespent, 'all'); + print ''; + if (! empty($obj->taskid)) + { + if (empty($obj->planned_workload) > 0) { + $percentcompletion = $langs->trans("WorkloadNotDefined"); + } else { + $percentcompletion = intval($obj->duration_effective*100/$obj->planned_workload).'%'; + } + } + print $percentcompletion; + print '
'.$langs->trans("WarningTooManyDataPleaseUseMoreFilters").'
"; + + + $db->free($resql); + } + else + { + dol_print_error($db); } - if ($num > $max) - { - print '
'.$langs->trans("WarningTooManyDataPleaseUseMoreFilters").'
"; - - - $db->free($resql); + print '
'; } -else -{ - dol_print_error($db); -} - -print '
'; - llxFooter();