Merge branch 'sprint/biz17' of https://gitlab.zcorp.cc/easycorp/zentaopms into sprint/biz17

This commit is contained in:
zhujinyong
2022-11-08 14:09:44 +08:00
16 changed files with 114 additions and 22 deletions
+1
View File
@@ -345,6 +345,7 @@ if(!defined('TABLE_SEARCHDICT')) define('TABLE_SEARCHDICT', $config->db->prefi
define('TABLE_CHART', '`' . $config->db->prefix . 'chart`');
define('TABLE_DASHBOARD', '`' . $config->db->prefix . 'dashboard`');
define('TABLE_DATASET', '`' . $config->db->prefix . 'dataset`');
define('TABLE_DIMENSION', '`' . $config->db->prefix . 'dimension`');
$config->objectTables['product'] = TABLE_PRODUCT;
$config->objectTables['productplan'] = TABLE_PRODUCTPLAN;
+39
View File
@@ -0,0 +1,39 @@
ALTER TABLE `zt_chart` ADD `group` mediumint(8) unsigned NOT NULL default '0' AFTER `type`;
ALTER TABLE `zt_chart` MODIFY COLUMN `desc` text NOT NULL;
ALTER TABLE `zt_chart` ADD `editedBy` varchar(30) NOT NULL AFTER `createdDate`;
ALTER TABLE `zt_chart` ADD `editedDate` datetime NOT NULL AFTER `editedBy`;
INSERT INTO `zt_module` (`root`, `branch`, `name`, `parent`, `path`, `grade`, `order`, `type`, `owner`, `collector`, `short`, `deleted`) VALUES
(0, 0, '产品', 0, ',0,', 1, 10, 'chart', 'system', '', '', '0'),
(0, 0, '项目', 0, ',0,', 1, 20, 'chart', 'system', '', '', '0'),
(0, 0, '测试', 0, ',0,', 1, 30, 'chart', 'system', '', '', '0'),
(0, 0, '组织', 0, ',0,', 1, 40, 'chart', 'system', '', '', '0');
UPDATE `zt_chart` SET `group` = (SELECT `id` FROM `zt_module` WHERE `type` = 'chart' AND `name` = '产品' limit 1);
UPDATE `zt_module` SET `path` = CONCAT(',', `id`, ',') WHERE `type` = 'chart' AND `name` in ('产品', '项目', '测试', '组织');
DROP TABLE IF EXISTS `zt_dimension`;
CREATE TABLE IF NOT EXISTS `zt_dimension` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(90) NOT NULL,
`code` varchar(45) NOT NULL,
`desc` text NOT NULL,
`createdBy` varchar(30) NOT NULL,
`createdDate` datetime NOT NULL,
`editedBy` varchar(30) NOT NULL,
`editedDate` datetime NOT NULL,
`deleted` enum('0','1') NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `zt_dimension` (`name`, `code`, `desc`, `createdBy`, `createdDate`, `editedBy`, `editedDate`) VALUES('default', 'default', '', 'system', NOW(), 'system', NOW());
ALTER TABLE `zt_report` ADD `dimension` int(8) NOT NULL default 0 AFTER `name`;
ALTER TABLE `zt_chart` ADD `dimension` int(8) NOT NULL default 0 AFTER `name`;
--ALTER TABLE `zt_dataset` ADD `dimension` int(8) NOT NULL default 0 AFTER `name`;
ALTER TABLE `zt_dashboard` ADD `dimension` int(8) NOT NULL default 0 AFTER `name`;
UPDATE `zt_chart` SET `dimension` = 1 WHERE `dimension` = 0;
UPDATE `zt_report` SET `dimension` = 1 WHERE `dimension` = 0;
UPDATE `zt_dashboard` SET `dimension` = 1 WHERE `dimension` = 0;
UPDATE `zt_module` SET `root` = 1 WHERE `root` = 0 AND `type` in ('chart', 'dashboard');
+18 -1
View File
@@ -429,12 +429,15 @@ CREATE TABLE `zt_chart` (
`id` mediumint NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`type` varchar(30) NOT NULL,
`group` varchar(30) NOT NULL,
`dataset` varchar(30) NOT NULL,
`desc` mediumtext NOT NULL,
`desc` text NOT NULL,
`settings` mediumtext NOT NULL,
`filters` mediumtext NOT NULL,
`createdBy` char(30) NOT NULL,
`createdDate` datetime NOT NULL,
`editedBy` char(30) NOT NULL,
`editedDate` datetime NOT NULL,
`deleted` tinyint NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -7545,6 +7548,20 @@ CREATE TABLE IF NOT EXISTS `zt_deployscope` (
`remove` text NOT NULL,
`add` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- DROP TABLE IF EXISTS `zt_dimension`;
CREATE TABLE IF NOT EXISTS `zt_dimension` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(90) NOT NULL,
`code` varchar(45) NOT NULL,
`desc` text NOT NULL,
`createdBy` varchar(30) NOT NULL,
`createdDate` datetime NOT NULL,
`editedBy` varchar(30) NOT NULL,
`editedDate` datetime NOT NULL,
`deleted` enum('0','1') NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- DROP TABLE IF EXISTS `zt_vm`;
CREATE TABLE IF NOT EXISTS `zt_vm` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+1
View File
@@ -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&currentModuleID=0&branch=all';
$lang->action->label->ticket = 'Ticket|ticket|view|id=%s';
$lang->action->label->chartgroup = 'Group';
/* Object type. */
$lang->action->search = new stdclass();
+1
View File
@@ -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&currentModuleID=0&branch=all';
$lang->action->label->ticket = 'Ticket|ticket|view|id=%s';
$lang->action->label->chartgroup = 'Group';
/* Object type. */
$lang->action->search = new stdclass();
+1
View File
@@ -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&currentModuleID=0&branch=all';
$lang->action->label->ticket = 'Ticket|ticket|view|id=%s';
$lang->action->label->chartgroup = 'Group';
/* Object type. */
$lang->action->search = new stdclass();
+1
View File
@@ -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&currentModuleID=0&branch=all';
$lang->action->label->ticket = '工单|ticket|view|id=%s';
$lang->action->label->chartgroup = '分组';
/* Object type. */
$lang->action->search = new stdclass();
+16 -11
View File
@@ -1267,7 +1267,7 @@ class actionModel extends model
$objectName = ($objectType == 'productplan' or $objectType == 'ticket') ? 'title' : 'name';
$action->objectName = $this->dao->select($objectName)->from($objectTable)->where('id')->eq($action->extra)->fetch($objectName);
}
elseif($action->objectType == 'module' and !empty($action->extra) and $action->action != 'deleted')
elseif(strpos(',module,chartgroup,', ",$action->objectType,") !== false and !empty($action->extra) and $action->action != 'deleted')
{
$modules = $this->dao->select('id,name')->from(TABLE_MODULE)->where('id')->in(explode(',', $action->extra))->fetchPairs('id');
$action->objectName = implode(',', $modules);
@@ -1443,6 +1443,16 @@ class actionModel extends model
if(!is_array($objectLabel)) $actionObjectLabel = $objectLabel;
if(is_array($objectLabel) and isset($objectLabel[$actionType])) $actionObjectLabel = $objectLabel[$actionType];
if($objectType == 'module' and $actionType == 'deleted')
{
$moduleType = $this->dao->select('type')->from(TABLE_MODULE)->where('id')->eq($objectID)->fetch('type');
if($moduleType == 'doc')
{
$this->app->loadLang('doc');
$actionObjectLabel = $this->lang->doc->menuTitle;
}
}
}
if($this->config->edition == 'max' and $objectType == 'assetlib')
@@ -1620,21 +1630,16 @@ class actionModel extends model
$action->objectLink = helper::createLink('kanban', 'view', "kanbanID=$kanbanID");
}
if($action->objectType == 'chartgroup' and $action->action != 'deleted')
{
$action->objectLink = helper::createLink('chart', 'browseGroup', "rootID=$action->objectID");
}
if($action->objectType == 'branch' and $action->action == 'mergedbranch')
{
$action->objectLink = 'javascript:void(0)';
}
if($action->objectType == 'module')
{
$moduleType = $this->dao->select('type')->from(TABLE_MODULE)->where('id')->eq($action->objectID)->fetch('type');
if($moduleType == 'doc')
{
$this->app->loadLang('doc');
$action->objectLabel = $this->lang->doc->menuTitle;
}
}
if($action->objectType == 'review')
{
$action->objectLink = helper::createLink('review', 'view', "reviewID=$action->objectID");
+1 -1
View File
@@ -75,7 +75,7 @@
<?php if($action->action != 'login' and $action->action != 'logout'):?>
<span class="text"><?php echo $action->objectLabel;?></span>
<?php if($action->objectID):?>
<span class="label label-id"><?php echo ($action->objectType == 'module' and strpos(',created,edited,moved,', "$action->action") !== false) ? trim($action->extra, ',') : $action->objectID;?></span>
<span class="label label-id"><?php echo (strpos(',module,chartgroup,', ",$action->objectType,") !== false and strpos(',created,edited,moved,', "$action->action") !== false) ? trim($action->extra, ',') : $action->objectID;?></span>
<?php endif;?>
<?php $tab = '';?>
<?php if($action->objectType == 'meeting') $tab = $action->project ? "data-app='project'" : "data-app='my'";?>
+1 -1
View File
@@ -59,7 +59,7 @@
<?php if($action->action != 'login' and $action->action != 'logout'):?>
<?php echo $action->objectLabel;?>
<?php if($action->objectID):?>
<span class="label label-id"><?php echo $action->objectID;?></span>
<span class="label label-id"><?php echo (strpos(',module,chartgroup,', ",$action->objectType,") !== false and strpos(',created,edited,moved,', "$action->action") !== false) ? trim($action->extra, ',') : $action->objectID;?></span>
<?php endif;?>
<?php $tab = '';?>
<?php if($action->objectType == 'meeting') $tab = $action->project ? "data-app='project'" : "data-app='my'";?>
+2 -1
View File
@@ -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,6 +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 == 'chart') $confirmLang = $this->lang->tree->confirmDeleteGroup;
die(js::confirm($confirmLang, $this->createLink('tree', 'delete', "rootID=$rootID&moduleID=$moduleID&confirm=yes")));
}
else
+1
View File
@@ -43,6 +43,7 @@ $lang->tree->confirmDelete = 'Do you want to delete this module and its c
$lang->tree->confirmDeleteMenu = 'Do you want to delete this menu and its child menus?';
$lang->tree->confirmDelCategory = 'Möchten Sie diese Kategorie und ihre Kinderkategorien löschen?';
$lang->tree->confirmDeleteLine = "Do you want to delete this {$lang->productCommon} line?";
$lang->tree->confirmDeleteGroup = 'Do you want to delete this group and its child groups?';
$lang->tree->confirmRoot = "Any changes to the {$lang->productCommon} will change the stories, bugs, cases of {$lang->productCommon} it belongs to, as well as the linkage of {$lang->executionCommon} and {$lang->productCommon}, which is dangerous. Do you want to change it?";
$lang->tree->confirmRoot4Doc = "Any changes to the library will change the document of library it belongs to, which is dangerous. Do you want to change it?";
$lang->tree->noSubmodule = "There are no copyable submodules under the current module!";
+1
View File
@@ -43,6 +43,7 @@ $lang->tree->confirmDelete = 'Do you want to delete this module and its c
$lang->tree->confirmDeleteMenu = 'Do you want to delete this menu and its child menus?';
$lang->tree->confirmDelCategory = 'Do you want to delete this category and its child categories?';
$lang->tree->confirmDeleteLine = "Do you want to delete this {$lang->productCommon} line?";
$lang->tree->confirmDeleteGroup = 'Do you want to delete this group and its child groups?';
$lang->tree->confirmRoot = "Any changes to the {$lang->productCommon} will change the stories, bugs, cases of {$lang->productCommon} it belongs to, as well as the linkage of {$lang->executionCommon} and {$lang->productCommon}, which is dangerous. Do you want to change it?";
$lang->tree->confirmRoot4Doc = "Any changes to the library will change the document of library it belongs to, which is dangerous. Do you want to change it?";
$lang->tree->noSubmodule = "There are no copyable submodules under the current module!";
+1
View File
@@ -42,6 +42,7 @@ $lang->tree->addChild = "Ajout Sous-Module";
$lang->tree->confirmDelete = 'Voulez-vous supprimer ce module et tous ses sous-modules ?';
$lang->tree->confirmDeleteMenu = 'Do you want to delete this menu and its child menus?';
$lang->tree->confirmDelCategory = 'Voulez-vous supprimer cette catégorie et ses sous-catégories?';
$lang->tree->confirmDeleteGroup = 'Do you want to delete this group and its child groups?';
$lang->tree->confirmDeleteLine = 'Voulez-vous supprimer cette ligne de produit ?';
$lang->tree->confirmRoot = "Les changements du {$lang->productCommon} vont impacter les stories, bugs, casTests du {$lang->productCommon} auquel ils appartiennent, ainsi que les associations de {$lang->executionCommon} et {$lang->productCommon}, ce qui est dangereux. Voulez-vous malgré tout effectuer le changement ?";
$lang->tree->confirmRoot4Doc = "Toute modification apportée à la bibliothèque modifiera le document de la bibliothèque à laquelle elle appartient, ce qui est dangereux. Voulez-vous le changer ?";
+1
View File
@@ -43,6 +43,7 @@ $lang->tree->confirmDelete = '该模块及其子模块都会被删除,
$lang->tree->confirmDeleteMenu = '该目录及其子目录都会被删除,您确定删除吗?';
$lang->tree->confirmDelCategory = '该分类及其子分类都会被删除,您确定删除吗?';
$lang->tree->confirmDeleteLine = "您确定删除该{$lang->productCommon}线吗?";
$lang->tree->confirmDeleteGroup = '该分组及其子分组都会被删除,您确定删除吗?';
$lang->tree->confirmRoot = "模块的所属{$lang->productCommon}修改,会关联修改该模块下的{$lang->SRCommon}、Bug、用例的所属{$lang->productCommon},以及{$lang->executionCommon}{$lang->productCommon}的关联关系。该操作比较危险,请谨慎操作。是否确认修改?";
$lang->tree->confirmRoot4Doc = "修改所属文档库,会同时修改该分类下文档的关联关系。该操作比较危险,请谨慎操作。是否确认修改?";
$lang->tree->noSubmodule = "当前模块下没有可复制的子模块!";
+28 -7
View File
@@ -1391,6 +1391,21 @@ class treeModel extends model
return html::a(helper::createLink('dashboard', 'browse', "type=bymodule&param={$module->id}"), $module->name, '', "id='module{$module->id}' title='{$module->name}'");
}
/**
* Create report link.
*
* @param string $type
* @param object $module
* @param array $extra
* @access public
* @return string
*/
public function createReportLink($type, $module, $extra)
{
$dimension = zget($extra, 'dimension', 0);
return html::a(helper::createLink('report', 'browsereport', "dimension={$dimension}&module={$module->id}"), $module->name, '', "id='module{$module->id}' title='{$module->name}'");
}
/**
* Get sons of a module.
*
@@ -1756,10 +1771,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 +1794,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 +1830,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 +1846,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 +1944,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 +1978,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);