* code for unlink story and case from execution.

This commit is contained in:
wangyidong
2022-11-02 13:32:02 +08:00
parent fd56b11e41
commit e29b72fe17
+14
View File
@@ -2925,6 +2925,13 @@ class executionModel extends model
$objectType = $execution->type == 'project' ? 'unlinkedfromproject' : 'unlinkedfromexecution';
if($execution->multiple or $execution->type == 'project') $this->loadModel('action')->create('story', $storyID, $objectType, '', $executionID);
/* Sync unlink story in no multiple execution. */
if(empty($execution->multiple) and $execution->type != 'project')
{
$this->dao->delete()->from(TABLE_PROJECTSTORY)->where('project')->eq($execution->project)->andWhere('story')->eq($storyID)->limit(1)->exec();
$this->loadModel('action')->create('story', $storyID, 'unlinkedfromproject', '', $execution->project);
}
$tasks = $this->dao->select('id')->from(TABLE_TASK)->where('story')->eq($storyID)->andWhere('execution')->eq($executionID)->andWhere('status')->in('wait,doing')->fetchPairs('id');
foreach($tasks as $taskID)
{
@@ -2953,6 +2960,13 @@ class executionModel extends model
$this->dao->delete()->from(TABLE_PROJECTCASE)->where('project')->eq($executionID)->andWhere('`case`')->eq($caseID)->limit(1)->exec();
$action = $execution->type == 'project' ? 'unlinkedfromproject' : 'unlinkedfromexecution';
if($execution->multiple or $execution->type == 'project') $this->action->create('case', $caseID, $action, '', $executionID);
/* Sync unlink case in no multiple execution. */
if(empty($execution->multiple) and $execution->type != 'project')
{
$this->dao->delete()->from(TABLE_PROJECTCASE)->where('project')->eq($execution->project)->andWhere('`case`')->eq($caseID)->limit(1)->exec();
$this->loadModel('action')->create('case', $caseID, 'unlinkedfromproject', '', $execution->project);
}
}
$order = 1;