This commit is contained in:
holan20180123
2021-04-27 10:54:34 +08:00
parent 2d921f8262
commit 7535cfe35f
3 changed files with 53 additions and 20 deletions
+17
View File
@@ -1361,6 +1361,13 @@ class execution extends control
if(!empty($_POST))
{
$oldPlans = $this->dao->select('plan')->from(TABLE_PROJECTPRODUCT)->where('project')->eq($executionID)->fetchPairs('plan');
$oldPlanStories = $this->dao->select('t1.story')->from(TABLE_PROJECTSTORY)->alias('t1')
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t2')->on('t1.project=t2.project')
->where('t1.project')->eq($executionID)
->andWhere('t2.plan')->in(array_keys($oldPlans))
->fetchAll('story');
$oldProducts = $this->execution->getProducts($executionID);
$changes = $this->execution->update($executionID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
@@ -1386,6 +1393,16 @@ class execution extends control
$actionID = $this->loadModel('action')->create($this->objectType, $executionID, 'edited', '', $products);
$this->action->logHistory($actionID, $changes);
}
/* Link the plan stories. */
$diffResult = array_diff($oldPlans, $_POST['plans']);
if(!empty($_POST['plans']) and !empty($diffResult))
{
$projectID = $this->dao->select('project')->from(TABLE_EXECUTION)->where('id')->eq($executionID)->fetch('project');
$this->loadModel('productplan')->linkProject($executionID, $_POST['plans'], $oldPlanStories);
$this->loadModel('productplan')->linkProject($projectID, $_POST['plans']);
}
$this->executeHooks($executionID);
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "executionID=$executionID")));
}