This commit is contained in:
tengfei
2017-12-05 11:26:51 +08:00
55 changed files with 184 additions and 163 deletions
+12 -17
View File
@@ -446,7 +446,8 @@ class task extends control
$this->view->title = $this->view->project->name . $this->lang->colon . $this->lang->task->assign;
$this->view->position[] = $this->lang->task->assign;
$this->view->task = $task;
$this->view->users = $members;
$this->view->members = $members;
$this->view->users = $this->loadModel('user')->getPairs();
$this->display();
}
@@ -778,17 +779,22 @@ class task extends control
$task = $this->view->task;
$members = $this->loadModel('user')->getPairs('noletter');
$this->view->users = $members;
if(!empty($task->team))
{
$task->openedBy = $this->task->getNextUser(array_keys($task->team), $task->assignedTo);
$members = $this->task->getMemberPairs($task);
$teams = array_keys($task->team);
$task->openedBy = $this->task->getNextUser($teams, $task->assignedTo);
$task->myConsumed = $this->dao->select('consumed')->from(TABLE_TEAM)->where('task')->eq($taskID)->andWhere('account')->eq($task->assignedTo)->fetch('consumed');
$lastAccount = end($teams);
if($lastAccount != $task->assignedTo) $members = $this->task->getMemberPairs($task);
}
$this->view->title = $this->view->project->name . $this->lang->colon .$this->lang->task->finish;
$this->view->position[] = $this->lang->task->finish;
$this->view->members = $members;
$this->display();
}
@@ -821,6 +827,7 @@ class task extends control
$this->view->title = $this->view->project->name . $this->lang->colon .$this->lang->task->pause;
$this->view->position[] = $this->lang->task->pause;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->display();
}
@@ -1188,9 +1195,6 @@ class task extends control
->beginIF($this->post->exportType == 'selected')->andWhere('t1.id')->in($this->cookie->checkedItem)->fi()
->orderBy($orderBy)->fetchAll('id');
$taskList = array_keys($tasks);
if(!empty($taskList)) $children = $this->dao->select('*')->from(TABLE_TASK)->where('parent')->in($taskList)->fetchGroup('parent');
foreach($tasks as $key => $task)
{
/* Compute task progress. */
@@ -1209,16 +1213,7 @@ class task extends control
$task->progress .= '%';
$tasks[$key] = $task;
if(isset($children[$task->id]))
{
foreach($children[$task->id] as $child)
{
$child->name = '[' . $taskLang->childrenAB . '] ' . $child->name;
$tasks[$child->id] = $child;
}
}
if($task->parent) $task->name = '[' . $taskLang->childrenAB . '] ' . $task->name;
}
}
else
+19 -44
View File
@@ -349,11 +349,10 @@ class taskModel extends model
$teams = array();
if($this->post->multiple)
{
$estimate = 0;
$left = 0;
foreach($this->post->team as $row => $account)
{
if(empty($account) or isset($team[$account])) continue;
$member = new stdClass();
$member->project = 0;
$member->account = $account;
@@ -365,37 +364,16 @@ class taskModel extends model
$member->left = $member->estimate - $member->consumed;
$member->order = $row;
$teams[$account] = $member;
$estimate += (float)$member->eatimate;
$left += (float)$member->left;
}
if(!empty($teams))
if(!empty($teams) and !isset($task->assignedTo))
{
$task->estimate = $estimate;
$task->left = $left;
if(!isset($task->assignedTo))
{
$firstMember = reset($teams);
$task->assignedTo = $firstMember->account;
}
$firstMember = reset($teams);
$task->assignedTo = $firstMember->account;
}
}
if($task->consumed < $oldTask->consumed)
{
die(js::error($this->lang->task->error->consumedSmall));
}
elseif($task->consumed != $oldTask->consumed or $task->left != $oldTask->left)
{
$estimate = new stdClass();
$estimate->consumed = $task->consumed - $oldTask->consumed;
$estimate->left = $task->left;
$estimate->task = $taskID;
$estimate->account = $this->app->user->account;
$estimate->date = helper::now();
$this->addTaskEstimate($estimate);
}
if($task->consumed < $oldTask->consumed) die(js::error($this->lang->task->error->consumedSmall));
$task = $this->loadModel('file')->processImgURL($task, $this->config->task->editor->edit['id'], $this->post->uid);
$this->dao->update(TABLE_TASK)->data($task)
@@ -648,8 +626,8 @@ class taskModel extends model
->cleanFloat('left')
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', $now)
->remove('comment,showModule')
->setDefault('assignedDate', $now)
->remove('comment,showModule')
->get();
$this->dao->update(TABLE_TASK)
@@ -1142,7 +1120,7 @@ class taskModel extends model
if(!empty($task->parent)) $task->parentName = $this->dao->findById($task->parent)->from(TABLE_TASK)->fetch('name');
$teams = $this->dao->select('*')->from(TABLE_TEAM)->where('task')->eq($taskID)->orderBy('order_desc')->fetchGroup('task', 'account');
foreach($teams as $key => $team) $teams[$key] = array_reverse($team);
foreach($teams as $key => $team) $teams[$key] = array_reverse($team, true);
$task->team = isset($teams[$taskID]) ? $teams[$taskID] : array();
foreach($children as $child) $child->team = isset($teams[$child->id]) ? $teams[$child->id] : array();
@@ -1229,7 +1207,6 @@ class taskModel extends model
->leftJoin(TABLE_USER)->alias('t3')->on('t1.assignedTo = t3.account')
->where('t1.project')->eq((int)$projectID)
->andWhere('t1.deleted')->eq(0)
->andWhere('t1.parent')->eq(0)
->beginIF($productID)->andWhere('t2.product')->eq((int)$productID)->fi()
->beginIF($type == 'undone')->andWhere("(t1.status = 'wait' or t1.status ='doing')")->fi()
->beginIF($type == 'needconfirm')->andWhere('t2.version > t1.storyVersion')->andWhere("t2.status = 'active'")->fi()
@@ -1238,26 +1215,24 @@ class taskModel extends model
->beginIF($type == 'delayed')->andWhere('t1.deadline')->gt('1970-1-1')->andWhere('t1.deadline')->lt(date(DT_DATE1))->andWhere('t1.status')->in('wait,doing')->fi()
->beginIF(is_array($type) or strpos(',all,undone,needconfirm,assignedtome,delayed,finishedbyme,', ",$type,") === false)->andWhere('t1.status')->in($type)->fi()
->beginIF($modules)->andWhere('t1.module')->in($modules)->fi()
->orderBy($orderBy)
->orderBy('t1.`parent`,' . $orderBy)
->page($pager)
->fetchAll('id');
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'task', ($productID or $type == 'needconfirm') ? false : true);
if(empty($tasks)) return array();
$taskList = array_keys($tasks);
if(!empty($taskList))
$taskTeam = $this->dao->select('*')->from(TABLE_TEAM)->where('task')->in($taskList)->fetchGroup('task');
foreach($taskTeam as $taskID => $team) $tasks[$taskID]->team = $team;
foreach($tasks as $taskID => $task)
{
$children = $this->dao->select('t1.*, t2.id AS storyID, t2.title AS storyTitle, t2.product, t2.branch, t2.version AS latestStoryVersion, t2.status AS storyStatus, t3.realname AS assignedToRealName')
->from(TABLE_TASK)->alias('t1')
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id')
->leftJoin(TABLE_USER)->alias('t3')->on('t1.assignedTo = t3.account')
->where('t1.parent')->in($taskList)
->andWhere('t1.deleted')->eq(0)
->orderBy('id_desc')
->fetchGroup('parent');
foreach($children as $key => $child) $tasks[$key]->children = $child;
$taskTeam = $this->dao->select('*')->from(TABLE_TEAM)->where('task')->in($taskList)->fetchGroup('task');
foreach($taskTeam as $taskID => $team) $tasks[$taskID]->team = $team;
if($task->parent and isset($tasks[$task->parent]))
{
$tasks[$task->parent]->children[] = $task;
unset($tasks[$taskID]);
}
}
if($tasks) return $this->processTasks($tasks);
@@ -2045,7 +2020,7 @@ class taskModel extends model
case 'name':
if(!empty($task->product) && isset($branchGroups[$task->product][$task->branch])) echo "<span class='label label-info label-badge'>" . $branchGroups[$task->product][$task->branch] . '</span> ';
if($task->module and isset($modulePairs[$task->module])) echo "<span class='label label-info label-badge'>" . $modulePairs[$task->module] . '</span> ';
if($child) echo '<span class="label">' . $this->lang->task->childrenAB . '</span> ';
if($child or !empty($task->parent)) echo '<span class="label">' . $this->lang->task->childrenAB . '</span> ';
if(!empty($task->team)) echo '<span class="label">' . $this->lang->task->multipleAB . '</span> ';
echo $canView ? html::a($taskLink, $task->name, null, "style='color: $task->color'") : "<span style='color: $task->color'>$task->name</span>";
if($task->fromBug) echo html::a(helper::createLink('bug', 'view', "id=$task->fromBug"), "[BUG#$task->fromBug]", '_blank', "class='bug'");
+1 -1
View File
@@ -23,7 +23,7 @@
<table class='table table-form'>
<tr>
<th class='w-80px'><?php echo empty($task->team) ? $lang->task->assign : $lang->task->transferTo;?></th>
<td class='w-p25-f'><?php echo html::select('assignedTo', $users, $task->assignedTo, "class='form-control chosen'");?></td><td></td>
<td class='w-p25-f'><?php echo html::select('assignedTo', $members, $task->assignedTo, "class='form-control chosen'");?></td><td></td>
</tr>
<tr>
<th><?php echo $lang->task->left;?></th>
+2 -2
View File
@@ -22,7 +22,7 @@
</div>
</div>
<div class='main'>
<form class='form-condensed' id="recordForm" method='post' target='hiddenwin'>
<form class='form-condensed' id="recordForm" method='post' target='hiddenwin' style='margin-top:25px'>
<table class='table table-form table-fixed'>
<?php if(count($estimates)):?>
<thead>
@@ -72,7 +72,7 @@
<td><?php echo html::input("dates[$i]", '', "class='form-control text-center form-date'");?></td>
<td><?php echo html::input("consumed[$i]", '', "class='form-control text-center' autocomplete='off'");?></td>
<td><?php echo html::input("left[$i]", '', "class='form-control text-center left' autocomplete='off'");?></td>
<td class="text-left"><?php echo html::textarea("work[$i]", '', "class='form-control' rows='2'");?></td>
<td class="text-left"><?php echo html::textarea("work[$i]", '', "class='form-control' style='height:50px;'");?></td>
<td></td>
</tr>
<?php endfor;?>
+4 -2
View File
@@ -76,6 +76,7 @@
<legend><?php echo $lang->task->legendDesc;?></legend>
<div class='article-content'><?php echo $task->desc;?></div>
</fieldset>
<?php if($project->type != 'ops'):?>
<?php if($task->fromBug != 0):?>
<fieldset>
<legend><?php echo $lang->bug->steps;?></legend>
@@ -102,7 +103,8 @@
</div>
</fieldset>
<?php endif;?>
<?php if(!empty($task->children)):?>
<?php endif;?>
<?php if(!empty($task->children)):?>
<fieldset>
<legend><?php echo $this->lang->task->children;?></legend>
<table class='table table-hover table-data table-fixed'>
@@ -147,7 +149,7 @@
<?php endforeach;?>
</table>
</fieldset>
<?php endif;?>
<?php endif;?>
<?php echo $this->fetch('file', 'printFiles', array('files' => $task->files, 'fieldset' => 'true'));?>
<?php include '../../common/view/action.html.php';?>
<div class='actions'> <?php if(!$task->deleted) echo $actionLinks;?></div>