From a38461a20e43659e2126cd874dbacca91fa5196d Mon Sep 17 00:00:00 2001 From: liumengyi Date: Sun, 6 Nov 2022 16:03:14 +0800 Subject: [PATCH] * Fix bug for manage chart group. --- module/action/lang/de.php | 1 + module/action/lang/en.php | 1 + module/action/lang/fr.php | 1 + module/action/lang/zh-cn.php | 1 + module/action/model.php | 7 +++++++ module/tree/control.php | 4 ++-- module/tree/model.php | 20 +++++++++++++------- 7 files changed, 26 insertions(+), 9 deletions(-) diff --git a/module/action/lang/de.php b/module/action/lang/de.php index f11ff708dd..2b681adce2 100644 --- a/module/action/lang/de.php +++ b/module/action/lang/de.php @@ -720,6 +720,7 @@ $lang->action->label->gitlab = 'GitLab Server|gitlab|view|id=%s'; $lang->action->label->stage = 'Stage|stage|browse|'; $lang->action->label->module = 'Module|tree|browse|productid=%s&type=story¤tModuleID=0&branch=all'; $lang->action->label->ticket = 'Ticket|ticket|view|id=%s'; +$lang->action->label->chartgroup = 'Group'; /* Object type. */ $lang->action->search = new stdclass(); diff --git a/module/action/lang/en.php b/module/action/lang/en.php index fbdaf2970f..7f607016ea 100755 --- a/module/action/lang/en.php +++ b/module/action/lang/en.php @@ -720,6 +720,7 @@ $lang->action->label->gitlab = 'GitLab Server|gitlab|view|id=%s'; $lang->action->label->stage = 'Stage|stage|browse|'; $lang->action->label->module = 'Module|tree|browse|productid=%s&type=story¤tModuleID=0&branch=all'; $lang->action->label->ticket = 'Ticket|ticket|view|id=%s'; +$lang->action->label->chartgroup = 'Group'; /* Object type. */ $lang->action->search = new stdclass(); diff --git a/module/action/lang/fr.php b/module/action/lang/fr.php index 1e033620da..ecbe62e3bb 100644 --- a/module/action/lang/fr.php +++ b/module/action/lang/fr.php @@ -720,6 +720,7 @@ $lang->action->label->gitlab = 'GitLab Server|gitlab|view|id=%s'; $lang->action->label->stage = 'Stage|stage|browse|'; $lang->action->label->module = 'Module|tree|browse|productid=%s&type=story¤tModuleID=0&branch=all'; $lang->action->label->ticket = 'Ticket|ticket|view|id=%s'; +$lang->action->label->chartgroup = 'Group'; /* Object type. */ $lang->action->search = new stdclass(); diff --git a/module/action/lang/zh-cn.php b/module/action/lang/zh-cn.php index 2ba8f216e4..d210a91381 100755 --- a/module/action/lang/zh-cn.php +++ b/module/action/lang/zh-cn.php @@ -720,6 +720,7 @@ $lang->action->label->gitlab = 'GitLab服务器|gitlab|view|id=%s'; $lang->action->label->stage = '瀑布模型的阶段|stage|browse|'; $lang->action->label->module = '模块|tree|browse|productid=%s&type=story¤tModuleID=0&branch=all'; $lang->action->label->ticket = '工单|ticket|view|id=%s'; +$lang->action->label->chartgroup = '分组'; /* Object type. */ $lang->action->search = new stdclass(); diff --git a/module/action/model.php b/module/action/model.php index 1d4df4b1aa..2787d00c40 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -1620,6 +1620,13 @@ class actionModel extends model $action->objectLink = helper::createLink('kanban', 'view', "kanbanID=$kanbanID"); } + if($action->objectType == 'chartgroup' and $action->action != 'deleted') + { + $group = $this->dao->select('*')->from(TABLE_MODULE)->where('id')->eq($action->objectID)->fetch(); + if(empty($group)) $action->objectLink = ''; + if(!empty($group)) $action->objectLink = helper::createLink('chart', 'browseGroup', "rootID=$group->root"); + } + if($action->objectType == 'branch' and $action->action == 'mergedbranch') { $action->objectLink = 'javascript:void(0)'; diff --git a/module/tree/control.php b/module/tree/control.php index d26b24104f..b7c99e3817 100644 --- a/module/tree/control.php +++ b/module/tree/control.php @@ -382,7 +382,7 @@ class tree extends control { $this->view->optionMenu = $this->tree->getTaskOptionMenu($module->root); } - else + else if($type != 'chart') { $this->view->optionMenu = $this->tree->getOptionMenu($module->root, $module->type, 0, $module->branch); } @@ -486,7 +486,7 @@ class tree extends control if($module->type == 'doc') $confirmLang = $this->lang->tree->confirmDeleteMenu; if($module->type == 'line') $confirmLang = $this->lang->tree->confirmDeleteLine; if($module->type == 'host') $confirmLang = $this->lang->tree->confirmDeleteHost; - if($module->type == 'bi') $confirmLang = $this->lang->tree->confirmDeleteGroup; + if($module->type == 'chart') $confirmLang = $this->lang->tree->confirmDeleteGroup; die(js::confirm($confirmLang, $this->createLink('tree', 'delete', "rootID=$rootID&moduleID=$moduleID&confirm=yes"))); } else diff --git a/module/tree/model.php b/module/tree/model.php index e082e56a07..fdbbdff132 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -1756,10 +1756,11 @@ class treeModel extends model } } - if($type == 'story') + if($type == 'story' or $type == 'chart') { + $objectType = $type == 'story' ? 'module' : 'chartgroup'; $this->loadModel('action'); - if(!empty($createIdList)) $actionID = $this->action->create('module', $rootID, 'created', '', implode(',', $createIdList)); + if(!empty($createIdList)) $actionID = $this->action->create($objectType, $rootID, 'created', '', implode(',', $createIdList)); if(!empty($editIdList)) { @@ -1778,7 +1779,7 @@ class treeModel extends model $changes[] = $change; } } - $actionID = $this->action->create('module', $rootID, 'edited', '', implode(',', $editIdList)); + $actionID = $this->action->create($objectType, $rootID, 'edited', '', implode(',', $editIdList)); if(!empty($changes)) $this->action->logHistory($actionID, $changes); } } @@ -1814,8 +1815,9 @@ class treeModel extends model $this->dao->update(TABLE_MODULE)->set('owner')->eq($this->post->owner)->where('id')->in($childs)->andWhere('owner')->eq('')->exec(); $this->dao->update(TABLE_MODULE)->set('owner')->eq($this->post->owner)->where('id')->in($childs)->andWhere('owner')->eq($self->owner)->exec(); - if($self->type == 'story') + if($self->type == 'story' or $self->type == 'chart') { + $objectType = $self->type == 'story' ? 'module' : 'chartgroup'; $rootID = isset($module->root) ? $module->root : $self->root; $newModules = $this->getOptionMenu($rootID, 'story', 0, 'all'); @@ -1829,11 +1831,11 @@ class treeModel extends model break; } } - $actionID = $this->loadModel('action')->create('module', $self->root, 'edited', '', $moduleID); + $actionID = $this->loadModel('action')->create($objectType, $self->root, 'edited', '', $moduleID); if(!empty($changes)) $this->action->logHistory($actionID, $changes); if(isset($module->root) and $module->root != $self->root) { - $actionID = $this->action->create('module', $rootID, 'edited', '', $moduleID); + $actionID = $this->action->create($objectType, $rootID, 'edited', '', $moduleID); if(!empty($changes)) $this->action->logHistory($actionID, $changes); } } @@ -1927,11 +1929,12 @@ class treeModel extends model $childs = $this->getAllChildId($moduleID); $childs[$moduleID] = $moduleID; + $objectType = (!empty($module->type) and $module->type == 'chart') ? 'chartgroup' : 'module'; /* Mark deletion when delete a module. */ $this->dao->update(TABLE_MODULE)->set('deleted')->eq(1)->where('id')->in($childs)->exec(); foreach($childs as $childID) { - $this->loadModel('action')->create('module', $childID, 'deleted', '', $extra = ACTIONMODEL::CAN_UNDELETED); + $this->loadModel('action')->create($objectType, $childID, 'deleted', '', $extra = ACTIONMODEL::CAN_UNDELETED); } $this->fixModulePath($module->root, $module->type); @@ -1960,6 +1963,9 @@ class treeModel extends model $this->dao->update(TABLE_CASE)->set('module')->eq($module->parent)->where('module')->in($childs)->exec(); $cookieName = 'storyModule'; break; + case 'chart': + $this->dao->update(TABLE_CHART)->set('`group`')->eq($module->parent)->where('`group`')->in($childs)->exec(); + break; } if(strpos($this->session->{$module->type . 'List'}, 'param=' . $moduleID)) $this->session->set($module->type . 'List', str_replace('param=' . $moduleID, 'param=0', $this->session->{$module->type . 'List'})); if($cookieName) setcookie($cookieName, 0, time() - 3600, $this->config->webRoot, '', $this->config->cookieSecure, false);