* Finish task #92300.

This commit is contained in:
Yagami
2023-05-08 19:41:41 +08:00
parent 503593149c
commit a801d347c4
3 changed files with 22 additions and 5 deletions
+7 -1
View File
@@ -3280,11 +3280,12 @@ class executionModel extends model
* @param array $products
* @param string $extra
* @param array $lanes
* @param string $storyType
*
* @access public
* @return bool
*/
public function linkStory($executionID, $stories = array(), $products = array(), $extra = '', $lanes = array())
public function linkStory($executionID, $stories = array(), $products = array(), $extra = '', $lanes = array(), $storyType = 'story')
{
if(empty($executionID)) return false;
if(empty($stories)) $stories = $this->post->stories;
@@ -3330,6 +3331,7 @@ class executionModel extends model
$action = $execution->type == 'project' ? 'linked2project' : 'linked2execution';
if($action == 'linked2execution' and $execution->type == 'kanban') $action = 'linked2kanban';
if($execution->multiple or $execution->type == 'project') $this->action->create('story', $storyID, $action, '', $executionID);
if($storyType == 'requirement' and $execution->model == 'ipd') $this->dao->update(TABLE_STORY)->set('status')->eq('developing')->where('id')->eq($storyID)->exec();
}
if(!isset($output['laneID']) or !isset($output['columnID'])) $this->kanban->updateLane($executionID, 'story');
@@ -3433,6 +3435,7 @@ class executionModel extends model
public function unlinkStory($executionID, $storyID, $laneID = 0, $columnID = 0)
{
$execution = $this->dao->findById($executionID)->from(TABLE_EXECUTION)->fetch();
$storyType = $this->dao->findById($storyID)->from(TABLE_STORY)->fetch('type');
if($execution->type == 'project')
{
$executions = $this->dao->select('*')->from(TABLE_EXECUTION)->where('parent')->eq($executionID)->fetchAll('id');
@@ -3441,6 +3444,9 @@ class executionModel extends model
}
$this->dao->delete()->from(TABLE_PROJECTSTORY)->where('project')->eq($executionID)->andWhere('story')->eq($storyID)->limit(1)->exec();
/* In ipd project, unlink stories change it's status to launched. */
if($execution->model == 'ipd' and $storyType == 'requirement') $this->dao->update(TABLE_STORY)->set('status')->eq('launched')->where('id')->eq($storyID)->exec();
/* Resolve TABLE_KANBANCELL's field cards. */
if($execution->type == 'kanban')
{