From d16d7fcb089dde89b2e1f8f97577d271adee9dfa Mon Sep 17 00:00:00 2001 From: mayue Date: Thu, 1 Dec 2022 09:06:16 +0800 Subject: [PATCH] * Unlink bug when edit branch of plan. --- module/productplan/control.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/module/productplan/control.php b/module/productplan/control.php index ce80f5e403..7165026bc8 100644 --- a/module/productplan/control.php +++ b/module/productplan/control.php @@ -136,7 +136,7 @@ class productplan extends control $changes = $this->productplan->update($planID); if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); $change[$planID] = $changes; - $this->syncStory($change); + $this->unlinkOldBranch($change); if($changes) { $actionID = $this->loadModel('action')->create('productplan', $planID, 'edited'); @@ -178,7 +178,7 @@ class productplan extends control if(!empty($_POST['title'])) { $changes = $this->productplan->batchUpdate($productID); - $this->syncStory($changes); + $this->unlinkOldBranch($changes); $this->loadModel('action'); foreach($changes as $planID => $change) { @@ -893,13 +893,13 @@ class productplan extends control } /** - * Synchronize story when edit plan. + * Unlink story and bug when edit branch of plan. * @param int $planID * @param int $oldBranch * @access protected * @return void */ - protected function syncStory($changes) + protected function unlinkOldBranch($changes) { foreach($changes as $planID => $changes) { @@ -915,12 +915,18 @@ class productplan extends control } } $planStories = $this->loadModel('story')->getPlanStories($planID, 'all'); + $planBugs = $this->loadModel('bug')->getPlanBugs($planID, 'all'); if($oldBranch) { foreach($planStories as $storyID => $story) { if($story->branch and strpos(",$newBranch,", ",$story->branch,") === false) $this->productplan->unlinkStory($storyID, $planID); } + + foreach($planBugs as $bugID => $bug) + { + if($bug->branch and strpos(",$newBranch,", ",$bug->branch,") === false) $this->productplan->unlinkBug($bugID, $planID); + } } } }