* Finish task #8077.

This commit is contained in:
tianshujie98
2020-09-30 15:43:56 +08:00
parent 9c58612f14
commit 1ef4203498
+3 -12
View File
@@ -482,25 +482,16 @@ class productplanModel extends model
$oldOrder = implode(',', $oldOrder);
$this->dao->update(TABLE_PRODUCTPLAN)->set("order")->eq($oldOrder)->where('id')->eq($story->plan)->exec();
/* Modify the plan linked with the story. */
if($this->session->currentProductType == 'normal' or $story->branch != 0 or empty($story->plan))
{
$this->dao->update(TABLE_STORY)->set("plan")->eq($planID)->where('id')->eq((int)$storyID)->exec();
}
else
{
/* Fix bug #3065. */
if($story->branch)
{
$plans = $this->dao->select('*')->from(TABLE_PRODUCTPLAN)->where('id')->in($story->plan)->fetchPairs('branch', 'id');
$plans[$plan->branch] = $planID;
}
else
{
$oldplans = $this->dao->select('id')->from(TABLE_PRODUCTPLAN)->where('id')->in($story->plan)->fetchPairs('id');
$plans = $oldplans + array($planID => $planID);
}
$plansOfStory = $story->plan . ',' . $planID;
$this->dao->update(TABLE_STORY)->set("plan")->eq(join(',', $plans))->where('id')->eq((int)$storyID)->andWhere('branch')->eq('0')->exec();
$this->dao->update(TABLE_STORY)->set("plan")->eq($plansOfStory)->where('id')->eq((int)$storyID)->andWhere('branch')->eq('0')->exec();
}
$this->action->create('story', $storyID, 'linked2plan', '', $planID);