From fd2b8ec129dc68ef6301f7639e74469b72458b27 Mon Sep 17 00:00:00 2001 From: zhouxudong Date: Mon, 11 Jul 2022 12:56:31 +0000 Subject: [PATCH] * Fix bug. --- module/execution/js/taskkanban.js | 14 +- module/kanban/model.php | 13 +- module/task/control.php | 370 +++++++++++++----------------- 3 files changed, 172 insertions(+), 225 deletions(-) diff --git a/module/execution/js/taskkanban.js b/module/execution/js/taskkanban.js index 2e5b48c0c7..501518a84a 100644 --- a/module/execution/js/taskkanban.js +++ b/module/execution/js/taskkanban.js @@ -650,7 +650,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=from=' + 'taskkanban', '', true); showIframe = true; } } @@ -658,7 +658,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=from=' + 'taskkanban', '', true); showIframe = true; } } @@ -666,17 +666,17 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car { if((fromColType == 'canceled' || fromColType == 'closed' || fromColType == 'developed') && priv.canActivateTask) { - var link = createLink('task', 'activate', 'taskID=' + objectID, '', true); + var link = createLink('task', 'activate', 'taskID=' + objectID + '&extra=from=' + 'taskkanban', '', true); showIframe = true; } if(fromColType == 'pause' && priv.canActivateTask) { - var link = createLink('task', 'restart', 'taskID=' + objectID, '', true); + var link = createLink('task', 'restart', 'taskID=' + objectID + '&extra=from=' + 'taskkanban', '', true); showIframe = true; } if(fromColType == 'wait' && priv.canStartTask) { - var link = createLink('task', 'start', 'taskID=' + objectID, '', true); + var link = createLink('task', 'start', 'taskID=' + objectID + '&extra=from=' + 'taskkanban', '', true); showIframe = true; } } @@ -684,7 +684,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=from=' + 'taskkanban', '', true); showIframe = true; } } @@ -692,7 +692,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=from=' + 'taskkanban', '', true); showIframe = true; } } diff --git a/module/kanban/model.php b/module/kanban/model.php index 36f43289d4..cd294a684d 100644 --- a/module/kanban/model.php +++ b/module/kanban/model.php @@ -3660,6 +3660,7 @@ class kanbanModel extends model public function getKanbanCardMenu($executionID, $objects, $objecType) { $this->app->loadLang('execution'); + $methodName = $this->app->rawMethod; $menus = array(); switch ($objecType) @@ -3711,14 +3712,14 @@ class kanbanModel extends model { $menu = array(); - if(common::hasPriv('task', 'edit') and $this->task->isClickable($task, 'edit')) $menu[] = array('label' => $this->lang->task->edit, 'icon' => 'edit', 'url' => helper::createLink('task', 'edit', "taskID=$task->id", '', true), 'size' => '95%'); - if(common::hasPriv('task', 'pause') and $this->task->isClickable($task, 'pause')) $menu[] = array('label' => $this->lang->task->pause, 'icon' => 'pause', 'url' => helper::createLink('task', 'pause', "taskID=$task->id", '', true)); - if(common::hasPriv('task', 'restart') and $this->task->isClickable($task, 'restart')) $menu[] = array('label' => $this->lang->task->restart, 'icon' => 'play', 'url' => helper::createLink('task', 'restart', "taskID=$task->id", '', true)); - if(common::hasPriv('task', 'recordEstimate') and $this->task->isClickable($task, 'recordEstimate')) $menu[] = array('label' => $this->lang->task->recordEstimate, 'icon' => 'time', 'url' => helper::createLink('task', 'recordEstimate', "taskID=$task->id", '', true)); - if(common::hasPriv('task', 'activate') and $this->task->isClickable($task, 'activate')) $menu[] = array('label' => $this->lang->task->activate, 'icon' => 'magic', 'url' => helper::createLink('task', 'activate', "taskID=$task->id", '', true)); + if(common::hasPriv('task', 'edit') and $this->task->isClickable($task, 'edit')) $menu[] = array('label' => $this->lang->task->edit, 'icon' => 'edit', 'url' => helper::createLink('task', 'edit', "taskID=$task->id&comment=0&kanbanGroup=default&from=$methodName", '', true), 'size' => '95%'); + if(common::hasPriv('task', 'pause') and $this->task->isClickable($task, 'pause')) $menu[] = array('label' => $this->lang->task->pause, 'icon' => 'pause', 'url' => helper::createLink('task', 'pause', "taskID=$task->id&extra=from=$methodName", '', true)); + if(common::hasPriv('task', 'restart') and $this->task->isClickable($task, 'restart')) $menu[] = array('label' => $this->lang->task->restart, 'icon' => 'play', 'url' => helper::createLink('task', 'restart', "taskID=$task->id&from=$methodName", '', true)); + if(common::hasPriv('task', 'recordEstimate') and $this->task->isClickable($task, 'recordEstimate')) $menu[] = array('label' => $this->lang->task->recordEstimate, 'icon' => 'time', 'url' => helper::createLink('task', 'recordEstimate', "taskID=$task->id&from=$methodName", '', true)); + if(common::hasPriv('task', 'activate') and $this->task->isClickable($task, 'activate')) $menu[] = array('label' => $this->lang->task->activate, 'icon' => 'magic', 'url' => helper::createLink('task', 'activate', "taskID=$task->id&extra=from=$methodName", '', true)); if(common::hasPriv('task', 'batchCreate') and $this->task->isClickable($task, 'batchCreate')) $menu[] = array('label' => $this->lang->task->children, 'icon' => 'split', 'url' => helper::createLink('task', 'batchCreate', "execution=$task->execution&storyID=$task->story&moduleID=$task->module&taskID=$task->id", '', true), 'size' => '95%'); if(common::hasPriv('task', 'create') and $this->task->isClickable($task, 'create')) $menu[] = array('label' => $this->lang->task->copy, 'icon' => 'copy', 'url' => helper::createLink('task', 'create', "projctID=$task->execution&storyID=$task->story&moduleID=$task->module&taskID=$task->id", '', true), 'size' => '95%'); - if(common::hasPriv('task', 'cancel') and $this->task->isClickable($task, 'cancel')) $menu[] = array('label' => $this->lang->task->cancel, 'icon' => 'ban-circle', 'url' => helper::createLink('task', 'cancel', "taskID=$task->id", '', true)); + if(common::hasPriv('task', 'cancel') and $this->task->isClickable($task, 'cancel')) $menu[] = array('label' => $this->lang->task->cancel, 'icon' => 'ban-circle', 'url' => helper::createLink('task', 'cancel', "taskID=$task->id&extra=from=$methodName", '', true)); if(common::hasPriv('task', 'delete')) $menu[] = array('label' => $this->lang->task->delete, 'icon' => 'trash', 'url' => helper::createLink('task', 'delete', "executionID=$task->execution&taskID=$task->id&confirm=no&from=taskkanban")); $menus[$task->id] = $menu; diff --git a/module/task/control.php b/module/task/control.php index bd749846b8..631d86ad06 100755 --- a/module/task/control.php +++ b/module/task/control.php @@ -497,7 +497,7 @@ class task extends control * @access public * @return void */ - public function edit($taskID, $comment = false, $kanbanGroup = 'default') + public function edit($taskID, $comment = false, $kanbanGroup = 'default', $from = '') { $this->commonAction($taskID); $task = $this->task->getById($taskID); @@ -542,33 +542,27 @@ class task extends control if(isonlybody()) { - if($this->app->tab == 'execution' or $this->config->vision == 'lite') + $execution = $this->execution->getByID($task->execution); + $execLaneType = $this->session->execLaneType ? $this->session->execLaneType : 'all'; + $execGroupBy = $this->session->execGroupBy ? $this->session->execGroupBy : 'default'; + $rdSearchValue = $this->session->rdSearchValue ? $this->session->rdSearchValue : ''; + if($from == 'kanban') { - $execution = $this->execution->getByID($task->execution); - $execLaneType = $this->session->execLaneType ? $this->session->execLaneType : 'all'; - $execGroupBy = $this->session->execGroupBy ? $this->session->execGroupBy : 'default'; - $rdSearchValue = $this->session->rdSearchValue ? $this->session->rdSearchValue : ''; - if($execution->type == 'kanban') - { - $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $execLaneType, 'id_desc', 0, $execGroupBy, $rdSearchValue); - $kanbanData = json_encode($kanbanData); + $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $execLaneType, 'id_desc', 0, $execGroupBy, $rdSearchValue); + $kanbanData = json_encode($kanbanData); - return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData)")); - } - else - { - $kanbanData = $this->loadModel('kanban')->getExecutionKanban($task->execution, $execLaneType, $execGroupBy, $rdSearchValue); - $kanbanType = $execLaneType == 'all' ? 'task' : key($kanbanData); - $kanbanData = $kanbanData[$kanbanType]; - $kanbanData = json_encode($kanbanData); - - return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban(\"task\", $kanbanData)")); - } + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData)")); } - else + if($from == 'taskkanban') { - return print(js::reload('parent.parent')); + $kanbanData = $this->loadModel('kanban')->getExecutionKanban($task->execution, $execLaneType, $execGroupBy, $rdSearchValue); + $kanbanType = $execLaneType == 'all' ? 'task' : key($kanbanData); + $kanbanData = $kanbanData[$kanbanType]; + $kanbanData = json_encode($kanbanData); + + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban(\"task\", $kanbanData)")); } + return print(js::reload('parent.parent')); } if(defined('RUN_MODE') && RUN_MODE == 'api') @@ -753,7 +747,7 @@ class task extends control * @access public * @return void */ - public function assignTo($executionID, $taskID, $kanbanGroup = 'default') + public function assignTo($executionID, $taskID, $kanbanGroup = 'default', $from='') { $this->commonAction($taskID); $task = $this->task->getByID($taskID); @@ -782,34 +776,28 @@ class task extends control if($this->viewType == 'json' or (defined('RUN_MODE') && RUN_MODE == 'api')) return $this->send(array('result' => 'success')); if(isonlybody()) { - if($this->app->tab == 'execution' or $this->config->vision == 'lite') + $task = $this->task->getById($taskID); + $execution = $this->execution->getByID($task->execution); + $execLaneType = $this->session->execLaneType ? $this->session->execLaneType : 'all'; + $execGroupBy = $this->session->execGroupBy ? $this->session->execGroupBy : 'default'; + $rdSearchValue = $this->session->rdSearchValue ? $this->session->rdSearchValue : ''; + if($from == 'kanban') { - $task = $this->task->getById($taskID); - $execution = $this->execution->getByID($task->execution); - $execLaneType = $this->session->execLaneType ? $this->session->execLaneType : 'all'; - $execGroupBy = $this->session->execGroupBy ? $this->session->execGroupBy : 'default'; - $rdSearchValue = $this->session->rdSearchValue ? $this->session->rdSearchValue : ''; - if($execution->type == 'kanban') - { - $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $execLaneType, 'id_desc', 0, $execGroup, $rdSearchValue); - $kanbanData = json_encode($kanbanData); + $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $execLaneType, 'id_desc', 0, $execGroup, $rdSearchValue); + $kanbanData = json_encode($kanbanData); - return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData)")); - } - else - { - $kanbanData = $this->loadModel('kanban')->getExecutionKanban($task->execution, $execLaneType, $execGroupBy, $rdSearchValue); - $kanbanType = $execLaneType == 'all' ? 'task' : key($kanbanData); - $kanbanData = $kanbanData[$kanbanType]; - $kanbanData = json_encode($kanbanData); - - return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban(\"task\", $kanbanData)")); - } + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData)")); } - else + if($from == 'taskkanban') { - return print(js::closeModal('parent.parent', 'this')); + $kanbanData = $this->loadModel('kanban')->getExecutionKanban($task->execution, $execLaneType, $execGroupBy, $rdSearchValue); + $kanbanType = $execLaneType == 'all' ? 'task' : key($kanbanData); + $kanbanData = $kanbanData[$kanbanType]; + $kanbanData = json_encode($kanbanData); + + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban(\"task\", $kanbanData)")); } + return print(js::closeModal('parent.parent', 'this')); } return print(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); } @@ -1046,34 +1034,28 @@ class task extends control if(isonlybody()) { - if($this->app->tab == 'execution' or $this->config->vision == 'lite') + $execution = $this->execution->getByID($task->execution); + $execLaneType = $this->session->execLaneType ? $this->session->execLaneType : 'all'; + $execGroupBy = $this->session->execGroupBy ? $this->session->execGroupBy : 'default'; + $rdSearchValue = $this->session->rdSearchValue ? $this->session->rdSearchValue : ''; + if($output['from'] == 'kanban') { - $execution = $this->execution->getByID($task->execution); - $execLaneType = $this->session->execLaneType ? $this->session->execLaneType : 'all'; - $execGroupBy = $this->session->execGroupBy ? $this->session->execGroupBy : 'default'; - $rdSearchValue = $this->session->rdSearchValue ? $this->session->rdSearchValue : ''; - if($execution->type == 'kanban') - { - $regionID = !empty($output['regionID']) ? $output['regionID'] : 0; - $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $execLaneType, 'id_desc', $regionID, $execGroupBy, $rdSearchValue); - $kanbanData = json_encode($kanbanData); + $regionID = !empty($output['regionID']) ? $output['regionID'] : 0; + $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $execLaneType, 'id_desc', $regionID, $execGroupBy, $rdSearchValue); + $kanbanData = json_encode($kanbanData); - return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData, $regionID)")); - } - else - { - $kanbanData = $this->loadModel('kanban')->getExecutionKanban($task->execution, $execLaneType, $execGroupBy, $rdSearchValue); - $kanbanType = $execLaneType == 'all' ? 'task' : key($kanbanData); - $kanbanData = $kanbanData[$kanbanType]; - $kanbanData = json_encode($kanbanData); - - return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban(\"task\", $kanbanData)")); - } + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData, $regionID)")); } - else + if($output['from'] == 'taskkanban') { - return print(js::closeModal('parent.parent', 'this', "function(){parent.parent.location.reload();}")); + $kanbanData = $this->loadModel('kanban')->getExecutionKanban($task->execution, $execLaneType, $execGroupBy, $rdSearchValue); + $kanbanType = $execLaneType == 'all' ? 'task' : key($kanbanData); + $kanbanData = $kanbanData[$kanbanType]; + $kanbanData = json_encode($kanbanData); + + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban(\"task\", $kanbanData)")); } + return print(js::closeModal('parent.parent', 'this', "function(){parent.parent.location.reload();}")); } return print(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); } @@ -1094,7 +1076,7 @@ class task extends control * @access public * @return void */ - public function recordEstimate($taskID) + public function recordEstimate($taskID, $from = '') { $this->commonAction($taskID); @@ -1123,33 +1105,27 @@ class task extends control if(isonlybody()) { - if($this->app->tab == 'execution' or $this->config->vision == 'lite') + $execution = $this->execution->getByID($task->execution); + $execLaneType = $this->session->execLaneType ? $this->session->execLaneType : 'all'; + $execGroupBy = $this->session->execGroupBy ? $this->session->execGroupBy : 'default'; + $rdSearchValue = $this->session->rdSearchValue ? $this->session->rdSearchValue : ''; + if($from == 'kanban') { - $execution = $this->execution->getByID($task->execution); - $execLaneType = $this->session->execLaneType ? $this->session->execLaneType : 'all'; - $execGroupBy = $this->session->execGroupBy ? $this->session->execGroupBy : 'default'; - $rdSearchValue = $this->session->rdSearchValue ? $this->session->rdSearchValue : ''; - if($execution->type == 'kanban') - { - $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $execLaneType, 'id_desc', 0, $execGroupBy, $rdSearchValue); - $kanbanData = json_encode($kanbanData); + $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $execLaneType, 'id_desc', 0, $execGroupBy, $rdSearchValue); + $kanbanData = json_encode($kanbanData); - return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData)")); - } - else - { - $kanbanData = $this->loadModel('kanban')->getExecutionKanban($task->execution, $execLaneType, $execGroupBy, $rdSearchValue); - $kanbanType = $execLaneType == 'all' ? 'task' : key($kanbanData); - $kanbanData = $kanbanData[$kanbanType]; - $kanbanData = json_encode($kanbanData); - - return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban(\"task\", $kanbanData)")); - } + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData)")); } - else + if($from == 'taskkanban') { - return print(js::closeModal('parent.parent', 'this')); + $kanbanData = $this->loadModel('kanban')->getExecutionKanban($task->execution, $execLaneType, $execGroupBy, $rdSearchValue); + $kanbanType = $execLaneType == 'all' ? 'task' : key($kanbanData); + $kanbanData = $kanbanData[$kanbanType]; + $kanbanData = json_encode($kanbanData); + + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban(\"task\", $kanbanData)")); } + return print(js::closeModal('parent.parent', 'this')); } return print(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); } @@ -1273,34 +1249,28 @@ class task extends control if(isonlybody()) { - if($this->app->tab == 'execution' or $this->config->vision == 'lite') + $execution = $this->execution->getByID($task->execution); + $execLaneType = $this->session->execLaneType ? $this->session->execLaneType : 'all'; + $execGroupBy = $this->session->execGroupBy ? $this->session->execGroupBy : 'default'; + $rdSearchValue = $this->session->rdSearchValue ? $this->session->rdSearchValue : ''; + if($output['from'] == "kanban") { - $execution = $this->execution->getByID($task->execution); - $execLaneType = $this->session->execLaneType ? $this->session->execLaneType : 'all'; - $execGroupBy = $this->session->execGroupBy ? $this->session->execGroupBy : 'default'; - $rdSearchValue = $this->session->rdSearchValue ? $this->session->rdSearchValue : ''; - if($execution->type == 'kanban') - { - $regionID = !empty($output['regionID']) ? $output['regionID'] : 0; - $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $execLaneType, 'id_desc', $regionID, $execGroupBy, $rdSearchValue); - $kanbanData = json_encode($kanbanData); + $regionID = !empty($output['regionID']) ? $output['regionID'] : 0; + $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $execLaneType, 'id_desc', $regionID, $execGroupBy, $rdSearchValue); + $kanbanData = json_encode($kanbanData); - return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData, $regionID)")); - } - else - { - $kanbanData = $this->loadModel('kanban')->getExecutionKanban($task->execution, $execLaneType, $execGroupBy, $rdSearchValue); - $kanbanType = $execLaneType == 'all' ? 'task' : key($kanbanData); - $kanbanData = $kanbanData[$kanbanType]; - $kanbanData = json_encode($kanbanData); - - return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban(\"task\", $kanbanData)")); - } + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData, $regionID)")); } - else + if($output['from'] == "taskkanban") { - return print(js::closeModal('parent.parent', 'this', "function(){parent.parent.location.reload();}")); + $kanbanData = $this->loadModel('kanban')->getExecutionKanban($task->execution, $execLaneType, $execGroupBy, $rdSearchValue); + $kanbanType = $execLaneType == 'all' ? 'task' : key($kanbanData); + $kanbanData = $kanbanData[$kanbanType]; + $kanbanData = json_encode($kanbanData); + + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban(\"task\", $kanbanData)")); } + return print(js::closeModal('parent.parent', 'this', "function(){parent.parent.location.reload();}")); } if(defined('RUN_MODE') && RUN_MODE == 'api') @@ -1375,35 +1345,29 @@ class task extends control if(isonlybody()) { - if($this->app->tab == 'execution' or $this->config->vision == 'lite') + $task = $this->task->getById($taskID); + $execution = $this->execution->getByID($task->execution); + $execLaneType = $this->session->execLaneType ? $this->session->execLaneType : 'all'; + $execGroupBy = $this->session->execGroupBy ? $this->session->execGroupBy : 'default'; + $rdSearchValue = $this->session->rdSearchValue ? $this->session->rdSearchValue : ''; + if($output['from'] == 'kanban') { - $task = $this->task->getById($taskID); - $execution = $this->execution->getByID($task->execution); - $execLaneType = $this->session->execLaneType ? $this->session->execLaneType : 'all'; - $execGroupBy = $this->session->execGroupBy ? $this->session->execGroupBy : 'default'; - $rdSearchValue = $this->session->rdSearchValue ? $this->session->rdSearchValue : ''; - if($execution->type == 'kanban') - { - $regionID = !empty($output['regionID']) ? $output['regionID'] : 0; - $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $execLaneType, 'id_desc', $regionID, $execGroupBy, $rdSearchValue); - $kanbanData = json_encode($kanbanData); + $regionID = !empty($output['regionID']) ? $output['regionID'] : 0; + $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $execLaneType, 'id_desc', $regionID, $execGroupBy, $rdSearchValue); + $kanbanData = json_encode($kanbanData); - return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData, $regionID)")); - } - else - { - $kanbanData = $this->loadModel('kanban')->getExecutionKanban($task->execution, $execLaneType, $execGroupBy, $rdSearchValue); - $kanbanType = $execLaneType == 'all' ? 'task' : key($kanbanData); - $kanbanData = $kanbanData[$kanbanType]; - $kanbanData = json_encode($kanbanData); - - return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban(\"task\", $kanbanData)")); - } + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData, $regionID)")); } - else + if($output['from'] == 'taskkanban') { - return print(js::closeModal('parent.parent', 'this')); + $kanbanData = $this->loadModel('kanban')->getExecutionKanban($task->execution, $execLaneType, $execGroupBy, $rdSearchValue); + $kanbanType = $execLaneType == 'all' ? 'task' : key($kanbanData); + $kanbanData = $kanbanData[$kanbanType]; + $kanbanData = json_encode($kanbanData); + + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban(\"task\", $kanbanData)")); } + return print(js::closeModal('parent.parent', 'this')); } return print(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); @@ -1423,7 +1387,7 @@ class task extends control * @access public * @return void */ - public function restart($taskID) + public function restart($taskID, $from = '') { $this->commonAction($taskID); @@ -1446,34 +1410,28 @@ class task extends control if(isonlybody()) { - if($this->app->tab == 'execution' or $this->config->vision == 'lite') + $task = $this->task->getById($taskID); + $execution = $this->execution->getByID($task->execution); + $execLaneType = $this->session->execLaneType ? $this->session->execLaneType : 'all'; + $execGroupBy = $this->session->execGroupBy ? $this->session->execGroupBy : 'default'; + $rdSearchValue = $this->session->rdSearchValue ? $this->session->rdSearchValue : ''; + if($from == 'kanban') { - $task = $this->task->getById($taskID); - $execution = $this->execution->getByID($task->execution); - $execLaneType = $this->session->execLaneType ? $this->session->execLaneType : 'all'; - $execGroupBy = $this->session->execGroupBy ? $this->session->execGroupBy : 'default'; - $rdSearchValue = $this->session->rdSearchValue ? $this->session->rdSearchValue : ''; - if($execution->type == 'kanban') - { - $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $execLaneType, 'id_desc', 0, $execGroupBy, $rdSearchValue); - $kanbanData = json_encode($kanbanData); + $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $execLaneType, 'id_desc', 0, $execGroupBy, $rdSearchValue); + $kanbanData = json_encode($kanbanData); - return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData)")); - } - else - { - $kanbanData = $this->loadModel('kanban')->getExecutionKanban($task->execution, $execLaneType, $execGroupBy, $rdSearchValue); - $kanbanType = $execLaneType == 'all' ? 'task' : key($kanbanData); - $kanbanData = $kanbanData[$kanbanType]; - $kanbanData = json_encode($kanbanData); - - return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban(\"task\", $kanbanData)")); - } + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData)")); } - else + if($from == 'taskkanban') { - return print(js::closeModal('parent.parent', 'this')); + $kanbanData = $this->loadModel('kanban')->getExecutionKanban($task->execution, $execLaneType, $execGroupBy, $rdSearchValue); + $kanbanType = $execLaneType == 'all' ? 'task' : key($kanbanData); + $kanbanData = $kanbanData[$kanbanType]; + $kanbanData = json_encode($kanbanData); + + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban(\"task\", $kanbanData)")); } + return print(js::closeModal('parent.parent', 'this')); } return print(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); } @@ -1710,35 +1668,29 @@ class task extends control if(isonlybody()) { - if($this->app->tab == 'execution' or $this->config->vision == 'lite') + $task = $this->task->getById($taskID); + $execution = $this->execution->getByID($task->execution); + $execLaneType = $this->session->execLaneType ? $this->session->execLaneType : 'all'; + $execGroupBy = $this->session->execGroupBy ? $this->session->execGroupBy : 'default'; + $rdSearchValue = $this->session->rdSearchValue ? $this->session->rdSearchValue : ''; + if($output['from'] == 'kanban') { - $task = $this->task->getById($taskID); - $execution = $this->execution->getByID($task->execution); - $execLaneType = $this->session->execLaneType ? $this->session->execLaneType : 'all'; - $execGroupBy = $this->session->execGroupBy ? $this->session->execGroupBy : 'default'; - $rdSearchValue = $this->session->rdSearchValue ? $this->session->rdSearchValue : ''; - if($execution->type == 'kanban') - { - $regionID = !empty($output['regionID']) ? $output['regionID'] : 0; - $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $execLaneType, 'id_desc', $regionID, $execGroupBy, $rdSearchValue); - $kanbanData = json_encode($kanbanData); + $regionID = !empty($output['regionID']) ? $output['regionID'] : 0; + $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $execLaneType, 'id_desc', $regionID, $execGroupBy, $rdSearchValue); + $kanbanData = json_encode($kanbanData); - return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData, $regionID)")); - } - else - { - $kanbanData = $this->loadModel('kanban')->getExecutionKanban($task->execution, $execLaneType, $execGroupBy, $rdSearchValue); - $kanbanType = $execLaneType == 'all' ? 'task' : key($kanbanData); - $kanbanData = $kanbanData[$kanbanType]; - $kanbanData = json_encode($kanbanData); - - return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban(\"task\", $kanbanData)")); - } + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData, $regionID)")); } - else + if($output['from'] == 'taskkanban') { - return print(js::closeModal('parent.parent', 'this')); + $kanbanData = $this->loadModel('kanban')->getExecutionKanban($task->execution, $execLaneType, $execGroupBy, $rdSearchValue); + $kanbanType = $execLaneType == 'all' ? 'task' : key($kanbanData); + $kanbanData = $kanbanData[$kanbanType]; + $kanbanData = json_encode($kanbanData); + + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban(\"task\", $kanbanData)")); } + return print(js::closeModal('parent.parent', 'this')); } return print(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); } @@ -1781,35 +1733,29 @@ class task extends control if(isonlybody()) { - if($this->app->tab == 'execution' or $this->config->vision == 'lite') + $task = $this->task->getById($taskID); + $execution = $this->execution->getByID($task->execution); + $execLaneType = $this->session->execLaneType ? $this->session->execLaneType : 'all'; + $execGroupBy = $this->session->execGroupBy ? $this->session->execGroupBy : 'default'; + $rdSearchValue = $this->session->rdSearchValue ? $this->session->rdSearchValue : ''; + if($output['from'] == "kanban") { - $task = $this->task->getById($taskID); - $execution = $this->execution->getByID($task->execution); - $execLaneType = $this->session->execLaneType ? $this->session->execLaneType : 'all'; - $execGroupBy = $this->session->execGroupBy ? $this->session->execGroupBy : 'default'; - $rdSearchValue = $this->session->rdSearchValue ? $this->session->rdSearchValue : ''; - if($execution->type == 'kanban') - { - $regionID = !empty($output['regionID']) ? $output['regionID'] : 0; - $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $execLaneType, 'id_desc', $regionID, $execGroupBy, $rdSearchValue); - $kanbanData = json_encode($kanbanData); + $regionID = !empty($output['regionID']) ? $output['regionID'] : 0; + $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $execLaneType, 'id_desc', $regionID, $execGroupBy, $rdSearchValue); + $kanbanData = json_encode($kanbanData); - return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData, $regionID)")); - } - else - { - $kanbanData = $this->loadModel('kanban')->getExecutionKanban($task->execution, $execLaneType, $execGroupBy, $rdSearchValue); - $kanbanType = $execLaneType == 'all' ? 'task' : key($kanbanData); - $kanbanData = $kanbanData[$kanbanType]; - $kanbanData = json_encode($kanbanData); - - return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban(\"task\", $kanbanData)")); - } + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData, $regionID)")); } - else + if($output['from'] == "taskkanban") { - return print(js::closeModal('parent.parent', 'this')); + $kanbanData = $this->loadModel('kanban')->getExecutionKanban($task->execution, $execLaneType, $execGroupBy, $rdSearchValue); + $kanbanType = $execLaneType == 'all' ? 'task' : key($kanbanData); + $kanbanData = $kanbanData[$kanbanType]; + $kanbanData = json_encode($kanbanData); + + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban(\"task\", $kanbanData)")); } + return print(js::closeModal('parent.parent', 'this')); } return print(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); }