From 0071e61933d252e5a2f5b8b953450c4ebc4c5aa7 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Mon, 28 Sep 2020 14:43:45 +0800 Subject: [PATCH] * Modify the logic of the batch change plan. --- module/story/model.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/module/story/model.php b/module/story/model.php index 9af1ffa7ba..0a3efd5de5 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -1298,14 +1298,18 @@ class storyModel extends model if(empty($story->branch)) $story->plan .= ",$planID"; } /* Fix bug #3529. */ - if($planID and $this->session->currentProductType != 'normal' and $oldStory->branch == 0 and !isset($oldStoryStages[$storyID][$plan->branch])) + if($planID and $this->session->currentProductType != 'normal' and $oldStory->branch == 0) { - $story->stage = 'planned'; - $newStoryStage = new stdclass(); - $newStoryStage->story = $storyID; - $newStoryStage->branch = $plan->branch; - $newStoryStage->stage = $story->stage; - $this->dao->insert(TABLE_STORYSTAGE)->data($newStoryStage)->autoCheck()->exec(); + $story->plan = $oldStory->plan ? $oldStory->plan . ',' . $planID : $planID; + if(!isset($oldStoryStages[$storyID][$plan->branch])) + { + $story->stage = 'planned'; + $newStoryStage = new stdclass(); + $newStoryStage->story = $storyID; + $newStoryStage->branch = $plan->branch; + $newStoryStage->stage = $story->stage; + $this->dao->insert(TABLE_STORYSTAGE)->data($newStoryStage)->autoCheck()->exec(); + } } $this->dao->update(TABLE_STORY)->data($story)->autoCheck()->where('id')->eq((int)$storyID)->exec();