diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 062c3f711af..a5c84e17ed7 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -1051,239 +1051,6 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t } -/** - * Output a task line into a pertime intput mode - * - * @param string $inc Line number (start to 0, then increased by recursive call) - * @param string $parent Id of parent task to show (0 to show all) - * @param User|null $fuser Restrict list to user if defined - * @param Task[] $lines Array of lines - * @param int $level Level (start to 0, then increased/decrease by recursive call) - * @param string $projectsrole Array of roles user has on project - * @param string $tasksrole Array of roles user has on task - * @param string $mine Show only task lines I am assigned to - * @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to - * @param int $preselectedday Preselected day - * @param array $isavailable Array with data that say if user is available for several days for morning and afternoon - * @param int $oldprojectforbreak Old project id of last project break - * @return array Array with time spent for $fuser for each day of week on tasks in $lines and substasks - */ -function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak = 0) -{ - global $conf, $db, $user, $langs; - global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic; - - $lastprojectid = 0; - $totalforeachline = array(); - $workloadforid = array(); - $lineswithoutlevel0 = array(); - - $numlines = count($lines); - - // 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 - for ($i = 0; $i < $numlines; $i++) { - if ($lines[$i]->fk_task_parent) { - $lineswithoutlevel0[] = $lines[$i]; - } - } - } - - if (empty($oldprojectforbreak)) { - $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1); // 0 to start break , -1 no break - } - - //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++) { - if ($parent == 0) { - $level = 0; - } - - //if ($lines[$i]->fk_task_parent == $parent) - //{ - // If we want all or we have a role on task, we show it - 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); - - // Break on a new project - if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) { - $lastprojectid = $lines[$i]->fk_project; - if ($preselectedday) { - $projectstatic->id = $lines[$i]->fk_project; - } - } - - if (empty($workloadforid[$projectstatic->id])) { - if ($preselectedday) { - $projectstatic->loadTimeSpent($preselectedday, 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; - } - } - - $projectstatic->id = $lines[$i]->fk_project; - $projectstatic->ref = $lines[$i]->project_ref; - $projectstatic->title = $lines[$i]->project_label; - $projectstatic->public = $lines[$i]->public; - $projectstatic->status = $lines[$i]->project_status; - - $taskstatic->id = $lines[$i]->task_id; - $taskstatic->ref = ($lines[$i]->task_ref ? $lines[$i]->task_ref : $lines[$i]->task_id); - $taskstatic->label = $lines[$i]->task_label; - $taskstatic->date_start = $lines[$i]->date_start; - $taskstatic->date_end = $lines[$i]->date_end; - - $thirdpartystatic->id = $lines[$i]->socid; - $thirdpartystatic->name = $lines[$i]->thirdparty_name; - $thirdpartystatic->email = $lines[$i]->thirdparty_email; - - if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) { - print '