Merge branch 'zentaopms_9.8' of github.com:easysoft/zentaopms into zentaopms_9.8

This commit is contained in:
wumo
2018-03-28 20:31:57 +08:00
11 changed files with 90 additions and 51 deletions
+31 -28
View File
@@ -1272,42 +1272,45 @@ class task extends control
$relatedFiles = $this->dao->select('id, objectID, pathname, title')->from(TABLE_FILE)->where('objectType')->eq('task')->andWhere('objectID')->in(@array_keys($tasks))->andWhere('extra')->ne('editor')->fetchGroup('objectID');
$relatedModules = $this->loadModel('tree')->getTaskOptionMenu($projectID);
$children = $this->dao->select('*')->from(TABLE_TASK)->where('deleted')->eq(0)
->andWhere('parent')->in(array_keys($tasks))
->beginIF($this->post->exportType == 'selected')->andWhere('id')->in($this->cookie->checkedItem)->fi()
->orderBy($sort)
->fetchGroup('parent', 'id');
if(!empty($children))
if(!$this->session->taskWithChildren)
{
foreach($children as $parent => $childTasks)
$children = $this->dao->select('*')->from(TABLE_TASK)->where('deleted')->eq(0)
->andWhere('parent')->in(array_keys($tasks))
->beginIF($this->post->exportType == 'selected')->andWhere('id')->in($this->cookie->checkedItem)->fi()
->orderBy($sort)
->fetchGroup('parent', 'id');
if(!empty($children))
{
foreach($childTasks as $task)
foreach($children as $parent => $childTasks)
{
/* Compute task progress. */
if($task->consumed == 0 and $task->left == 0)
foreach($childTasks as $task)
{
$task->progress = 0;
/* Compute task progress. */
if($task->consumed == 0 and $task->left == 0)
{
$task->progress = 0;
}
elseif($task->consumed != 0 and $task->left == 0)
{
$task->progress = 100;
}
else
{
$task->progress = round($task->consumed / ($task->consumed + $task->left), 2) * 100;
}
$task->progress .= '%';
}
elseif($task->consumed != 0 and $task->left == 0)
{
$task->progress = 100;
}
else
{
$task->progress = round($task->consumed / ($task->consumed + $task->left), 2) * 100;
}
$task->progress .= '%';
}
}
$position = 0;
foreach($tasks as $task)
{
$position ++;
if(isset($children[$task->id]))
$position = 0;
foreach($tasks as $task)
{
array_splice($tasks, $position, 0, $children[$task->id]);
$position += count($children[$task->id]);
$position ++;
if(isset($children[$task->id]))
{
array_splice($tasks, $position, 0, $children[$task->id]);
$position += count($children[$task->id]);
}
}
}
}
+1
View File
@@ -165,6 +165,7 @@ $lang->task->remindBug = "This Task is converted from a Bug. Do you
$lang->task->confirmChangeProject = "If you change {$lang->projectCommon}, the related Module, Story and Assignor will be changed. Do you want to do it?";
$lang->task->confirmFinish = '"Left Hour" is 0. Do you want to change the Status to "Done"?';
$lang->task->confirmRecord = '"Left Hour" is 0. Do you want to set Task as "Done"?';
$lang->task->confirmTransfer = '"Left Hour" is 0,Do you want to transfer task?';
$lang->task->noticeLinkStory = "No story has been linked. You can %s for this project, then %s.";
$lang->task->noticeSaveRecord = 'Your Hour is not saved. Please save it first.';
$lang->task->commentActions = '%s. %s, commented by <strong>%s</strong>.';
+1
View File
@@ -165,6 +165,7 @@ $lang->task->remindBug = "该任务为Bug转化得到,是否更新
$lang->task->confirmChangeProject = "修改{$lang->projectCommon}会导致相应的所属模块、相关需求和指派人发生变化,确定吗?";
$lang->task->confirmFinish = '"预计剩余"为0,确认将任务状态改为"已完成"吗?';
$lang->task->confirmRecord = '"剩余"为0,任务将标记为"已完成",您确定吗?';
$lang->task->confirmTransfer = '"当前剩余"为0,任务将被转交,您确定吗?';
$lang->task->noticeLinkStory = "没有可关联的相关需求,您可以为当前项目%s,然后%s";
$lang->task->noticeSaveRecord = '您有尚未保存的工时记录,请先将其保存。';
$lang->task->commentActions = '%s. %s, 由 <strong>%s</strong> 添加备注。';
+38 -15
View File
@@ -445,6 +445,9 @@ class taskModel extends model
$teams = array();
if($this->post->multiple)
{
$consumed = 0;
$estimate = 0;
$left = 0;
foreach($this->post->team as $row => $account)
{
if(empty($account) or isset($team[$account])) continue;
@@ -457,15 +460,26 @@ class taskModel extends model
$member->type = 'task';
$member->estimate = $this->post->teamEstimate[$row] ? $this->post->teamEstimate[$row] : 0;
$member->consumed = $this->post->teamConsumed[$row] ? $this->post->teamConsumed[$row] : 0;
$member->left = $member->estimate - $member->consumed;
$member->left = $this->post->teamLeft[$row] ? $this->post->teamLeft[$row] : ($member->estimate - $member->consumed);
$member->order = $row;
$teams[$account] = $member;
}
if(!empty($teams) and !isset($task->assignedTo))
$consumed += (float)$member->consumed;
$estimate += (float)$member->estimate;
$left += (float)$member->left;
}
if(!empty($teams))
{
$firstMember = reset($teams);
$task->assignedTo = $firstMember->account;
$task->consumed = $consumed;
$task->estimate = $estimate;
$task->left = $left;
if(!isset($task->assignedTo))
{
$firstMember = reset($teams);
$task->assignedTo = $firstMember->account;
}
}
}
@@ -945,19 +959,28 @@ class taskModel extends model
$data->consumed = $teamTime->consumed;
$data->left = $teamTime->leftTime;
if($task->status == 'done')
$newTask = new stdClass();
$newTask->left = $data->left;
$newTask->consumed = $data->consumed;
if($left != 0 || $task->assignedTo != $teams[count($teams) - 1])
{
$newTask = new stdClass();
$newTask->left = $data->left;
$newTask->consumed = $data->consumed;
$newTask->assignedTo = $this->getNextUser($teams, $task->assignedTo);
$newTask->assignedDate = $now;
$newTask->status = 'doing';
if($task->assignedTo != $teams[count($teams) - 1] && $left == 0)
{
$newTask->assignedTo = $this->getNextUser($teams, $task->assignedTo);
$newTask->assignedDate = $now;
}
$task->status = $oldStatus;
$this->dao->update(TABLE_TASK)->data($newTask)->where('id')->eq((int)$taskID)->exec();
if($task->assignedTo != $teams[count($teams) - 1]) return common::createChanges($task, $newTask);
$data->assignedTo = $task->openedBy; // Fix bug#1345
$changes = common::createChanges($task, $newTask);
if(!empty($actionID)) $this->action->logHistory($actionID, $changes);
return $changes;
}
$data->assignedTo = $task->openedBy;
}
$this->dao->update(TABLE_TASK)->data($data)->where('id')->eq($taskID)->exec();
@@ -1343,7 +1366,7 @@ class taskModel extends model
->page($pager, 't1.id')
->fetchAll('id');
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'task', ($productID or in_array($type, array('assignedtome', 'myinvolved', 'needconfirm'))) ? false : true);
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'task', ($productID or in_array($type, array('myinvolved', 'needconfirm'))) ? false : true);
if(empty($tasks)) return array();
+2 -1
View File
@@ -12,7 +12,8 @@
?>
<?php include '../../common/view/header.lite.html.php';?>
<?php include '../../common/view/datepicker.html.php';?>
<?php js::set('confirmRecord', $lang->task->confirmRecord);?>
<?php $team = array_keys($task->team);?>
<?php js::set('confirmRecord', (!empty($team) && $task->assignedTo != end($team)) ? $lang->task->confirmTransfer : $lang->task->confirmRecord);?>
<?php js::set('noticeSaveRecord', $lang->task->noticeSaveRecord);?>
<div id='titlebar'>
<div class='heading'>