+ add the feature of change, review.
This commit is contained in:
@@ -123,7 +123,8 @@ class story extends control
|
||||
{
|
||||
$changes = $this->story->change($storyID);
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
$files = $this->loadModel('file')->saveUpload('story', $storyID);
|
||||
$version = $this->dao->findById($storyID)->from(TABLE_STORY)->fetch('version');
|
||||
$files = $this->loadModel('file')->saveUpload('story', $storyID, $version);
|
||||
if($this->post->comment != '' or !empty($changes) or !empty($files))
|
||||
{
|
||||
$action = (!empty($changes) or !empty($files)) ? 'Changed' : 'Commented';
|
||||
@@ -170,6 +171,7 @@ class story extends control
|
||||
$this->assign('users', $users);
|
||||
$this->assign('actions', $this->action->getList('story', $storyID));
|
||||
$this->assign('modulePath', $modulePath);
|
||||
$this->assign('version', $version);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -197,10 +199,15 @@ class story extends control
|
||||
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$this->story->reivew($storyID);
|
||||
$action = "Reviewed";
|
||||
$this->story->review($storyID);
|
||||
$action = "Reviewed as " . ucfirst($this->post->result);
|
||||
$actionID = $this->action->create('story', $storyID, $action, $this->post->comment);
|
||||
$this->action->logHistory($actionID);
|
||||
if($this->post->result == 'reject')
|
||||
{
|
||||
$action = "Closed for " . ucfirst($this->post->closedReason);
|
||||
$this->action->create('story', $storyID, $action);
|
||||
}
|
||||
die(js::locate(inlink('view', "storyID=$storyID"), 'parent'));
|
||||
}
|
||||
|
||||
|
||||
@@ -32,10 +32,12 @@ $lang->story->manage = "操作";
|
||||
$lang->story->tasks = "相关任务";
|
||||
$lang->story->bugs = "Bug";
|
||||
|
||||
$lang->story->reviewDelete = "您确认删除该需求吗?";
|
||||
$lang->story->errorFormat = '需求数据有误';
|
||||
$lang->story->errorEmptyTitle = '标题不能为空';
|
||||
$lang->story->linkStory = '关联需求';
|
||||
$lang->story->reviewDelete = "您确认删除该需求吗?";
|
||||
$lang->story->errorFormat = '需求数据有误';
|
||||
$lang->story->errorEmptyTitle = '标题不能为空';
|
||||
$lang->story->mustChooseResult = '必须选择评审结果';
|
||||
$lang->story->mustChoosePreVersion = '必须选择回溯的版本';
|
||||
$lang->story->linkStory = '关联需求';
|
||||
$lang->story->ajaxGetProjectStories = '接口:获取项目需求列表';
|
||||
$lang->story->ajaxGetProductStories = '接口:获取产品需求列表';
|
||||
|
||||
@@ -123,3 +125,4 @@ $lang->story->linkStories = '相关需求';
|
||||
$lang->story->childStories = '细分需求';
|
||||
$lang->story->duplicateStory = '重复需求';
|
||||
$lang->story->reviewResult = '评审结果';
|
||||
$lang->story->preVersion = '之前版本';
|
||||
|
||||
@@ -32,7 +32,9 @@ class storyModel extends model
|
||||
if(!$story) return false;
|
||||
if(substr($story->closedDate, 0, 4) == '0000') $story->closedDate = '';
|
||||
if($version == 0) $version = $story->version;
|
||||
$story->spec = $this->dao->select('spec')->from(TABLE_STORYSPEC)->where('story')->eq($storyID)->andWhere('version')->eq($version)->fetch('spec');
|
||||
$spec = $this->dao->select('title,spec')->from(TABLE_STORYSPEC)->where('story')->eq($storyID)->andWhere('version')->eq($version)->fetch();
|
||||
$story->title = $spec->title;
|
||||
$story->spec = $spec->spec;
|
||||
$story->projects = $this->dao->select('t1.project, t2.name')
|
||||
->from(TABLE_PROJECTSTORY)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')
|
||||
@@ -76,9 +78,13 @@ class storyModel extends model
|
||||
if(!dao::isError())
|
||||
{
|
||||
$storyID = $this->dao->lastInsertID();
|
||||
$this->loadModel('file')->saveUpload('story', $storyID);
|
||||
$this->loadModel('file')->saveUpload('story', $storyID, $extra = 1);
|
||||
$spec = htmlspecialchars($this->post->spec);
|
||||
$this->dao->insert(TABLE_STORYSPEC)->set('story')->eq($storyID)->set('version')->eq(1)->set('spec')->eq($spec)->exec();
|
||||
$this->dao->insert(TABLE_STORYSPEC)
|
||||
->set('story')->eq($storyID)
|
||||
->set('version')->eq(1)
|
||||
->set('title')->eq($story->title)
|
||||
->set('spec')->eq($spec)->exec();
|
||||
return $storyID;
|
||||
}
|
||||
return false;
|
||||
@@ -106,7 +112,6 @@ class storyModel extends model
|
||||
->setIF($specChanged and $oldStory->closedBy, 'closedDate', '')
|
||||
->remove('files,labels,spec,comment')
|
||||
->get();
|
||||
|
||||
$this->dao->update(TABLE_STORY)
|
||||
->data($story)
|
||||
->autoCheck()
|
||||
@@ -117,7 +122,12 @@ class storyModel extends model
|
||||
if($specChanged)
|
||||
{
|
||||
$spec = htmlspecialchars($this->post->spec);
|
||||
$this->dao->insert(TABLE_STORYSPEC)->set('story')->eq($storyID)->set('version')->eq($oldStory->version + 1)->set('spec')->eq($spec)->exec();
|
||||
$this->dao->insert(TABLE_STORYSPEC)
|
||||
->set('story')->eq($storyID)
|
||||
->set('version')->eq($oldStory->version + 1)
|
||||
->set('title')->eq($story->title)
|
||||
->set('spec')->eq($spec)
|
||||
->exec();
|
||||
$story->spec = $this->post->spec;
|
||||
}
|
||||
else
|
||||
@@ -172,12 +182,40 @@ class storyModel extends model
|
||||
/* 评审需求。*/
|
||||
public function review($storyID)
|
||||
{
|
||||
if($this->post->result == false) die(js::alert($this->lang->story->mustChooseResult));
|
||||
if($this->post->result == 'revert' and $this->post->preVersion == false) die(js::alert($this->lang->story->mustChoosePreVersion));
|
||||
|
||||
$oldStory = $this->dao->findById($storyID)->from(TABLE_STORY)->fetch();
|
||||
$story->confirmedBy = $this->app->user->account;
|
||||
$story->confirmedDate = date('Y-m-d H:i:s');
|
||||
$story->status = 'active';
|
||||
if($oldStory->status == 'changed') $story->version = $oldStory->version + 1;
|
||||
$this->dao->update(TABLE_STORY)->data($story)->where('id')->eq($storyID)->exec();
|
||||
$now = date('Y-m-d H:i:s');
|
||||
$story = fixer::input('post')
|
||||
->remove('result,preVersion,comment')
|
||||
->add('reviewedDate', $now)
|
||||
->add('lastEditedBy', $this->app->user->account)
|
||||
->add('lastEditedDate', $now)
|
||||
->setIF($this->post->result == 'pass' and $oldStory->status == 'draft', 'status', 'active')
|
||||
->setIF($this->post->result == 'pass' and $oldStory->status == 'changed', 'status', 'active')
|
||||
->setIF($this->post->result == 'reject', 'closedBy', $this->app->user->account)
|
||||
->setIF($this->post->result == 'reject', 'closedDate', $now)
|
||||
->setIF($this->post->result == 'reject', 'status', 'closed')
|
||||
->setIF($this->post->result == 'revert', 'version', $this->post->preVersion)
|
||||
->setIF($this->post->result == 'revert', 'status', 'active')
|
||||
->removeIF($this->post->result == 'pass' or $this->post->result == 'revert', 'closedReason, duplicateStory, childStories')
|
||||
->removeIF($this->post->result == 'reject' and $this->post->closedReason != 'duplicate', 'duplicateStory')
|
||||
->removeIF($this->post->result == 'reject' and $this->post->closedReason != 'subdivided', 'childStories')
|
||||
->get();
|
||||
$this->dao->update(TABLE_STORY)->data($story)
|
||||
->autoCheck()
|
||||
->batchCheck('assignedTo, reviewedBy', 'notempty')
|
||||
->checkIF($this->post->result == 'reject' and $this->post->closedReason == 'duplicate', 'duplicateStory', 'notempty')
|
||||
->checkIF($this->post->result == 'reject' and $this->post->closedReason == 'subdivided', 'childStories', 'notempty')
|
||||
->where('id')->eq($storyID)->exec();
|
||||
if($this->post->result == 'revert')
|
||||
{
|
||||
$preTitle = $this->dao->select('title')->from(TABLE_STORYSPEC)->where('story')->eq($storyID)->andWHere('version')->eq($this->post->preVersion)->fetch('title');
|
||||
$this->dao->update(TABLE_STORY)->set('title')->eq($preTitle)->where('id')->eq($storyID)->exec();
|
||||
$this->dao->delete()->from(TABLE_STORYSPEC)->where('story')->eq($storyID)->andWHere('version')->eq($oldStory->version)->exec();
|
||||
$this->dao->delete()->from(TABLE_FILE)->where('objectType')->eq('story')->andWhere('objectID')->eq($storyID)->andWhere('extra')->eq($oldStory->version)->exec();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,15 +24,46 @@
|
||||
?>
|
||||
<?php include './header.html.php';?>
|
||||
<script language='Javascript'>
|
||||
function setClosedReason(result)
|
||||
function switchShow(result)
|
||||
{
|
||||
if(result == 'reject')
|
||||
{
|
||||
$('#closedReasonBox').show();
|
||||
$('#preVersionBox').hide();
|
||||
}
|
||||
else if(result == 'revert')
|
||||
{
|
||||
$('#preVersionBox').show();
|
||||
$('#closedReasonBox').hide();
|
||||
$('#duplicateStoryBox').hide();
|
||||
$('#childStoriesBox').hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#preVersionBox').hide();
|
||||
$('#closedReasonBox').hide();
|
||||
$('#duplicateStoryBox').hide();
|
||||
$('#childStoriesBox').hide();
|
||||
$('#closedReasonBox').hide();
|
||||
}
|
||||
}
|
||||
|
||||
function setStory(reason)
|
||||
{
|
||||
if(reason == 'duplicate')
|
||||
{
|
||||
$('#duplicateStoryBox').show();
|
||||
$('#childStoriesBox').hide();
|
||||
}
|
||||
else if(reason == 'subdivided')
|
||||
{
|
||||
$('#duplicateStoryBox').hide();
|
||||
$('#childStoriesBox').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#duplicateStoryBox').hide();
|
||||
$('#childStoriesBox').hide();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -42,15 +73,29 @@ function setClosedReason(result)
|
||||
<caption><?php echo $story->title;?></caption>
|
||||
<tr>
|
||||
<th class='w-100px rowhead'><?php echo $lang->story->reviewResult;?></th>
|
||||
<td><?php echo html::select('result', $lang->story->reviewResultList, '', 'class=select-3 onchange="setClosedReason(this.value)"');?></td>
|
||||
<td><?php echo html::select('result', $lang->story->reviewResultList, '', 'class=select-3 onchange="switchShow(this.value)"');?></td>
|
||||
</tr>
|
||||
<tr id='closedReasonBox' class='hidden'>
|
||||
<th class='rowhead'><?php echo $lang->story->closedReason;?></th>
|
||||
<td><?php echo html::select('closedReason', $lang->story->reasonList, '', 'class=select-3');?></td>
|
||||
<td><?php echo html::select('closedReason', $lang->story->reasonList, '', 'class=select-3 onchange="setStory(this.value)"');?></td>
|
||||
</tr>
|
||||
<tr id='duplicateStoryBox' class='hidden'>
|
||||
<th class='rowhead'><?php echo $lang->story->duplicateStory;?></th>
|
||||
<td><?php echo html::input('duplicateStory', '', 'class=text-3');?></td>
|
||||
</tr>
|
||||
<tr id='childStoriesBox' class='hidden'>
|
||||
<th class='rowhead'><?php echo $lang->story->childStories;?></th>
|
||||
<td><?php echo html::input('childStories', '', 'class=text-3');?></td>
|
||||
</tr>
|
||||
<?php if($story->status == 'changed'):?>
|
||||
<tr id='preVersionBox' class='hidden'>
|
||||
<th class='rowhead'><?php echo $lang->story->preVersion;?></th>
|
||||
<td><?php echo html::radio('preVersion', array_combine(range($story->version - 1, 1), range($story->version - 1, 1)), $story->version - 1);?></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->story->assignedTo;?></th>
|
||||
<td><?php echo html::select('assignedTo', $users, $story->openedBy, 'class=select-3');?></td>
|
||||
<td><?php echo html::select('assignedTo', $users, $story->lastEditedBy ? $story->lastEditedBy : $story->openedBy, 'class=select-3');?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->story->reviewedBy;?></th>
|
||||
|
||||
@@ -30,10 +30,10 @@
|
||||
<div>
|
||||
<?php
|
||||
$browseLink = $app->session->storyList != false ? $app->session->storyList : $this->createLink('product', 'browse', "productID=$story->product&moduleID=$story->module");
|
||||
common::printLink('story', 'change', "storyID=$story->id", $lang->story->change);
|
||||
if($story->status == 'draft' or $story->status == 'changed') common::printLink('story', 'review', "storyID=$story->id", $lang->story->review); else echo $lang->story->review . ' ';
|
||||
common::printLink('story', 'close', "storyID=$story->id", $lang->close);
|
||||
common::printLink('story', 'edit', "storyID=$story->id", $lang->edit);
|
||||
if(!($story->status != 'closed' and common::printLink('story', 'change', "storyID=$story->id", $lang->story->change))) echo $lang->story->change . ' ';
|
||||
if(!(($story->status == 'draft' or $story->status == 'changed') and common::printLink('story', 'review', "storyID=$story->id", $lang->story->review))) echo $lang->story->review . ' ';
|
||||
if(!($story->status != 'closed' and common::printLink('story', 'close', "storyID=$story->id", $lang->story->close))) echo $lang->story->close . ' ';
|
||||
if(!common::printLink('story', 'edit', "storyID=$story->id", $lang->edit)) echo $lang->edit . ' ';
|
||||
echo html::a($browseLink, $lang->goback);
|
||||
?>
|
||||
</div>
|
||||
@@ -49,14 +49,15 @@
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang->story->legendAttatch;?></legend>
|
||||
<div><?php foreach($story->files as $file) echo html::a($file->fullPath, $file->title, '_blank');?></div>
|
||||
<div><?php foreach($story->files as $file) if($file->extra <= $version) echo html::a($file->fullPath, $file->title, '_blank');?></div>
|
||||
</fieldset>
|
||||
<?php include '../../common/action.html.php';?>
|
||||
<div class='a-center' style='font-size:16px; font-weight:bold'>
|
||||
<?php
|
||||
common::printLink('story', 'edit', "storyID=$story->id", $lang->edit);
|
||||
common::printLink('story', 'review', "storyID=$story->id", $lang->story->review);
|
||||
common::printLink('story', 'close', "storyID=$story->id", $lang->story->close);
|
||||
if(!($story->status != 'closed' and common::printLink('story', 'change', "storyID=$story->id", $lang->story->change))) echo $lang->story->change . ' ';
|
||||
if(!(($story->status == 'draft' or $story->status == 'changed') and common::printLink('story', 'review', "storyID=$story->id", $lang->story->review))) echo $lang->story->review . ' ';
|
||||
if(!($story->status != 'closed' and common::printLink('story', 'close', "storyID=$story->id", $lang->story->close))) echo $lang->story->close . ' ';
|
||||
if(!common::printLink('story', 'edit', "storyID=$story->id", $lang->edit)) echo $lang->edit . ' ';
|
||||
echo html::a($browseLink, $lang->goback);
|
||||
?>
|
||||
</div>
|
||||
@@ -112,6 +113,10 @@
|
||||
<td class='rowhead'><?php echo $lang->story->reviewedBy;?></td>
|
||||
<td><?php $reviewedBy = explode(',', $story->reviewedBy); foreach($reviewedBy as $account) echo ' ' . $users[trim($account)]; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='rowhead'><?php echo $lang->story->reviewedDate;?></td>
|
||||
<td><?php if($story->reviewedBy) echo $story->reviewedDate;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='rowhead'><?php echo $lang->story->closedBy;?></td>
|
||||
<td><?php if($story->closedBy) echo $users[$story->closedBy] . $lang->at . $story->closedDate;?></td>
|
||||
|
||||
Reference in New Issue
Block a user