From fc5ad0f8931de980d32e777a8e322cb8c614a1e9 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Sun, 16 Jan 2022 17:11:40 +0800 Subject: [PATCH 1/3] * FIx bug #18489,#18478,#18466. --- module/execution/control.php | 5 +++-- module/execution/model.php | 1 + module/project/control.php | 1 + module/project/view/index.html.php | 1 + module/user/model.php | 4 ++-- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index ba14b4f182..f2e20def84 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -2377,7 +2377,7 @@ class execution extends control * @access public * @return void */ - public function delete($executionID, $confirm = 'no') + public function delete($executionID, $confirm = 'no', $kanban = 'no') { if($confirm == 'no') { @@ -2407,7 +2407,8 @@ class execution extends control $this->lang->execution->confirmDelete = str_replace($this->lang->executionCommon, $this->lang->project->stage, $this->lang->execution->confirmDelete); } - echo js::confirm($tips . sprintf($this->lang->execution->confirmDelete, $this->executions[$executionID]), $this->createLink('execution', 'delete', "executionID=$executionID&confirm=yes")); + $confirmDelete = $kanban == 'no' ? $this->lang->execution->confirmDelete : $this->app->loadLang('kanban')->confirmDelete; + echo js::confirm($tips . sprintf($confirmDelete, $this->executions[$executionID]), $this->createLink('execution', 'delete', "executionID=$executionID&confirm=yes")); exit; } else diff --git a/module/execution/model.php b/module/execution/model.php index 6d42ab9a32..bd4ad417fa 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -3045,6 +3045,7 @@ class executionModel extends model if($action == 'suspend') return $execution->status == 'wait' or $execution->status == 'doing'; if($action == 'putoff') return $execution->status == 'wait' or $execution->status == 'doing'; if($action == 'activate') return $execution->status == 'suspended' or $execution->status == 'closed'; + if($action == 'delete') return $execution->status == 'wait' or $execution->status == 'doing'; return true; } diff --git a/module/project/control.php b/module/project/control.php index 178bcb0c4d..fa5a7d6d34 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -252,6 +252,7 @@ class project extends control { if($this->execution->isClickable($kanban, $action)) $executionActions[$kanbanID][] = $action; } + if($this->execution->isClickable($kanban, 'delete')) $executionActions[$kanbanID][] = 'delete'; } $this->view->kanbanList = $kanbanList; diff --git a/module/project/view/index.html.php b/module/project/view/index.html.php index 251e12a41a..af33d3f907 100644 --- a/module/project/view/index.html.php +++ b/module/project/view/index.html.php @@ -68,6 +68,7 @@ if(in_array('suspend', $executionActions[$kanbanID])) echo '
  • ' . html::a(helper::createLink('execution', 'suspend', "executionID=$kanbanID", '', true), '' . $lang->execution->suspend, '', "class='iframe btn btn-link text-left' data-width='75%'") . '
  • '; if(in_array('close', $executionActions[$kanbanID])) echo '
  • ' . html::a(helper::createLink('execution', 'close', "executionID=$kanbanID", '', true), '' . $lang->execution->close, '', "class='iframe btn btn-link text-left' data-width='75%'") . '
  • '; if(in_array('activate', $executionActions[$kanbanID])) echo '
  • ' . html::a(helper::createLink('execution', 'activate', "executionID=$kanbanID", '', true), '' . $lang->execution->activate, '', "class='iframe btn btn-link text-left' data-width='75%'") . '
  • '; + if(in_array('delete', $executionActions[$kanbanID])) echo '
  • ' . html::a(helper::createLink('execution', 'delete', "executionID=$kanbanID&confirm=no&kanban=yes", '', true), '' . $lang->kanban->delete, '', "target='hiddenwin'") . '
  • '; ?> diff --git a/module/user/model.php b/module/user/model.php index d45f9b21bc..b368cfe684 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -1624,7 +1624,7 @@ class userModel extends model if($allProducts === null) $allProducts = $this->dao->select('id,PO,QD,RD,createdBy,acl,whitelist,program,createdBy')->from(TABLE_PRODUCT)->where('acl')->ne('open')->fetchAll('id'); if($allProjects === null) $allProjects = $this->dao->select('id,PO,PM,QD,RD,acl,type,path,parent,openedBy')->from(TABLE_PROJECT)->where('acl')->ne('open')->andWhere('type')->eq('project')->fetchAll('id'); if($allPrograms === null) $allPrograms = $this->dao->select('id,PO,PM,QD,RD,acl,type,path,parent,openedBy')->from(TABLE_PROGRAM)->where('acl')->ne('open')->andWhere('type')->eq('program')->fetchAll('id'); - if($allSprints === null) $allSprints = $this->dao->select('id,PO,PM,QD,RD,acl,project,path,parent,type,openedBy')->from(TABLE_PROJECT)->where('acl')->eq('private')->beginIF($this->config->systemMode == 'new')->andWhere('type')->in('sprint,stage')->fi()->fetchAll('id'); + if($allSprints === null) $allSprints = $this->dao->select('id,PO,PM,QD,RD,acl,project,path,parent,type,openedBy')->from(TABLE_PROJECT)->where('acl')->eq('private')->beginIF($this->config->systemMode == 'new')->andWhere('type')->in('sprint,stage,kanban')->fi()->fetchAll('id'); /* Get teams. */ if($teams === null) @@ -1869,7 +1869,7 @@ class userModel extends model /* Set opened sprints and stages into userview. */ $openedSprints = $this->dao->select('id')->from(TABLE_PROJECT) ->where('acl')->eq('open') - ->beginIF($this->config->systemMode == 'new')->andWhere('type')->in('sprint,stage')->fi() + ->beginIF($this->config->systemMode == 'new')->andWhere('type')->in('sprint,stage,kanban')->fi() ->beginIF($this->config->systemMode == 'new')->andWhere('project')->in($userView->projects)->fi() ->fetchAll('id'); From d45ff40e16d523e3be719a9e04c119b0d653e425 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Sun, 16 Jan 2022 19:33:52 +0800 Subject: [PATCH 2/3] * Add code annotation. --- module/execution/control.php | 1 + 1 file changed, 1 insertion(+) diff --git a/module/execution/control.php b/module/execution/control.php index f2e20def84..090ae310b4 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -2374,6 +2374,7 @@ class execution extends control * * @param int $executionID * @param string $confirm yes|no + * @param string $kanban yes|no * @access public * @return void */ From cdba989f91a79d06d62bb462457619dfe439a5e0 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Mon, 17 Jan 2022 08:54:22 +0800 Subject: [PATCH 3/3] * Fix bug #18458,#18473. --- module/execution/control.php | 50 ++++++++++++----------------- module/execution/view/edit.html.php | 2 +- module/kanban/model.php | 7 ++-- module/project/lang/zh-cn.php | 2 +- 4 files changed, 26 insertions(+), 35 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index 090ae310b4..394178b508 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1267,19 +1267,12 @@ class execution extends control $project = $this->project->getByID($projectID); if(!empty($project) and $project->model == 'kanban') { - $this->lang->execution->menu = new stdclass(); - $this->lang->execution->createExec = str_replace($this->lang->execution->common, $this->lang->execution->kanban, $this->lang->execution->createExec); - $this->lang->execution->execName = str_replace($this->lang->execution->common, $this->lang->execution->kanban, $this->lang->execution->execName); - $this->lang->execution->execCode = str_replace($this->lang->execution->common, $this->lang->execution->kanban, $this->lang->execution->execCode); - $this->lang->execution->execDesc = str_replace($this->lang->execution->common, $this->lang->execution->kanban, $this->lang->execution->execDesc); - $this->lang->execution->copyExec = str_replace($this->lang->execution->common, $this->lang->execution->kanban, $this->lang->execution->copyExec); - $this->lang->execution->create = str_replace($this->lang->executionCommon, $this->lang->execution->kanban, $this->lang->execution->create); - $this->lang->execution->copy = str_replace($this->lang->executionCommon, $this->lang->execution->kanban, $this->lang->execution->copy); - $this->lang->execution->PM = str_replace($this->lang->executionCommon, $this->lang->execution->kanban, $this->lang->execution->PM); - $this->lang->execution->name = str_replace($this->lang->executionCommon, $this->lang->execution->kanban, $this->lang->execution->name); - $this->lang->execution->code = str_replace($this->lang->executionCommon, $this->lang->execution->kanban, $this->lang->execution->code); - $this->lang->execution->desc = str_replace($this->lang->executionCommon, $this->lang->execution->kanban, $this->lang->execution->desc); - $this->lang->execution->copyTeamTip = str_replace(array($this->lang->execution->common, $this->lang->executionCommon), $this->lang->execution->kanban, $this->lang->execution->copyTeamTip); + global $lang; + $executionLang = $lang->execution->common; + $lang->executionCommon = $lang->execution->kanban; + $lang->execution->common = $lang->execution->kanban; + include $this->app->getModulePath('', 'execution') . 'lang/' . $this->app->getClientLang() . '.php'; + $lang->execution->common = $executionLang; } $extra = str_replace(array(',', ' '), array('&', ''), $extra); @@ -1483,6 +1476,13 @@ class execution extends control $browseExecutionLink = $this->createLink('execution', 'browse', "executionID=$executionID"); $execution = $this->execution->getById($executionID); + if($execution->type == 'kanban') + { + global $lang; + $lang->executionCommon = $lang->execution->kanban; + include $this->app->getModulePath('', 'execution') . 'lang/' . $this->app->getClientLang() . '.php'; + } + if(!empty($_POST)) { $oldPlans = $this->dao->select('plan')->from(TABLE_PROJECTPRODUCT)->where('project')->eq($executionID)->andWhere('plan')->ne(0)->fetchPairs('plan'); @@ -1543,17 +1543,6 @@ class execution extends control $executions = array('' => '') + $this->executions; $managers = $this->execution->getDefaultManagers($executionID); - $project = $this->project->getByID($execution->project); - if($project->model == 'kanban') - { - $this->lang->execution->edit = str_replace($this->lang->executionCommon, $this->lang->execution->kanban, $this->lang->execution->edit); - $this->lang->execution->name = str_replace($this->lang->executionCommon, $this->lang->execution->kanban, $this->lang->execution->name); - $this->lang->execution->code = str_replace($this->lang->executionCommon, $this->lang->execution->kanban, $this->lang->execution->code); - $this->lang->execution->desc = str_replace($this->lang->executionCommon, $this->lang->execution->kanban, $this->lang->execution->desc); - $this->lang->execution->status = str_replace($this->lang->executionCommon, $this->lang->execution->kanban, $this->lang->execution->status); - $this->lang->execution->PM = str_replace($this->lang->executionCommon, $this->lang->execution->kanban, $this->lang->execution->PM); - } - /* Remove current execution from the executions. */ unset($executions[$executionID]); @@ -1625,7 +1614,6 @@ class execution extends control $this->view->multiBranchProducts = $this->product->getMultiBranchPairs(); $this->view->productPlans = $productPlans; $this->view->branchGroups = $this->execution->getBranchByProduct(array_keys($linkedProducts), $this->config->systemMode == 'new' ? $execution->project : 0, 'noclosed', $linkedBranchList); - $this->view->project = $project; $this->display(); } @@ -2374,11 +2362,10 @@ class execution extends control * * @param int $executionID * @param string $confirm yes|no - * @param string $kanban yes|no * @access public * @return void */ - public function delete($executionID, $confirm = 'no', $kanban = 'no') + public function delete($executionID, $confirm = 'no') { if($confirm == 'no') { @@ -2407,9 +2394,14 @@ class execution extends control if($tips) $tips = str_replace($this->lang->executionCommon, $this->lang->project->stage, $tips); $this->lang->execution->confirmDelete = str_replace($this->lang->executionCommon, $this->lang->project->stage, $this->lang->execution->confirmDelete); } + elseif($type == 'kanban') + { + global $lang; + $lang->executionCommon = $lang->execution->kanban; + include $this->app->getModulePath('', 'execution') . 'lang/' . $this->app->getClientLang() . '.php'; + } - $confirmDelete = $kanban == 'no' ? $this->lang->execution->confirmDelete : $this->app->loadLang('kanban')->confirmDelete; - echo js::confirm($tips . sprintf($confirmDelete, $this->executions[$executionID]), $this->createLink('execution', 'delete', "executionID=$executionID&confirm=yes")); + echo js::confirm($tips . sprintf($this->lang->execution->confirmDelete, $this->executions[$executionID]), $this->createLink('execution', 'delete', "executionID=$executionID&confirm=yes")); exit; } else diff --git a/module/execution/view/edit.html.php b/module/execution/view/edit.html.php index 68f911e281..0316288f4f 100644 --- a/module/execution/view/edit.html.php +++ b/module/execution/view/edit.html.php @@ -66,7 +66,7 @@ - model != 'kanban'):?> + type != 'kanban'):?> execution->type;?> diff --git a/module/kanban/model.php b/module/kanban/model.php index b523c5dd2b..a030284f05 100644 --- a/module/kanban/model.php +++ b/module/kanban/model.php @@ -1113,10 +1113,9 @@ class kanbanModel extends model public function getKanban4Group($executionID, $browseType, $groupBy) { /* Get card data. */ - $cardList = array(); - if($browseType == 'story') $cardList .= $this->loadModel('story')->getExecutionStories($executionID); - if($browseType == 'bug') $cardList .= $this->loadModel('bug')->getExecutionBugs($executionID); - if($browseType == 'task') $cardList .= $this->loadModel('execution')->getKanbanTasks($executionID, "id"); + if($browseType == 'story') $cardList = $this->loadModel('story')->getExecutionStories($executionID); + if($browseType == 'bug') $cardList = $this->loadModel('bug')->getExecutionBugs($executionID); + if($browseType == 'task') $cardList = $this->loadModel('execution')->getKanbanTasks($executionID, "id"); $lanes = $this->getLanes4Group($executionID, $browseType, $groupBy, $cardList); if(empty($lanes)) return array(); diff --git a/module/project/lang/zh-cn.php b/module/project/lang/zh-cn.php index c0e8a48e9b..132c11dc68 100644 --- a/module/project/lang/zh-cn.php +++ b/module/project/lang/zh-cn.php @@ -155,7 +155,7 @@ $lang->project->etc = "等"; $lang->project->product = '所属产品'; $lang->project->branch = '所属分支'; $lang->project->plan = '所属计划'; -$lang->project->createKanban = '创建看板'; +$lang->project->createKanban = '添加看板'; $lang->project->kanban = '看板'; /* Project Kanban. */