* Fix bug #12406.
This commit is contained in:
@@ -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")));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user