* Add story link requierment.
This commit is contained in:
@@ -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
@@ -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();
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user