From a7d9aa4cfaf97ff30a6bd263cbaff1c30678f105 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Mon, 12 Oct 2020 11:40:27 +0800 Subject: [PATCH 1/2] * Edit comment. --- module/bug/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/bug/model.php b/module/bug/model.php index c68c4ccccc..8858d01633 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -222,9 +222,9 @@ class bugModel extends model $data->browsers[$i] = $browser; } + /* Get bug data. */ if(isset($data->uploadImage)) $this->loadModel('file'); $extendFields = $this->getFlowExtendFields(); - $bugs = array(); foreach($data->title as $i => $title) { From 6442248d68154062eaa7f8dc4857d545c56deae1 Mon Sep 17 00:00:00 2001 From: holan20180123 <56391770@qq.com> Date: Mon, 12 Oct 2020 16:06:04 +0800 Subject: [PATCH 2/2] * Finish task #8158. --- module/story/model.php | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/module/story/model.php b/module/story/model.php index 25f0801567..22dd836cb9 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -814,30 +814,24 @@ class storyModel extends model $oldPlanIDList = $oldPlanIDList ? explode(',', $oldPlanIDList) : array(); /* Get the ids to be inserted and deleted by comparing plan ids. */ - $insertedPlanIDList = array_diff($planIDList, $oldPlanIDList); - $deletedPlanIDList = array_diff($oldPlanIDList, $planIDList); + $plansTobeInsert = array_diff($planIDList, $oldPlanIDList); + $plansTobeDelete = array_diff($oldPlanIDList, $planIDList); /* Delete old story sort of plan. */ - if(!empty($deletedPlanIDList)) - { - foreach($deletedPlanIDList as $planID) - { - $this->dao->delete()->from(TABLE_PLANSTORY)->where('plan')->eq($planID)->andWhere('story')->eq($storyID)->exec(); - } - } + if(!empty($plansTobeDelete)) $this->dao->delete()->from(TABLE_PLANSTORY)->where('story')->eq($storyID)->andWhere('plan')->in($plansTobeDelete)->exec(); - if(!empty($insertedPlanIDList)) + if(!empty($plansTobeInsert)) { /* Get last story order of plan list. */ - $lastOrderOfPlans = $this->dao->select('plan, `order`')->from(TABLE_PLANSTORY)->where('plan')->in($insertedPlanIDList)->orderBy('order_asc')->fetchPairs(); + $maxOrders = $this->dao->select('plan, max(`order`) as `order`')->from(TABLE_PLANSTORY)->where('plan')->in($plansTobeInsert)->groupBy('plan')->fetchPairs(); - foreach($insertedPlanIDList as $planID) + foreach($plansTobeInsert as $planID) { /* Set story order in new plan. */ $data = new stdClass(); $data->plan = $planID; $data->story = $storyID; - $data->order = zget($lastOrderOfPlans, $planID, 0) + 1; + $data->order = zget($maxOrders, $planID, 0) + 1; $this->dao->replace(TABLE_PLANSTORY)->data($data)->exec(); }