Merge branch 'sprint/182_tianshujie_18496' into 'master'

* Filter out cards from other swimlanes when updating cards.

See merge request easycorp/zentaopms!1434
This commit is contained in:
孙广明
2022-01-17 07:23:01 +00:00
8 changed files with 176 additions and 74 deletions
+7 -7
View File
@@ -192,7 +192,7 @@ function createColumnCreateMenu(options)
else if(col.type == 'wait')
{
if(priv.canCreateTask) items.push({label: taskLang.create, url: $.createLink('task', 'create', 'executionID=' + executionID + "&storyID=0&moduleID=0&taskID=0&todoID=0&extra=laneID=" + laneID + ",columnID=" + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}});
if(priv.canBatchCreateTask) items.push({label: taskLang.batchCreate, url: $.createLink('task', 'batchcreate', 'executionID=' + executionID, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}});
if(priv.canBatchCreateTask) items.push({label: taskLang.batchCreate, url: $.createLink('task', 'batchcreate', 'executionID=' + executionID + "&storyID=0&moduleID=0&taskID=0&iframe=0&extra=laneID=" + laneID + ",columnID=" + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}});
}
return items;
}
@@ -737,7 +737,7 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car
{
if((fromColType == 'developing' || fromColType == 'wait') && priv.canFinishTask)
{
var link = createLink('task', 'finish', 'taskID=' + objectID, '', true);
var link = createLink('task', 'finish', 'taskID=' + objectID + '&extra=fromColID=' + fromColID + ',toColID=' + toColID + ',fromLaneID=' + fromLaneID + ',toLaneID=' + toLaneID, '', true);
showIframe = true;
}
}
@@ -745,7 +745,7 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car
{
if(fromColType == 'developing' && priv.canPauseTask)
{
var link = createLink('task', 'pause', 'taskID=' + objectID, '', true);
var link = createLink('task', 'pause', 'taskID=' + objectID + '&extra=fromColID=' + fromColID + ',toColID=' + toColID + ',fromLaneID=' + fromLaneID + ',toLaneID=' + toLaneID, '', true);
showIframe = true;
}
}
@@ -753,12 +753,12 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car
{
if((fromColType == 'pause' || fromColType == 'cancel' || fromColType == 'closed' || fromColType == 'developed') && priv.canActivateTask)
{
var link = createLink('task', 'activate', 'taskID=' + objectID, '', true);
var link = createLink('task', 'activate', 'taskID=' + objectID + '&extra=fromColID=' + fromColID + ',toColID=' + toColID + ',fromLaneID=' + fromLaneID + ',toLaneID=' + toLaneID, '', true);
showIframe = true;
}
if(fromColType == 'wait' && priv.canStartTask)
{
var link = createLink('task', 'start', 'taskID=' + objectID, '', true);
var link = createLink('task', 'start', 'taskID=' + objectID + '&extra=fromColID=' + fromColID + ',toColID=' + toColID + ',fromLaneID=' + fromLaneID + ',toLaneID=' + toLaneID, '', true);
showIframe = true;
}
}
@@ -766,7 +766,7 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car
{
if((fromColType == 'developing' || fromColType == 'wait' || fromColType == 'pause') && priv.canCancelTask)
{
var link = createLink('task', 'cancel', 'taskID=' + objectID, '', true);
var link = createLink('task', 'cancel', 'taskID=' + objectID + '&extra=fromColID=' + fromColID + ',toColID=' + toColID + ',fromLaneID=' + fromLaneID + ',toLaneID=' + toLaneID, '', true);
showIframe = true;
}
}
@@ -774,7 +774,7 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car
{
if((fromColType == 'developed' || fromColType == 'canceled') && priv.canCloseTask)
{
var link = createLink('task', 'close', 'taskID=' + objectID, '', true);
var link = createLink('task', 'close', 'taskID=' + objectID + '&extra=fromColID=' + fromColID + ',toColID=' + toColID + ',fromLaneID=' + fromLaneID + ',toLaneID=' + toLaneID, '', true);
showIframe = true;
}
}
+6 -4
View File
@@ -3238,13 +3238,14 @@ class executionModel extends model
/**
* Get Kanban tasks
*
* @param int $executionID
* @param string $orderBy
* @param object $pager
* @param int $executionID
* @param string $orderBy
* @param object $pager
* @param array|string $excludeTasks
* @access public
* @return void
*/
public function getKanbanTasks($executionID, $orderBy = 'status_asc, id_desc', $pager = null)
public function getKanbanTasks($executionID, $orderBy = 'status_asc, id_desc', $pager = null, $excludeTasks = '')
{
$tasks = $this->dao->select('t1.*, t2.id AS storyID, t2.title AS storyTitle, t2.version AS latestStoryVersion, t2.status AS storyStatus, t3.realname AS assignedToRealName')
->from(TABLE_TASK)->alias('t1')
@@ -3253,6 +3254,7 @@ class executionModel extends model
->where('t1.execution')->eq((int)$executionID)
->andWhere('t1.deleted')->eq(0)
->andWhere('t1.parent')->ge(0)
->beginIF($excludeTasks)->andWhere('t1.id')->notIN($excludeTasks)->fi()
->orderBy($orderBy)
->page($pager)
->fetchAll('id');
+51 -12
View File
@@ -1912,7 +1912,7 @@ class kanbanModel extends model
}
else
{
$cell->cards = $cell->cards ? $cell->cards . "$cardID," : ",$cardID,";
$cell->cards = $cell->cards ? ",$cardID" . $cell->cards : ",$cardID,";
$this->dao->update(TABLE_KANBANCELL)->set('cards')->eq($cell->cards)->where('id')->eq($cell->id)->exec();
}
}
@@ -2071,15 +2071,39 @@ class kanbanModel extends model
*
* @param int $executionID
* @param string $laneType
* @param int $cardID
* @access public
* @return void
*/
public function updateLane($executionID, $laneType)
public function updateLane($executionID, $laneType, $cardID = 0)
{
$lanes = $this->dao->select('*')->from(TABLE_KANBANLANE)
->where('execution')->eq($executionID)
->andWhere('type')->eq($laneType)
->fetchAll('id');
$execution = $this->loadModel('execution')->getByID($executionID);
if($execution->type == 'kanban')
{
$regionIdList = $this->dao->select('id')->from(TABLE_KANBANREGION)
->where('deleted')->eq(0)
->andWhere('kanban')->eq($executionID)
->fetchPairs();
$lanes = $this->dao->select('t1.*')->from(TABLE_KANBANLANE)->alias('t1')
->leftJoin(TABLE_KANBANCELL)->alias('t2')->on('t1.id=t2.lane')
->where('t1.deleted')->eq(0)
->andWhere('t1.execution')->eq($executionID)
->andWhere('t1.type')->eq($laneType)
->andWhere('t1.region')->in($regionIdList)
->beginIF(!empty($cardID))->andWhere('t2.cards')->like("%,$cardID,%")->fi()
->orderBy('t1.`order` asc')
->fetchAll('id');
if(count($lanes) > 1) $lanes = array_slice($lanes, 0, 1);
}
else
{
$lanes = $this->dao->select('*')->from(TABLE_KANBANLANE)
->where('execution')->eq($executionID)
->andWhere('type')->eq($laneType)
->fetchAll('id');
}
foreach($lanes as $lane) $this->refreshCards($lane);
}
@@ -2093,9 +2117,24 @@ class kanbanModel extends model
*/
public function refreshCards($lane)
{
$laneType = $lane->type;
$executionID = $lane->execution;
$cardPairs = $this->dao->select('t2.type, t1.cards')->from(TABLE_KANBANCELL)->alias('t1')
$laneType = $lane->type;
$executionID = $lane->execution;
$otherCardList = '';
$otherLanes = $this->dao->select('t2.id, t2.cards')->from(TABLE_KANBANLANE)->alias('t1')
->leftJoin(TABLE_KANBANCELL)->alias('t2')->on('t1.id=t2.lane')
->where('t1.deleted')->eq(0)
->andWhere('t1.id')->ne($lane->id)
->andWhere('t1.execution')->eq($executionID)
->andWhere('t2.`type`')->eq($lane->type)
->fetchPairs();
foreach($otherLanes as $cardIDList)
{
$cardIDList = trim($cardIDList, ',');
if(!empty($cardIDList)) $otherCardList .= ',' . $cardIDList;
}
$cardPairs = $this->dao->select('t2.type, t1.cards')->from(TABLE_KANBANCELL)->alias('t1')
->leftJoin(TABLE_KANBANCOLUMN)->alias('t2')->on('t1.`column` = t2.id')
->where('t1.kanban')->eq($executionID)
->andWhere('t1.lane')->eq($lane->id)
@@ -2105,7 +2144,7 @@ class kanbanModel extends model
if($laneType == 'story')
{
$stories = $this->loadModel('story')->getExecutionStories($executionID);
$stories = $this->loadModel('story')->getExecutionStories($executionID, 0, 0, 't1.`order`_desc', 'byModule', 0, 'story', $otherCardList);
foreach($stories as $storyID => $story)
{
foreach($this->config->kanban->storyColumnStageList as $colType => $stage)
@@ -2132,7 +2171,7 @@ class kanbanModel extends model
}
elseif($laneType == 'bug')
{
$bugs = $this->loadModel('bug')->getExecutionBugs($executionID);
$bugs = $this->loadModel('bug')->getExecutionBugs($executionID, 0, 0, '', 0, 'id_desc', $otherCardList);
foreach($bugs as $bugID => $bug)
{
foreach($this->config->kanban->bugColumnStatusList as $colType => $status)
@@ -2175,7 +2214,7 @@ class kanbanModel extends model
}
elseif($laneType == 'task')
{
$tasks = $this->loadModel('execution')->getKanbanTasks($executionID);
$tasks = $this->loadModel('execution')->getKanbanTasks($executionID, 'status_asc, id_desc', null, $otherCardList);
foreach($tasks as $taskID => $task)
{
foreach($this->config->kanban->taskColumnStatusList as $colType => $status)
+1 -1
View File
@@ -95,7 +95,7 @@ class story extends control
$response['message'] = $this->lang->saveSuccess;
setcookie('lastStoryModule', (int)$this->post->module, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, false);
$storyResult = $this->story->create($objectID, $bugID, $from = isset($fromObjectIDKey) ? $fromObjectIDKey : '');
$storyResult = $this->story->create($objectID, $bugID, $from = isset($fromObjectIDKey) ? $fromObjectIDKey : '', $extra);
if(!$storyResult or dao::isError())
{
$response['result'] = 'fail';
+8 -2
View File
@@ -183,11 +183,15 @@ class storyModel extends model
* @param int $executionID
* @param int $bugID
* @param string $from
* @param string $extra
* @access public
* @return int|bool the id of the created story or false when error.
*/
public function create($executionID = 0, $bugID = 0, $from = '')
public function create($executionID = 0, $bugID = 0, $from = '', $extra = '')
{
$extra = str_replace(array(',', ' '), array('&', ''), $extra);
parse_str($extra, $output);
if(isset($_POST['reviewer'])) $_POST['reviewer'] = array_filter($_POST['reviewer']);
if(!$this->post->needNotReview and empty($_POST['reviewer']))
{
@@ -280,7 +284,9 @@ class storyModel extends model
{
$this->linkStory($executionID, $this->post->product, $storyID);
if($this->config->systemMode == 'new' and $executionID != $this->session->project) $this->linkStory($this->session->project, $this->post->product, $storyID);
$this->loadModel('kanban')->updateLane($executionID, 'story');
$this->loadModel('kanban');
if(isset($output['laneID']) and isset($output['columnID'])) $this->kanban->addKanbanCell($kanbanID, $output['laneID'], $output['columnID'], 'story', $storyID);
if(!isset($output['laneID']) or !isset($output['columnID'])) $this->kanban->updateLane($kanbanID, 'story');
}
if(is_array($this->post->URS))
+31 -21
View File
@@ -106,8 +106,6 @@ class task extends control
return $this->send($response);
}
if(isset($output['laneID']) and isset($output['columnID'])) $this->loadModel('kanban')->addKanbanCell($executionID, $output['laneID'], $output['columnID'], 'task', $taskID);
/* if the count of tasksID is 1 then check exists. */
if(count($tasksID) == 1)
{
@@ -131,6 +129,11 @@ class task extends control
$this->action->create('task', $taskID, 'Opened', '');
}
$this->loadModel('kanban');
$kanbanID = $execution->type == 'kanban' ? $executionID : $_POST['execution'];
if(isset($output['laneID']) and isset($output['columnID'])) $this->kanban->addKanbanCell($kanbanID, $output['laneID'], $output['columnID'], 'task', $taskID);
if(!isset($output['laneID']) or !isset($output['columnID'])) $this->kanban->updateLane($kanbanID, 'task');
if($todoID > 0)
{
$this->dao->update(TABLE_TODO)->set('status')->eq('done')->where('id')->eq($todoID)->exec();
@@ -248,15 +251,16 @@ class task extends control
/**
* Batch create task.
*
* @param int $executionID
* @param int $storyID
* @param int $iframe
* @param int $taskID
* @param int $executionID
* @param int $storyID
* @param int $iframe
* @param int $taskID
* @param string $extra
*
* @access public
* @return void
*/
public function batchCreate($executionID = 0, $storyID = 0, $moduleID = 0, $taskID = 0, $iframe = 0)
public function batchCreate($executionID = 0, $storyID = 0, $moduleID = 0, $taskID = 0, $iframe = 0, $extra = '')
{
$this->execution->getLimitedExecution();
$limitedExecutions = !empty($_SESSION['limitedExecutions']) ? $_SESSION['limitedExecutions'] : '';
@@ -295,7 +299,7 @@ class task extends control
if(!empty($_POST))
{
$mails = $this->task->batchCreate($executionID);
$mails = $this->task->batchCreate($executionID, $extra);
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$taskIDList = array();
@@ -797,10 +801,11 @@ class task extends control
* Start a task.
*
* @param int $taskID
* @param string $extra
* @access public
* @return void
*/
public function start($taskID)
public function start($taskID, $extra = '')
{
$this->commonAction($taskID);
@@ -809,7 +814,7 @@ class task extends control
if(!empty($_POST))
{
$this->loadModel('action');
$changes = $this->task->start($taskID);
$changes = $this->task->start($taskID, $extra);
if(dao::isError())
{
@@ -963,17 +968,18 @@ class task extends control
* Finish a task.
*
* @param int $taskID
* @param string $extra
* @access public
* @return void
*/
public function finish($taskID)
public function finish($taskID, $extra = '')
{
$this->commonAction($taskID);
if(!empty($_POST))
{
$this->loadModel('action');
$changes = $this->task->finish($taskID);
$changes = $this->task->finish($taskID, $extra);
if(dao::isError())
{
if($this->viewType == 'json' or (defined('RUN_MODE') && RUN_MODE == 'api')) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
@@ -1049,17 +1055,18 @@ class task extends control
* Pause task.
*
* @param int $taskID
* @param string $extra
* @access public
* @return void
*/
public function pause($taskID)
public function pause($taskID, $extra = '')
{
$this->commonAction($taskID);
if(!empty($_POST))
{
$this->loadModel('action');
$changes = $this->task->pause($taskID);
$changes = $this->task->pause($taskID, $extra);
if(dao::isError()) die(js::error(dao::getError()));
if($this->post->comment != '' or !empty($changes))
@@ -1125,18 +1132,19 @@ class task extends control
/**
* Close a task.
*
* @param int $taskID
* @param int $taskID
* @param string $extra
* @access public
* @return void
*/
public function close($taskID)
public function close($taskID, $extra = '')
{
$this->commonAction($taskID);
if(!empty($_POST))
{
$this->loadModel('action');
$changes = $this->task->close($taskID);
$changes = $this->task->close($taskID, $extra);
if(dao::isError()) die(js::error(dao::getError()));
@@ -1257,17 +1265,18 @@ class task extends control
* Cancel a task.
*
* @param int $taskID
* @param string $extra
* @access public
* @return void
*/
public function cancel($taskID)
public function cancel($taskID, $extra = '')
{
$this->commonAction($taskID);
if(!empty($_POST))
{
$this->loadModel('action');
$changes = $this->task->cancel($taskID);
$changes = $this->task->cancel($taskID, $extra);
if(dao::isError()) die(js::error(dao::getError()));
if($this->post->comment != '' or !empty($changes))
@@ -1293,17 +1302,18 @@ class task extends control
* Activate a task.
*
* @param int $taskID
* @param string $extra
* @access public
* @return void
*/
public function activate($taskID)
public function activate($taskID, $extra = '')
{
$this->commonAction($taskID);
if(!empty($_POST))
{
$this->loadModel('action');
$changes = $this->task->activate($taskID);
$changes = $this->task->activate($taskID, $extra);
if(dao::isError()) die(js::error(dao::getError()));
if($this->post->comment != '' or !empty($changes))
+70 -27
View File
@@ -137,8 +137,6 @@ class taskModel extends model
$this->dao->insert(TABLE_TASKSPEC)->data($taskSpec)->autoCheck()->exec();
if(dao::isError()) return false;
$this->loadModel('kanban')->updateLane($executionID, 'task');
if($this->post->story) $this->loadModel('story')->setStage($this->post->story);
if($this->post->selectTestStory)
{
@@ -233,10 +231,11 @@ class taskModel extends model
* Create a batch task.
*
* @param int $executionID
* @param string $extra
* @access public
* @return void
*/
public function batchCreate($executionID)
public function batchCreate($executionID, $extra = '')
{
/* Load module and init vars. */
$this->loadModel('action');
@@ -247,6 +246,9 @@ class taskModel extends model
$preStory = 0;
$tasks = fixer::input('post')->get();
$extra = str_replace(array(',', ' '), array('&', ''), $extra);
parse_str($extra, $output);
/* Judge whether the current task is a parent. */
$parentID = !empty($this->post->parent[0]) ? $this->post->parent[0] : 0;
@@ -401,6 +403,9 @@ class taskModel extends model
$this->executeHooks($taskID);
$this->loadModel('kanban');
if(isset($output['laneID']) and isset($output['columnID'])) $this->kanban->addKanbanCell($executionID, $output['laneID'], $output['columnID'], 'task', $taskID);
$actionID = $this->action->create('task', $taskID, 'Opened', '');
if(!dao::isError()) $this->loadModel('score')->create('task', 'create', $taskID);
@@ -409,11 +414,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))
{
@@ -456,6 +457,8 @@ class taskModel extends model
$actionID = $this->action->create('task', $parentID, 'createChildren', '', trim($childTasks, ','));
if(!empty($changes)) $this->action->logHistory($actionID, $changes);
}
if(!isset($output['laneID']) or !isset($output['columnID'])) $this->kanban->updateLane($kanbanID, 'task');
return $mails;
}
@@ -1014,8 +1017,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;
if($oldTask->parent > 0)
@@ -1293,7 +1295,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
@@ -1388,12 +1390,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))
@@ -1469,7 +1475,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['toColID'])) $this->kanban->updateLane($oldTask->execution, 'task', $taskID);
if(isset($output['toColID'])) $this->kanban->moveCard($taskID, $output['fromColID'], $output['toColID'], $output['fromLaneID'], $output['toLaneID']);
if(!dao::isError()) return common::createChanges($oldTask, $task);
}
@@ -1608,12 +1617,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();
@@ -1731,7 +1744,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['toColID'])) $this->kanban->updateLane($oldTask->execution, 'task', $taskID);
if(isset($output['toColID'])) $this->kanban->moveCard($taskID, $output['fromColID'], $output['toColID'], $output['fromLaneID'], $output['toLaneID']);
}
if(!dao::isError()) return common::createChanges($oldTask, $task);
}
@@ -1740,11 +1756,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')
@@ -1757,18 +1777,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['toColID'])) $this->kanban->updateLane($oldTask->execution, 'task', $taskID);
if(isset($output['toColID'])) $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();
@@ -1791,7 +1819,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['toColID'])) $this->kanban->updateLane($oldTask->execution, 'task', $taskID);
if(isset($output['toColID'])) $this->kanban->moveCard($taskID, $output['fromColID'], $output['toColID'], $output['fromLaneID'], $output['toLaneID']);
return common::createChanges($oldTask, $task);
}
@@ -1800,13 +1831,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();
@@ -1831,7 +1866,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['toColID'])) $this->kanban->updateLane($oldTask->execution, 'task', $taskID);
if(isset($output['toColID'])) $this->kanban->moveCard($taskID, $output['fromColID'], $output['toColID'], $output['fromLaneID'], $output['toLaneID']);
if(!dao::isError()) return common::createChanges($oldTask, $task);
}
@@ -1839,13 +1876,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);
@@ -1897,7 +1938,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['toColID'])) $this->kanban->updateLane($oldTask->execution, 'task', $taskID);
if(isset($output['toColID'])) $this->kanban->moveCard($taskID, $output['fromColID'], $output['toColID'], $output['fromLaneID'], $output['toLaneID']);
if(!dao::isError()) return common::createChanges($oldTask, $task);
}
+2
View File
@@ -35,10 +35,12 @@
?>
<form class='main-form form-ajax' method='post' enctype='multipart/form-data' id='dataform'>
<table class='table table-form'>
<?php if($execution->type != 'kanban'):?>
<tr>
<th><?php echo $lang->task->execution;?></th>
<td><?php echo html::select('execution', $executions, $execution->id, "class='form-control chosen' onchange='loadAll(this.value)' required");?></td><td></td><td></td>
</tr>
<?php endif;?>
<tr>
<th><?php echo $lang->task->type;?></th>
<td><?php echo html::select('type', $lang->task->typeList, $task->type, "class='form-control chosen' onchange='setOwners(this.value)' required");?></td>