From 798fac2b71c9813b116393df69abc97bbdd96fcd Mon Sep 17 00:00:00 2001 From: daitingting Date: Tue, 14 Oct 2025 15:08:04 +0800 Subject: [PATCH 1/2] * [story#78436,done,4h] Process decisions. --- config/zentaopms.php | 3 ++- db/update22.0.sql | 16 ++++++++++++ db/zentao.sql | 16 ++++++++++++ module/upgrade/model.php | 54 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 88 insertions(+), 1 deletion(-) diff --git a/config/zentaopms.php b/config/zentaopms.php index a574971a0c..70ab02786e 100644 --- a/config/zentaopms.php +++ b/config/zentaopms.php @@ -447,6 +447,7 @@ define('TABLE_DEMANDPOOL', '`' . $config->db->prefix . 'demandpool`'); define('TABLE_DEMAND', '`' . $config->db->prefix . 'demand`'); define('TABLE_DEMANDSPEC', '`' . $config->db->prefix . 'demandspec`'); define('TABLE_DEMANDREVIEW', '`' . $config->db->prefix . 'demandreview`'); +define('TABLE_DECISION', '`' . $config->db->prefix . 'decision`'); define('TABLE_API', '`' . $config->db->prefix . 'api`'); define('TABLE_API_SPEC', '`' . $config->db->prefix . 'apispec`'); define('TABLE_APISTRUCT', '`' . $config->db->prefix . 'apistruct`'); @@ -803,4 +804,4 @@ $config->excludeDropmenuModules = array('reporttemplate'); $config->hasSwitcherModules = array('design'); $config->hasSwitcherMethods = array('project-bug', 'project-testcase', 'execution-bug', 'execution-testcase', 'testtask-cases', 'testtask-view', 'testtask-report', 'testtask-groupcase', 'testtask-linkcase'); $config->excludeSwitcherList = array(); -$config->hasMainNavBar = array(); \ No newline at end of file +$config->hasMainNavBar = array(); diff --git a/db/update22.0.sql b/db/update22.0.sql index c705ad2b9f..6d002bf68b 100644 --- a/db/update22.0.sql +++ b/db/update22.0.sql @@ -101,3 +101,19 @@ DELETE FROM `zt_workflowgroup` WHERE `projectModel` = 'kanban'; UPDATE `zt_project` SET `workflowGroup` = '0' WHERE `model` = 'kanban'; ALTER TABLE `zt_stage` ADD `workflowGroup` mediumint(8) unsigned NOT NULL DEFAULT '0' AFTER `id`; + +CREATE TABLE IF NOT EXISTS `zt_decision` ( + `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `workflowGroup` mediumint(8) unsigned NOT NULL DEFAULT '0', + `stage` mediumint(8) unsigned NOT NULL DEFAULT '0', + `title` varchar(255) NOT NULL DEFAULT '', + `type` varchar(30) NOT NULL DEFAULT '', + `category` varchar(30) NOT NULL DEFAULT '', + `builtin` enum('0','1') NOT NULL DEFAULT '0', + `createdBy` char(30) NOT NULL DEFAULT '', + `createdDate` datetime NULL, + `editedBy` char(30) NOT NULL DEFAULT '', + `editedDate` datetime NULL, + `deleted` enum('0','1') NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; diff --git a/db/zentao.sql b/db/zentao.sql index f4ace2623a..ce773996c6 100755 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -623,6 +623,22 @@ CREATE TABLE IF NOT EXISTS `zt_deliverablestage` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; CREATE UNIQUE INDEX `unique` ON `zt_deliverablestage`(`deliverable`,`stage`); +CREATE TABLE IF NOT EXISTS `zt_decision` ( + `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `workflowGroup` mediumint(8) unsigned NOT NULL DEFAULT '0', + `stage` mediumint(8) unsigned NOT NULL DEFAULT '0', + `title` varchar(255) NOT NULL DEFAULT '', + `type` varchar(30) NOT NULL DEFAULT '', + `category` varchar(30) NOT NULL DEFAULT '', + `builtin` enum('0','1') NOT NULL DEFAULT '0', + `createdBy` char(30) NOT NULL DEFAULT '', + `createdDate` datetime NULL, + `editedBy` char(30) NOT NULL DEFAULT '', + `editedDate` datetime NULL, + `deleted` enum('0','1') NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + -- DROP TABLE IF EXISTS `zt_dimension`; CREATE TABLE IF NOT EXISTS `zt_dimension` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, diff --git a/module/upgrade/model.php b/module/upgrade/model.php index e283cf82dc..5fc5efe0ca 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -12540,6 +12540,60 @@ class upgradeModel extends model $this->dao->exec('ALTER TABLE ' . TABLE_STAGE . ' DROP COLUMN `projectType`'); } + /** + * TR和DCP评审对象升级到技术与决策评审流程。 + * Upgrade TR and DCP objects to decision flows. + * + * @access public + * @return void + */ + public function upgradeDecision() + { + $ipdProjectGroups = $this->dao->select('id')->from(TABLE_WORKFLOWGROUP)->where('type')->eq('project')->andWhere('projectModel')->eq('ipd')->andWhere('builtin')->eq('1')->fetchPairs(); + $ipdProjectStages = $this->dao->select('id,workflowGroup,type')->from(TABLE_STAGE)->where('projectType')->eq('ipd')->fetchGroup('workflowGroup'); + + $object = new stdclass(); + $object->createdBy = $this->app->user->account; + $object->createdDate = helper::now(); + + $decisionFlow = new stdclass(); + $decisionFlow->flow = 1; + $decisionFlow->objectType = 'decision'; + $decisionFlow->relatedBy = $this->app->user->account; + $decisionFlow->relatedDate = helper::now(); + $decisionFlow->extra = 'review'; + + foreach($ipdProjectGroups as $ipdProjectGroupID) + { + if(empty($ipdProjectStages[$ipdProjectGroupID])) continue; + + $object->workflowgroup = $ipdProjectGroupID; + + $decisionFlow->root = $ipdProjectGroupID; + + foreach($ipdProjectStages[$ipdProjectGroupID] as $stages) + { + foreach($stages as $stage) + { + $object->stage = $stage->id; + + $stageType = $stage->type; + foreach($this->config->review->ipdReviewPoint->$stageType as $category) + { + $object->title = $this->lang->review->reviewPoint->titleList[$category]; + $object->type = strpos($category, 'TR') === 0 ? 'TR' : 'DCP'; + $object->category = $category; + $this->dao->insert(TABLE_DECISION)->data($object)->autoCheck()->exec(); + + $decisionFlow->objectID = $this->dao->lastInsertID(); + $this->dao->insert(TABLE_APPROVALFLOWOBJECT)->data($decisionFlow)->autoCheck()->exec(); + } + } + } + } + return !dao::isError(); + } + /** * 调整 21.7.5 版本的权限 * Adjust priv 21.7.5. From cc2ba359c9fed52bade9d0b43312e49eee8073d3 Mon Sep 17 00:00:00 2001 From: daitingting Date: Tue, 14 Oct 2025 15:10:36 +0800 Subject: [PATCH 2/2] * [story#78436,done,0.1h] Add drop sql. --- db/zentao.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/db/zentao.sql b/db/zentao.sql index ce773996c6..4dfcfc359b 100755 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -623,6 +623,7 @@ CREATE TABLE IF NOT EXISTS `zt_deliverablestage` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; CREATE UNIQUE INDEX `unique` ON `zt_deliverablestage`(`deliverable`,`stage`); +-- DROP TABLE IF EXISTS `zt_decision`; CREATE TABLE IF NOT EXISTS `zt_decision` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `workflowGroup` mediumint(8) unsigned NOT NULL DEFAULT '0',