* Add story link requierment.

This commit is contained in:
Yagami
2020-09-25 10:19:49 +08:00
parent d47a6cfae8
commit 6145f558ba
3 changed files with 55 additions and 1 deletions
+1
View File
@@ -275,6 +275,7 @@ class story extends control
$this->view->verify = $verify;
$this->view->keywords = $keywords;
$this->view->mailto = $mailto;
$this->view->URS = $type == 'story' ? $this->story->getRequierements($productID) : '';
$this->view->needReview = ($this->app->user->account == $product->PO || $projectID > 0 || $this->config->story->needReview == 0) ? "checked='checked'" : "";
$this->view->type = $type;
+48 -1
View File
@@ -155,6 +155,23 @@ class storyModel extends model
return $story;
}
/**
* Get requirements for story.
*
* @param int $productID
* @access public
* @return void
*/
public function getRequierements($productID)
{
return $this->dao->select('id,title')->from(TABLE_STORY)
->where('deleted')->eq(0)
->andWhere('status')->ne('draft')
->andWhere('product')->eq($productID)
->andWhere('type')->eq('requirement')
->fetchPairs();
}
/**
* Create a story.
@@ -183,7 +200,7 @@ class storyModel extends model
->setIF($bugID > 0, 'fromBug', $bugID)
->join('mailto', ',')
->stripTags($this->config->story->editor->create['id'], $this->config->allowedTags)
->remove('files,labels,needNotReview,newStory,uid,contactListMenu')
->remove('files,labels,needNotReview,newStory,uid,contactListMenu,URS')
->get();
/* Check repeat story. */
@@ -232,6 +249,36 @@ class storyModel extends model
->exec();
}
if(is_array($this->post->URS))
{
foreach($this->post->URS as $URID)
{
$requirement = $this->getByID($URID);
$data = new stdclass();
$data->product = $story->product;
$data->AType = 'requirement';
$data->relation = 'subdivideinto';
$data->BType = 'story';
$data->AID = $URID;
$data->BID = $storyID;
$data->AVersion = $requirement->version;
$data->BVersion = 1;
$data->extra = 1;
$this->dao->insert(TABLE_RELATION)->data($data)->autoCheck()->exec();
$data->AType = 'story';
$data->relation = 'subdividedfrom';
$data->BType = 'requirement';
$data->AID = $storyID;
$data->BID = $URID;
$data->AVersion = 1;
$data->BVersion = $requirement->version;
$this->dao->insert(TABLE_RELATION)->data($data)->autoCheck()->exec();
}
}
if($bugID > 0)
{
$bug = new stdclass();
+6
View File
@@ -116,6 +116,12 @@
<?php endif;?>
<?php endif;?>
</tr>
<?php if($type == 'story'):?>
<tr>
<th><?php echo $lang->story->requirement;?></th>
<td colspan=2><?php echo html::select('URS[]', $URS, '', "class='form-control chosen' multiple");?></td>
</tr>
<?php endif;?>
<tr>
<th><?php echo $lang->story->title;?></th>
<td colspan="4">