Merge branch 'sprint/194_tianshujie_fixbug' into 'master'

Sprint/194 tianshujie fixbug

See merge request easycorp/zentaopms!3611
This commit is contained in:
李玉春
2022-05-26 05:59:08 +00:00
5 changed files with 38 additions and 14 deletions
+3 -1
View File
@@ -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 "<a href='{$gobackLink}' class='btn btn-back $class' data-app='$tab' $misc>{$label}</a>";
return "<a href='{$gobackLink}' class='btn btn-back $class' $misc>{$label}</a>";
}
/**
+1 -1
View File
@@ -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. */
+5 -4
View File
@@ -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);
}
+27 -6
View File
@@ -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.
*
+2 -2
View File
@@ -45,7 +45,7 @@
<th class="thWidth"><?php echo $lang->task->consumed;?></th>
<th class="thWidth"><?php echo $lang->task->left;?></th>
<th><?php echo $lang->comment;?></th>
<th class='c-actions-2'><?php if(empty($task->team) or $task->assignedTo == $this->app->user->account) echo $lang->actions;?></th>
<th class='c-actions-2'><?php if(empty($task->team) or $task->assignedTo == $this->app->user->account or ($task->mode == 'multi' and isset($task->team[$app->user->account]))) echo $lang->actions;?></th>
</tr>
</thead>
<tbody>
@@ -57,7 +57,7 @@
<td title="<?php echo $estimate->consumed . ' ' . $lang->execution->workHour;?>"><?php echo $estimate->consumed . ' ' . $lang->execution->workHourUnit;?></td>
<td title="<?php echo $estimate->left . ' ' . $lang->execution->workHour;?>"><?php echo $estimate->left . ' ' . $lang->execution->workHourUnit;?></td>
<td class="text-left" title="<?php echo $estimate->work;?>"><?php echo $estimate->work;?></td>
<?php if(empty($task->team) or $task->assignedTo == $this->app->user->account):?>
<?php if(empty($task->team) or $task->assignedTo == $this->app->user->account or ($task->mode == 'multi' and isset($task->team[$app->user->account]))):?>
<td align='center' class='c-actions'>
<?php
if($this->app->user->admin or $this->app->user->account == $estimate->account)