This commit is contained in:
liumengyi
2022-08-05 16:16:05 +08:00
parent 756c8d4dc0
commit 911ba77fea
+13 -3
View File
@@ -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;
}