* Refactored update swimlane code.
This commit is contained in:
+60
-23
@@ -413,11 +413,7 @@ class taskModel extends model
|
||||
$mails[$i]->actionID = $actionID;
|
||||
}
|
||||
|
||||
if(!dao::isError())
|
||||
{
|
||||
$this->loadModel('score')->create('ajax', 'batchCreate');
|
||||
$this->loadModel('kanban')->updateLane($executionID, 'task');
|
||||
}
|
||||
if(!dao::isError()) $this->loadModel('score')->create('ajax', 'batchCreate');
|
||||
|
||||
if($parentID > 0 && !empty($taskID))
|
||||
{
|
||||
@@ -1018,7 +1014,7 @@ class taskModel extends model
|
||||
if($this->post->story != false) $this->loadModel('story')->setStage($this->post->story);
|
||||
if($task->status == 'done') $this->loadModel('score')->create('task', 'finish', $taskID);
|
||||
if($task->status == 'closed') $this->loadModel('score')->create('task', 'close', $taskID);
|
||||
if($task->status != $oldTask->status) $this->loadModel('kanban')->updateLane($task->execution, 'task');
|
||||
if($task->status != $oldTask->status) $this->loadModel('kanban')->updateLane($task->execution, 'task', $taskID);
|
||||
|
||||
$this->loadModel('action');
|
||||
$changed = $task->parent != $oldTask->parent;
|
||||
@@ -1297,7 +1293,7 @@ class taskModel extends model
|
||||
|
||||
if($task->status == 'done') $this->loadModel('score')->create('task', 'finish', $taskID);
|
||||
if($task->status == 'closed') $this->loadModel('score')->create('task', 'close', $taskID);
|
||||
if($task->status != $oldTask->status) $this->loadModel('kanban')->updateLane($oldTask->execution, 'task');
|
||||
if($task->status != $oldTask->status) $this->loadModel('kanban')->updateLane($oldTask->execution, 'task', $oldTask->id);
|
||||
$allChanges[$taskID] = common::createChanges($oldTask, $task);
|
||||
}
|
||||
else
|
||||
@@ -1392,12 +1388,16 @@ class taskModel extends model
|
||||
/**
|
||||
* Start a task.
|
||||
*
|
||||
* @param int $taskID
|
||||
* @param int $taskID
|
||||
* @param string $extra
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function start($taskID)
|
||||
public function start($taskID, $extra = '')
|
||||
{
|
||||
$extra = str_replace(array(',', ' '), array('&', ''), $extra);
|
||||
parse_str($extra, $output);
|
||||
|
||||
$oldTask = $this->getById($taskID);
|
||||
if($oldTask->status == 'doing') dao::$errors[] = $this->lang->task->error->alreadyStarted;
|
||||
if(!empty($oldTask->team))
|
||||
@@ -1473,7 +1473,10 @@ class taskModel extends model
|
||||
$this->computeBeginAndEnd($oldTask->parent);
|
||||
}
|
||||
if($oldTask->story) $this->loadModel('story')->setStage($oldTask->story);
|
||||
$this->loadModel('kanban')->updateLane($oldTask->execution, 'task');
|
||||
|
||||
$this->loadModel('kanban');
|
||||
if(!isset($output['fromColID'])) $this->kanban->updateLane($oldTask->execution, 'task', $taskID);
|
||||
if(isset($output['fromColID'])) $this->kanban->moveCard($taskID, $output['fromColID'], $output['toColID'], $output['fromLaneID'], $output['toLaneID']);
|
||||
if(!dao::isError()) return common::createChanges($oldTask, $task);
|
||||
}
|
||||
|
||||
@@ -1612,12 +1615,16 @@ class taskModel extends model
|
||||
/**
|
||||
* Finish a task.
|
||||
*
|
||||
* @param int $taskID
|
||||
* @param int $taskID
|
||||
* @param string $extra
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function finish($taskID)
|
||||
public function finish($taskID, $extra = '')
|
||||
{
|
||||
$extra = str_replace(array(',', ' '), array('&', ''), $extra);
|
||||
parse_str($extra, $output);
|
||||
|
||||
$oldTask = $this->getById($taskID);
|
||||
$now = helper::now();
|
||||
$today = helper::today();
|
||||
@@ -1735,7 +1742,10 @@ class taskModel extends model
|
||||
if($task->status == 'done' && !dao::isError())
|
||||
{
|
||||
$this->loadModel('score')->create('task', 'finish', $taskID);
|
||||
$this->loadModel('kanban')->updateLane($oldTask->execution, 'task');
|
||||
|
||||
$this->loadModel('kanban');
|
||||
if(!isset($output['fromColID'])) $this->kanban->updateLane($oldTask->execution, 'task', $taskID);
|
||||
if(isset($output['fromColID'])) $this->kanban->moveCard($taskID, $output['fromColID'], $output['toColID'], $output['fromLaneID'], $output['toLaneID']);
|
||||
}
|
||||
if(!dao::isError()) return common::createChanges($oldTask, $task);
|
||||
}
|
||||
@@ -1744,11 +1754,15 @@ class taskModel extends model
|
||||
* Pause task
|
||||
*
|
||||
* @param int $taskID
|
||||
* @param string $extra
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function pause($taskID)
|
||||
public function pause($taskID, $extra = '')
|
||||
{
|
||||
$extra = str_replace(array(',', ' '), array('&', ''), $extra);
|
||||
parse_str($extra, $output);
|
||||
|
||||
$oldTask = $this->getById($taskID);
|
||||
|
||||
$task = fixer::input('post')
|
||||
@@ -1761,18 +1775,26 @@ class taskModel extends model
|
||||
$this->dao->update(TABLE_TASK)->data($task)->autoCheck()->where('id')->eq((int)$taskID)->exec();
|
||||
|
||||
if($oldTask->parent > 0) $this->updateParentStatus($taskID);
|
||||
|
||||
$this->loadModel('kanban');
|
||||
if(!isset($output['fromColID'])) $this->kanban->updateLane($oldTask->execution, 'task', $taskID);
|
||||
if(isset($output['fromColID'])) $this->kanban->moveCard($taskID, $output['fromColID'], $output['toColID'], $output['fromLaneID'], $output['toLaneID']);
|
||||
if(!dao::isError()) return common::createChanges($oldTask, $task);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close a task.
|
||||
*
|
||||
* @param int $taskID
|
||||
* @param int $taskID
|
||||
* @param string $extra
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function close($taskID)
|
||||
public function close($taskID, $extra = '')
|
||||
{
|
||||
$extra = str_replace(array(',', ' '), array('&', ''), $extra);
|
||||
parse_str($extra, $output);
|
||||
|
||||
$oldTask = $this->dao->select('*')->from(TABLE_TASK)->where('id')->eq($taskID)->fetch();
|
||||
|
||||
$now = helper::now();
|
||||
@@ -1795,7 +1817,10 @@ class taskModel extends model
|
||||
if($oldTask->parent > 0) $this->updateParentStatus($taskID);
|
||||
if($oldTask->story) $this->loadModel('story')->setStage($oldTask->story);
|
||||
$this->loadModel('score')->create('task', 'close', $taskID);
|
||||
$this->loadModel('kanban')->updateLane($oldTask->execution, 'task');
|
||||
|
||||
$this->loadModel('kanban');
|
||||
if(!isset($output['fromColID'])) $this->kanban->updateLane($oldTask->execution, 'task', $taskID);
|
||||
if(isset($output['fromColID'])) $this->kanban->moveCard($taskID, $output['fromColID'], $output['toColID'], $output['fromLaneID'], $output['toLaneID']);
|
||||
|
||||
return common::createChanges($oldTask, $task);
|
||||
}
|
||||
@@ -1804,13 +1829,17 @@ class taskModel extends model
|
||||
/**
|
||||
* Cancel a task.
|
||||
*
|
||||
* @param int $taskID
|
||||
* @param int $taskID
|
||||
* @param string $extra
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function cancel($taskID)
|
||||
public function cancel($taskID, $extra = '')
|
||||
{
|
||||
$extra = str_replace(array(',', ' '), array('&', ''), $extra);
|
||||
parse_str($extra, $output);
|
||||
|
||||
$oldTask = $this->getById($taskID);
|
||||
|
||||
$now = helper::now();
|
||||
@@ -1835,7 +1864,9 @@ class taskModel extends model
|
||||
$this->dao->update(TABLE_TASK)->set('assignedTo=openedBy')->where('parent')->eq((int)$taskID)->exec();
|
||||
}
|
||||
if($oldTask->story) $this->loadModel('story')->setStage($oldTask->story);
|
||||
$this->loadModel('kanban')->updateLane($oldTask->execution, 'task');
|
||||
$this->loadModel('kanban');
|
||||
if(!isset($output['fromColID'])) $this->kanban->updateLane($oldTask->execution, 'task', $taskID);
|
||||
if(isset($output['fromColID'])) $this->kanban->moveCard($taskID, $output['fromColID'], $output['toColID'], $output['fromLaneID'], $output['toLaneID']);
|
||||
|
||||
if(!dao::isError()) return common::createChanges($oldTask, $task);
|
||||
}
|
||||
@@ -1843,13 +1874,17 @@ class taskModel extends model
|
||||
/**
|
||||
* Activate a task.
|
||||
*
|
||||
* @param int $taskID
|
||||
* @param int $taskID
|
||||
* @param string $extra
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function activate($taskID)
|
||||
public function activate($taskID, $extra)
|
||||
{
|
||||
$extra = str_replace(array(',', ' '), array('&', ''), $extra);
|
||||
parse_str($extra, $output);
|
||||
|
||||
if(strpos($this->config->task->activate->requiredFields, 'comment') !== false and !$this->post->comment)
|
||||
{
|
||||
dao::$errors[] = sprintf($this->lang->error->notempty, $this->lang->comment);
|
||||
@@ -1901,7 +1936,9 @@ class taskModel extends model
|
||||
$this->computeWorkingHours($taskID);
|
||||
}
|
||||
if($oldTask->story) $this->loadModel('story')->setStage($oldTask->story);
|
||||
$this->loadModel('kanban')->updateLane($oldTask->execution, 'task');
|
||||
$this->loadModel('kanban');
|
||||
if(!isset($output['fromColID'])) $this->kanban->updateLane($oldTask->execution, 'task', $taskID);
|
||||
if(isset($output['fromColID'])) $this->kanban->moveCard($taskID, $output['fromColID'], $output['toColID'], $output['fromLaneID'], $output['toLaneID']);
|
||||
|
||||
if(!dao::isError()) return common::createChanges($oldTask, $task);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user