* fix the bug when import tasks.

This commit is contained in:
wangchunsheng
2010-11-24 14:04:18 +00:00
parent e9e28f418d
commit a9f7e2f05d
11 changed files with 57 additions and 37 deletions

View File

@@ -7,14 +7,14 @@ $config->task->complete->requiredFields = $config->task->start->requiredFields;
$config->task->search['module'] = 'task';
$config->task->search['fields']['name'] = $lang->task->name;
$config->task->search['fields']['owner'] = $lang->task->owner;
$config->task->search['fields']['assignedTo'] = $lang->task->assignedTo;
$config->task->search['fields']['id'] = $lang->task->id;
$config->task->search['fields']['status'] = $lang->task->status;
$config->task->search['fields']['pri'] = $lang->task->pri;
$config->task->search['fields']['type'] = $lang->task->type;
$config->task->search['params']['name'] = array('operator' => 'include', 'control' => 'input', 'values' => '');
$config->task->search['params']['owner'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
$config->task->search['params']['assignedTo'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
$config->task->search['params']['status'] = array('operator' => '=', 'control' => 'select', 'values' => $lang->task->statusList);
$config->task->search['params']['pri'] = array('operator' => '=', 'control' => 'select', 'values' => $lang->task->priList);
$config->task->search['params']['type'] = array('operator' => '=', 'control' => 'select', 'values' => $lang->task->typeList);

View File

@@ -140,7 +140,7 @@ class task extends control
$this->view->header->title = $this->lang->task->edit;
$this->view->position[] = $this->lang->task->edit;
$this->view->stories = $this->story->getProjectStoryPairs($this->view->project->id);
$this->view->members = $this->loadModel('user')->appendDeleted($this->view->members, $this->view->task->owner);
$this->view->members = $this->loadModel('user')->appendDeleted($this->view->members, $this->view->task->assignedTo);
$this->display();
}
@@ -323,7 +323,7 @@ class task extends control
{
/* Set toList and ccList. */
$task = $this->task->getByID($taskID);
$toList = $task->owner;
$toList = $task->assignedTo;
$ccList = trim($task->mailto, ',');
if($toList == '')

View File

@@ -31,7 +31,6 @@ $lang->task->storyVersion = 'Version';
$lang->task->name = 'Name';
$lang->task->type = 'Type';
$lang->task->pri = 'Pri';
$lang->task->owner = 'Owner';
$lang->task->mailto = 'Mailto';
$lang->task->estimate = 'Estimate';
$lang->task->estimateAB = 'Estimate';
@@ -42,8 +41,19 @@ $lang->task->consumedAB = 'Consumed';
$lang->task->deadline = 'Deadline';
$lang->task->deadlineAB = 'Deadline';
$lang->task->status = 'Status';
$lang->task->desc = 'Desc';
$lang->task->statusCustom = 'Status Order';
$lang->task->desc = 'Desc';
$lang->task->assignedTo = 'Assigned To';
$lang->task->assignedDate = 'Assigned Date';
$lang->task->openedBy = 'Opened By';
$lang->task->openedDate = 'Opened Date';
$lang->task->finishedBy = 'Finished By';
$lang->task->finishedDate = 'Finished Date';
$lang->task->canceledBy = 'Canceled By';
$lang->task->canceledDate = 'Canceled Date';
$lang->task->closedBy = 'Closed By';
$lang->task->closedDate = 'Closed Date';
$lang->task->lasteEdited = 'Last Edited';
$lang->task->statusList['wait'] = 'Waiting';
$lang->task->statusList['doing'] = 'Doing';

View File

@@ -31,7 +31,6 @@ $lang->task->storyVersion = '需求版本';
$lang->task->name = '任务名称';
$lang->task->type = '任务类型';
$lang->task->pri = '优先级';
$lang->task->owner = '指派给';
$lang->task->mailto = '抄送给';
$lang->task->estimate = '最初预计';
$lang->task->estimateAB = '预计';
@@ -42,8 +41,19 @@ $lang->task->consumedAB = '消耗';
$lang->task->deadline = '截止日期';
$lang->task->deadlineAB = '截止';
$lang->task->status = '任务状态';
$lang->task->desc = '任务描述';
$lang->task->statusCustom = '状态排序';
$lang->task->desc = '任务描述';
$lang->task->assignedTo = '指派给';
$lang->task->assignedDate = '指派日期';
$lang->task->openedBy = '由谁创建';
$lang->task->openedDate = '创建日期';
$lang->task->finishedBy = '由谁完成';
$lang->task->finishedDate = '完成时间';
$lang->task->canceledBy = '由谁取消';
$lang->task->canceledDate = '取消时间';
$lang->task->closedBy = '由谁关闭';
$lang->task->closedDate = '关闭时间';
$lang->task->lasteEdited = '最后编辑';
$lang->task->statusList['wait'] = '未开始';
$lang->task->statusList['doing'] = '进行中';

View File

@@ -25,7 +25,7 @@ class taskModel extends model
public function create($projectID)
{
$tasksID = array();
foreach($this->post->owner as $owner)
foreach($this->post->assignedTo as $assignedTo)
{
$task = fixer::input('post')
->striptags('name')
@@ -33,7 +33,7 @@ class taskModel extends model
->setDefault('estimate, left, story', 0)
->setDefault('deadline', '0000-00-00')
->setIF($this->post->estimate != false, 'left', $this->post->estimate)
->setForce('owner', $owner)
->setForce('assignedTo', $assignedTo)
->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story))
->setDefault('statusCustom', strpos(self::CUSTOM_STATUS_ORDER, $this->post->status) + 1)
->remove('after,files,labels')
@@ -49,7 +49,7 @@ class taskModel extends model
$taskID = $this->dao->lastInsertID();
if($this->post->story) $this->loadModel('story')->setStage($this->post->story);
$this->loadModel('file')->saveUpload('task', $taskID);
$tasksID[$owner] = $taskID;
$tasksID[$assignedTo] = $taskID;
}
else return false;
}
@@ -127,12 +127,12 @@ class taskModel extends model
*/
public function getById($taskID)
{
$task = $this->dao->select('t1.*, t2.id AS storyID, t2.title AS storyTitle, t2.version AS latestStoryVersion, t2.status AS storyStatus, t3.realname AS ownerRealName')
$task = $this->dao->select('t1.*, t2.id AS storyID, t2.title AS storyTitle, 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.owner = t3.account')
->on('t1.assignedTo = t3.account')
->where('t1.id')->eq((int)$taskID)
->fetch();
if(!$task) return false;
@@ -160,10 +160,10 @@ class taskModel extends model
public function getProjectTasks($projectID, $status = 'all', $orderBy = 'status_asc, id_desc', $pager = null)
{
$orderBy = str_replace('status', 'statusCustom', $orderBy);
$tasks = $this->dao->select('t1.*, t2.id AS storyID, t2.title AS storyTitle, t2.version AS latestStoryVersion, t2.status AS storyStatus, t3.realname AS ownerRealName')
$tasks = $this->dao->select('t1.*, t2.id AS storyID, t2.title AS storyTitle, 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.owner = t3.account')
->leftJoin(TABLE_USER)->alias('t3')->on('t1.assignedTo = t3.account')
->where('t1.project')->eq((int)$projectID)
->andWhere('t1.deleted')->eq(0)
->beginIF($status == 'needConfirm')->andWhere('t2.version > t1.storyVersion')->andWhere("t2.status = 'active'")->fi()
@@ -187,15 +187,15 @@ class taskModel extends model
public function getProjectTaskPairs($projectID, $status = 'all', $orderBy = 'id_desc')
{
$tasks = array('' => '');
$stmt = $this->dao->select('t1.id, t1.name, t2.realname AS ownerRealName')
$stmt = $this->dao->select('t1.id, t1.name, t2.realname AS assignedToRealName')
->from(TABLE_TASK)->alias('t1')
->leftJoin(TABLE_USER)->alias('t2')->on('t1.owner = t2.account')
->leftJoin(TABLE_USER)->alias('t2')->on('t1.assignedTo = t2.account')
->where('t1.project')->eq((int)$projectID)
->andWhere('t1.deleted')->eq(0)
->beginIF($status != 'all')->andWhere('t1.status')->in($status)->fi()
->orderBy($orderBy)
->query();
while($task = $stmt->fetch()) $tasks[$task->id] = "$task->id:$task->ownerRealName:$task->name";
while($task = $stmt->fetch()) $tasks[$task->id] = "$task->id:$task->assignedToRealName:$task->name";
return $tasks;
}
@@ -215,7 +215,7 @@ class taskModel extends model
->on('t1.project = t2.id')
->leftjoin(TABLE_STORY)->alias('t3')
->on('t1.story = t3.id')
->where('t1.owner')->eq($account)
->where('t1.assignedTo')->eq($account)
->andWhere('t1.deleted')->eq(0)
->beginIF($status != 'all')->andWhere('t1.status')->in($status)->fi()
->fetchAll();
@@ -237,7 +237,7 @@ class taskModel extends model
$sql = $this->dao->select('t1.id, t1.name, t2.name as project')
->from(TABLE_TASK)->alias('t1')
->leftjoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
->where('t1.owner')->eq($account)
->where('t1.assignedTo')->eq($account)
->andWhere('t1.deleted')->eq(0);
if($status != 'all') $sql->andwhere('t1.status')->in($status);
$stmt = $sql->query();

View File

@@ -17,13 +17,13 @@
<tr>
<th><?php echo $lang->task->id;?></th>
<th><?php echo $lang->task->name;?></th>
<th><?php echo $lang->task->owner;?></th>
<th><?php echo $lang->task->assignedTo;?></th>
</tr>
<?php foreach($tasks as $task):?>
<tr>
<td><?php echo $task->id;?></td>
<td><?php echo $task->name;?></td>
<td><?php echo $task->owner;?></td>
<td><?php echo $task->assignedTo;?></td>
</tr>
<?php endforeach;?>
</table>

View File

@@ -24,18 +24,18 @@ function copyStoryTitle()
$('#name').attr('value', storyTitle);
}
/* Set the owners field. */
/* Set the assignedTos field. */
function setOwners(result)
{
if(result == 'affair')
{
$('#owner').attr('size', 4);
$('#owner').attr('multiple', 'multiple');
$('#assignedTo').attr('size', 4);
$('#assignedTo').attr('multiple', 'multiple');
}
else
{
$('#owner').removeAttr('size');
$('#owner').removeAttr('multiple');
$('#assignedTo').removeAttr('size');
$('#assignedTo').removeAttr('multiple');
}
}
@@ -90,8 +90,8 @@ $(document).ready(function()
<td><?php echo html::select('status', $lang->task->statusList, 'wait', 'class=select-3');?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->task->owner;?></th>
<td><?php echo html::select('owner[]', $members, '', 'class=select-3');?></td>
<th class='rowhead'><?php echo $lang->task->assignedTo;?></th>
<td><?php echo html::select('assignedTo[]', $members, '', 'class=select-3');?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->task->mailto;?></th>

View File

@@ -74,8 +74,8 @@ $(function() {
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->task->owner;?></th>
<td><?php echo html::select('owner', $members, $task->owner, 'class=select-1');?>
<th class='rowhead'><?php echo $lang->task->assignedTo;?></th>
<td><?php echo html::select('assignedTo', $members, $task->assignedTo, 'class=select-1');?>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->task->type;?></th>

View File

@@ -18,7 +18,7 @@
<th><?php echo $lang->task->id;?></th>
<th><?php echo $lang->task->pri;?></th>
<th><?php echo $lang->task->name;?></th>
<th><?php echo $lang->task->owner;?></th>
<th><?php echo $lang->task->assignedTo;?></th>
<th><?php echo $lang->task->estimate;?></th>
<th><?php echo $lang->task->consumed;?></th>
<th><?php echo $lang->task->left;?></th>
@@ -30,12 +30,12 @@
</thead>
<tbody>
<?php foreach($tasks as $task):?>
<?php $class = $task->owner == $app->user->account ? 'style=color:red' : '';?>
<?php $class = $task->assignedTo == $app->user->account ? 'style=color:red' : '';?>
<tr class='a-center'>
<td><?php if(common::hasPriv('task', 'view')) echo html::a($this->createLink('task', 'view', "task=$task->id"), sprintf('%03d', $task->id)); else printf('%03d', $task->id);?></td>
<td><?php echo $task->pri;?></td>
<td class='a-left nobr'><?php echo $task->name;?></td>
<td <?php echo $class;?>><?php echo $task->ownerRealName;?></td>
<td <?php echo $class;?>><?php echo $task->assignedToRealName;?></td>
<td><?php echo $task->estimate;?></td>
<td><?php echo $task->consumed;?></td>
<td><?php echo $task->left;?></td>

View File

@@ -13,7 +13,7 @@
<table width='98%' align='center'>
<tr class='header'>
<td>
TASK #<?php echo $task->id . "=>$task->owner " . html::a(common::getSysURL() . $this->createLink('task', 'view', "taskID=$task->id"), $task->name);?>
TASK #<?php echo $task->id . "=>$task->assignedTo " . html::a(common::getSysURL() . $this->createLink('task', 'view', "taskID=$task->id"), $task->name);?>
</td>
</tr>
<tr>

View File

@@ -88,8 +88,8 @@
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->task->owner;?></th>
<td><?php echo $task->ownerRealName;?>
<th class='rowhead'><?php echo $lang->task->assignedTo;?></th>
<td><?php echo $task->assignedToRealName;?>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->task->type;?></th>