diff --git a/module/bug/model.php b/module/bug/model.php index f800f83094..9aa899e14d 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -1267,13 +1267,17 @@ class bugModel extends model */ public function batchChangePlan($bugIDList, $planID) { - $now = helper::now(); - $allChanges = array(); - $oldBugs = $this->getByList($bugIDList); + $now = helper::now(); + $allChanges = array(); + $oldBugs = $this->getByList($bugIDList); + $unlinkPlans = array(); + $link2Plans = array(); foreach($bugIDList as $bugID) { $oldBug = $oldBugs[$bugID]; if($planID == $oldBug->plan) continue; + $unlinkPlans[$oldBug->plan] = empty($unlinkPlans[$oldBug->plan]) ? $bugID : "{$unlinkPlans[$oldBug->plan]},$bugID"; + $link2Plans[$planID] = empty($link2Plans[$planID]) ? $bugID : "{$link2Plans[$planID]},$bugID"; $bug = new stdclass(); $bug->lastEditedBy = $this->app->user->account; @@ -1283,6 +1287,12 @@ class bugModel extends model $this->dao->update(TABLE_BUG)->data($bug)->autoCheck()->where('id')->eq((int)$bugID)->exec(); if(!dao::isError()) $allChanges[$bugID] = common::createChanges($oldBug, $bug); } + if(!dao::isError()) + { + $this->loadModel('action'); + foreach($unlinkPlans as $planID => $bugs) $this->action->create('productplan', $planID, 'unlinkbug', '', $bugs); + foreach($link2Plans as $planID => $bugs) $this->action->create('productplan', $planID, 'linkbug', '', $bugs); + } return $allChanges; } diff --git a/module/doc/control.php b/module/doc/control.php index 53307bc092..08a6e8dd56 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -983,7 +983,6 @@ class doc extends control $this->lang->TRActions = $this->doc->buildCollectButton4Doc(); $this->lang->TRActions .= $this->doc->buildBrowseSwitch($type, $objectID, $viewType, $orderBy, $recTotal, $recPerPage, $pageID, $searchTitle); - if($this->app->tab == 'doc') $this->app->rawMethod = $type; /* Load pager. */ $this->app->loadClass('pager', $static = true);