From 1ef42034985b9afbf6efa06ad66ca4ca5a97d92a Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Wed, 30 Sep 2020 15:43:26 +0800 Subject: [PATCH] * Finish task #8077. --- module/productplan/model.php | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/module/productplan/model.php b/module/productplan/model.php index 68ee0f9613..130b7d0018 100644 --- a/module/productplan/model.php +++ b/module/productplan/model.php @@ -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);