diff --git a/lib/base/front/front.class.php b/lib/base/front/front.class.php index 9fc799236e..6af2e1c1e1 100644 --- a/lib/base/front/front.class.php +++ b/lib/base/front/front.class.php @@ -501,6 +501,8 @@ class baseHTML $gobackList = isset($_COOKIE['goback']) ? json_decode($_COOKIE['goback'], true) : array(); $gobackLink = isset($gobackList[$tab]) ? $gobackList[$tab] : ''; + if(strpos($misc, 'data-app') === false) $misc .= " data-app='" . $tab . "'"; + /* If the link of the referer is not the link of the current page or the link of the index, the cookie and gobackLink will be updated. */ if(!preg_match("/(m=|\/)(index|search|$currentModule)(&f=|-)(index|buildquery|$currentMethod)(&|-|\.)?/", strtolower($refererLink))) { @@ -509,7 +511,7 @@ class baseHTML setcookie('goback', json_encode($gobackList), $config->cookieLife, $config->webRoot, '', $config->cookieSecure, false); } - return "{$label}"; + return "{$label}"; } /** diff --git a/module/mail/model.php b/module/mail/model.php index 652894eecb..8459d4fbe7 100644 --- a/module/mail/model.php +++ b/module/mail/model.php @@ -722,7 +722,7 @@ class mailModel extends model } } - if($objectType == 'meeting') $rooms = $this->loadmodel('meetingroom')->getpairs(); + if($objectType == 'meeting') $rooms = $this->loadModel('meetingroom')->getpairs(); if($objectType == 'review') $this->app->loadLang('baseline'); /* Get mail content. */ diff --git a/module/task/control.php b/module/task/control.php index 27b9b5b746..40a271bd81 100755 --- a/module/task/control.php +++ b/module/task/control.php @@ -1215,11 +1215,12 @@ class task extends control { $teams = array_keys($task->team); - $task->nextBy = $this->task->getNextUser($teams, $task->assignedTo); - $task->myConsumed = $task->team[$task->assignedTo]->consumed; + $task->nextBy = $this->task->getNextUser($teams, $this->app->user->account); + $task->myConsumed = $task->team[$this->app->user->account]->consumed; - $lastAccount = end($teams); - if($lastAccount != $task->assignedTo) + $lastAccount = end($teams); + $finishedUsers = $this->task->getFinishedUsers($taskID, $teams); + if(($lastAccount != $task->assignedTo and $task->mode == 'linear') or ($task->mode == 'multi' and count($teams) != count($finishedUsers))) { $members = $this->task->getMemberPairs($task); } diff --git a/module/task/model.php b/module/task/model.php index 595ee7de3a..338e64fcbe 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -819,7 +819,7 @@ class taskModel extends model $currentTask->consumed += (float)$member->consumed; $currentTask->left += (float)$member->left; } - $currentTask->consumed += (float)$oldTask->consumed; + if(empty($oldTask->team)) $currentTask->consumed += (float)$oldTask->consumed; if(!empty($task)) { @@ -839,15 +839,16 @@ class taskModel extends model $currentTask->finishedDate = ''; } - if($currentTask->consumed > 0 && $currentTask->left == 0) + if($currentTask->consumed > 0 and $currentTask->left == 0) { - if(isset($team[$currentTask->assignedTo]) && $oldTask->assignedTo != $teams[count($teams) - 1]) + $finisedUsers = $this->getFinishedUsers($oldTask->id, $teams); + if(($oldTask->mode == 'linear' and isset($team[$currentTask->assignedTo]) and $oldTask->assignedTo != $teams[count($teams) - 1]) or ($oldTask->mode == 'multi' and count($finisedUsers) != (count($teams) -1))) { $currentTask->status = 'doing'; $currentTask->finishedBy = ''; $currentTask->finishedDate = ''; } - elseif($oldTask->assignedTo == $teams[count($teams) - 1]) + elseif(($oldTask->mode == 'linear' and $oldTask->assignedTo == $teams[count($teams) - 1]) or $oldTask->mode == 'multi') { $currentTask->status = 'done'; $currentTask->finishedBy = $this->app->user->account; @@ -1834,9 +1835,9 @@ class taskModel extends model $this->dao->update(TABLE_TEAM)->set('left')->eq(0)->set('consumed')->eq($task->consumed) ->where('root')->eq((int)$taskID) ->andWhere('type')->eq('task') - ->andWhere('account')->eq($oldTask->assignedTo)->exec(); + ->andWhere('account')->eq($this->app->user->account)->exec(); - $skipMembers = $this->loadModel('execution')->getTeamSkip($oldTask->team, $oldTask->assignedTo, $task->assignedTo); + $skipMembers = $oldTask->mode == 'linear' ? $this->loadModel('execution')->getTeamSkip($oldTask->team, $oldTask->assignedTo, $task->assignedTo) : $this->getFinishedUsers($oldTask->id, array_keys($oldTask->team)); foreach($skipMembers as $account => $team) $this->dao->update(TABLE_TEAM)->set('left')->eq(0)->where('root')->eq($taskID)->andWhere('type')->eq('task')->andWhere('account')->eq($account)->exec(); $task = $this->computeHours4Multiple($oldTask, $task); @@ -3548,6 +3549,26 @@ class taskModel extends model return $members; } + /** + * Get the users who finished the multiple task. + * + * @param int $taskID + * @param string|array $team + * @access public + * @return array + */ + public function getFinishedUsers($taskID = 0, $team = array()) + { + $task = $this->getById($taskID); + return $this->dao->select('actor')->from(TABLE_ACTION) + ->where('objectType')->eq('task') + ->andWhere('objectID')->eq($taskID) + ->andWhere('actor')->in($team) + ->andWhere('action')->eq('finished') + ->andWhere('date')->ge($task->activatedDate) + ->fetchPairs('actor'); + } + /** * Build task menu. * diff --git a/module/task/view/recordestimate.html.php b/module/task/view/recordestimate.html.php index 4153a61e18..27858044a1 100644 --- a/module/task/view/recordestimate.html.php +++ b/module/task/view/recordestimate.html.php @@ -45,7 +45,7 @@