* fix bug #13954.
This commit is contained in:
@@ -1370,13 +1370,7 @@ class execution extends control
|
||||
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$oldPlans = $this->dao->select('plan')->from(TABLE_PROJECTPRODUCT)->where('project')->eq($executionID)->andWhere('plan')->ne(0)->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');
|
||||
|
||||
$oldPlans = $this->dao->select('plan')->from(TABLE_PROJECTPRODUCT)->where('project')->eq($executionID)->andWhere('plan')->ne(0)->fetchPairs('plan');
|
||||
$oldProducts = $this->execution->getProducts($executionID);
|
||||
$changes = $this->execution->update($executionID);
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
@@ -1410,7 +1404,7 @@ class execution extends control
|
||||
if(!empty($newPlans) 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($executionID, $_POST['plans']);
|
||||
$this->productplan->linkProject($projectID, $_POST['plans']);
|
||||
}
|
||||
|
||||
|
||||
@@ -2177,7 +2177,7 @@ class executionModel extends model
|
||||
$data->story = $storyID;
|
||||
$data->version = $versions[$storyID];
|
||||
$data->order = ++$lastOrder;
|
||||
$this->dao->insert(TABLE_PROJECTSTORY)->data($data)->exec();
|
||||
$this->dao->replace(TABLE_PROJECTSTORY)->data($data)->exec();
|
||||
|
||||
$this->story->setStage($storyID);
|
||||
$this->linkCases($executionID, (int)$products[$storyID], $storyID);
|
||||
|
||||
@@ -582,14 +582,11 @@ class productplanModel extends model
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param array $newPlans
|
||||
* @param array $oldPlanStories
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function linkProject($projectID, $newPlans, $oldPlanStories = '')
|
||||
public function linkProject($projectID, $newPlans)
|
||||
{
|
||||
if(!empty($oldPlanStories)) $this->dao->delete()->from(TABLE_PROJECTSTORY)->where('project')->eq($projectID)->andWhere('story')->in(array_keys($oldPlanStories))->exec();
|
||||
|
||||
$this->loadModel('execution');
|
||||
foreach($newPlans as $planID)
|
||||
{
|
||||
|
||||
@@ -78,7 +78,7 @@ class project extends control
|
||||
$project->product = zget($projectLang->productList, $project->product);
|
||||
$project->budget = $project->budget . zget($projectLang->unitList, $project->budgetUnit);
|
||||
$project->parent = $project->parentName;
|
||||
|
||||
|
||||
$linkedProducts = $this->project->getProducts($project->id, false);
|
||||
$project->linkedProducts = implode(',', $linkedProducts);
|
||||
|
||||
@@ -414,12 +414,7 @@ class project extends control
|
||||
|
||||
if($_POST)
|
||||
{
|
||||
$oldPlans = $this->dao->select('plan')->from(TABLE_PROJECTPRODUCT)->where('project')->eq($projectID)->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($projectID)
|
||||
->andWhere('t2.plan')->in(array_keys($oldPlans))
|
||||
->fetchAll('story');
|
||||
$oldPlans = $this->dao->select('plan')->from(TABLE_PROJECTPRODUCT)->where('project')->eq($projectID)->andWhere('plan')->ne(0)->fetchPairs('plan');
|
||||
|
||||
$changes = $this->project->update($projectID);
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
@@ -434,7 +429,7 @@ class project extends control
|
||||
$diffResult = array_diff($oldPlans, $_POST['plans']);
|
||||
if(!empty($_POST['plans']) and !empty($diffResult))
|
||||
{
|
||||
$this->loadModel('productplan')->linkProject($projectID, $_POST['plans'], $oldPlanStories);
|
||||
$this->loadModel('productplan')->linkProject($projectID, $_POST['plans']);
|
||||
}
|
||||
|
||||
if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
|
||||
@@ -1618,7 +1613,7 @@ class project extends control
|
||||
$response = array();
|
||||
$response['result'] = true;
|
||||
$response['message'] = $this->lang->project->changeProgramTip;
|
||||
|
||||
|
||||
/* Get new program products. */
|
||||
$newProducts = $this->program->getProductPairs($programID, 'assign', 'noclosed');
|
||||
$response['newProducts'] = html::select("newProducts", array('0' => '') + $newProducts, '', "class='form-control chosen' onchange='loadBranches(this)'");
|
||||
|
||||
Reference in New Issue
Block a user