diff --git a/module/bug/model.php b/module/bug/model.php index 554fc62cc6..db83f17ea4 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -608,8 +608,6 @@ class bugModel extends model if(isset($kanbanParams['toColID'])) $this->kanban->moveCard($bug->id, $kanbanParams['fromColID'], $kanbanParams['toColID'], $kanbanParams['fromLaneID'], $kanbanParams['toLaneID']); } - if($this->config->edition != 'open' && $oldBug->feedback) $this->loadModel('feedback')->updateStatus('bug', $oldBug->feedback, $bug->status, $oldBug->status, $oldBug->id); - $changes = common::createChanges($oldBug, $bug); $files = $this->loadModel('file')->saveUpload('bug', $bug->id); if($changes || $files) @@ -618,6 +616,7 @@ class bugModel extends model $actionID = $this->loadModel('action')->create('bug', $bug->id, 'Activated', $fileAction . $this->post->comment); $this->action->logHistory($actionID, $changes); } + if($this->config->edition != 'open' && $oldBug->feedback) $this->loadModel('feedback')->updateStatus('bug', $oldBug->feedback, $bug->status, $oldBug->status, $oldBug->id); return !dao::isError(); } diff --git a/module/story/control.php b/module/story/control.php index 2a955d8629..b8ffa115cb 100755 --- a/module/story/control.php +++ b/module/story/control.php @@ -472,16 +472,9 @@ class story extends control if(!empty($_POST)) { $postData = $this->storyZen->buildStoryForActivate($storyID); - $changes = $this->story->activate($storyID, $postData); - + $this->story->activate($storyID, $postData); if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); - if($changes) - { - $actionID = $this->action->create('story', $storyID, 'Activated', $this->post->comment); - $this->action->logHistory($actionID, $changes); - } - $this->executeHooks($storyID); if(isInModal()) diff --git a/module/story/model.php b/module/story/model.php index f8b0a2f4bc..7f7bcaca01 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -2188,9 +2188,9 @@ class storyModel extends model * * @param int $storyID * @access public - * @return array|false + * @return bool */ - public function activate(int $storyID, object $postData): array|false + public function activate(int $storyID, object $postData): bool { $oldStory = $this->dao->findById($storyID)->from(TABLE_STORY)->fetch(); @@ -2206,6 +2206,11 @@ class storyModel extends model $this->setStage($storyID); $changes = common::createChanges($oldStory, $story); + if($changes) + { + $actionID = $this->loadModel('action')->create('story', $storyID, 'Activated', $this->post->comment); + $this->action->logHistory($actionID, $changes); + } if(!empty($oldStory->twins)) $this->syncTwins($storyID, $oldStory->twins, $changes, 'Activated'); if($this->config->edition != 'open' && $oldStory->feedback) $this->loadModel('feedback')->updateStatus('story', $oldStory->feedback, $story->status, $oldStory->status, $storyID); @@ -2223,7 +2228,7 @@ class storyModel extends model $relation->product = 0; $this->dao->replace(TABLE_RELATION)->data($relation)->exec(); } - return $changes; + return !dao::isError(); } /** diff --git a/module/task/control.php b/module/task/control.php index fc4a796c71..06fb0832c0 100755 --- a/module/task/control.php +++ b/module/task/control.php @@ -935,15 +935,9 @@ class task extends control if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); $teamData = form::data($this->config->task->form->team->edit)->get(); - $changes = $this->task->activate($task, (string)$this->post->comment, $teamData, $output); + $this->task->activate($task, (string)$this->post->comment, $teamData, $output); if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); - if($this->post->comment != '' || !empty($changes)) - { - $actionID = $this->loadModel('action')->create('task', $taskID, 'Activated', $this->post->comment); - $this->action->logHistory($actionID, $changes); - } - $this->executeHooks($taskID); /* Get the information returned after a task is started. */ diff --git a/module/task/model.php b/module/task/model.php index 43c7f7dafa..6fb2c3b58d 100755 --- a/module/task/model.php +++ b/module/task/model.php @@ -21,9 +21,9 @@ class taskModel extends model * @param object $teamData * @param string $drag * @access public - * @return array|false + * @return bool */ - public function activate(object $task, string $comment, object $teamData, array $drag = array()): array|false + public function activate(object $task, string $comment, object $teamData, array $drag = array()): bool { $taskID = $task->id; @@ -63,11 +63,17 @@ class taskModel extends model if($oldTask->parent > 0) $this->updateParentStatus($taskID); if($oldTask->story) $this->loadModel('story')->setStage($oldTask->story); + $changes = common::createChanges($oldTask, $task); + if($this->post->comment != '' || !empty($changes)) + { + $actionID = $this->loadModel('action')->create('task', $taskID, 'Activated', $this->post->comment); + $this->action->logHistory($actionID, $changes); + } if($this->config->edition != 'open' && $oldTask->feedback) $this->loadModel('feedback')->updateStatus('task', $oldTask->feedback, $task->status, $oldTask->status, $taskID); $this->updateKanbanCell($taskID, $drag, $oldTask->execution); - return common::createChanges($oldTask, $task); + return !dao::isError(); } /** diff --git a/module/todo/model.php b/module/todo/model.php index de3c969745..824cfa91ca 100755 --- a/module/todo/model.php +++ b/module/todo/model.php @@ -393,9 +393,8 @@ class todoModel extends model $this->dao->update(TABLE_TODO)->set('status')->eq('wait')->where('id')->eq($todoID)->exec(); $todo = $this->fetchByID($todoID); - if($this->config->edition != 'open' && $todo->type == 'feedback' && $todo->objectID) $this->loadModel('feedback')->updateStatus('todo', $todo->objectID, $todo->status, '', $todoID); - $this->loadModel('action')->create('todo', $todoID, 'activated', '', 'wait'); + if($this->config->edition != 'open' && $todo->type == 'feedback' && $todo->objectID) $this->loadModel('feedback')->updateStatus('todo', $todo->objectID, $todo->status, '', $todoID); return !dao::isError(); }