From f8fca4d1f22ac3a610567ec7fbf4a1708b09edb3 Mon Sep 17 00:00:00 2001 From: wangyuting Date: Tue, 29 Jul 2025 14:18:23 +0800 Subject: [PATCH] * [task#147124,doing,2h,2h] Add design deliverable. --- module/upgrade/config/upgradeflow.php | 2 +- module/upgrade/model.php | 45 +++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/module/upgrade/config/upgradeflow.php b/module/upgrade/config/upgradeflow.php index 02dc5dd114..ff3a88d526 100644 --- a/module/upgrade/config/upgradeflow.php +++ b/module/upgrade/config/upgradeflow.php @@ -112,7 +112,7 @@ $config->upgrade->execFlow['21_6_beta'] = array('functions' => 'processCharter $config->upgrade->execFlow['21_6_1'] = array('xxsqls' => "$appRoot/db/upgradexuanxuan9.1.2.sql"); $config->upgrade->execFlow['21_7'] = array('functions' => 'fixWorkflowNameForExecution'); $config->upgrade->execFlow['21_7_1'] = array('functions' => 'convertCharset,processActionProduct'); -$config->upgrade->execFlow['21_7_3'] = array('functions' => 'addDefaultDeliverableModule'); +$config->upgrade->execFlow['21_7_3'] = array('functions' => 'addDefaultDeliverableModule,upgradeDesignToDeliverable'); if(!empty($config->isINT)) { diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 7c45c2ede4..efd0d89012 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -11232,4 +11232,49 @@ class upgradeModel extends model $this->dao->update(TABLE_MODULE)->set('path')->eq(",$moduleID,")->where('id')->eq($moduleID)->exec(); } } + + /** + * 升级设计类型为交付物。 + * Upgrade design type to deliverable. + * + * @access public + * @return void + */ + public function upgradeDesignToDeliverable() + { + $modelList = array('waterfall', 'waterfallplus', 'ipd'); + $moduleList = $this->dao->select('t1.id,t1.name,t2.projectModel,t2.id as workflowGroup')->from(TABLE_MODULE)->alias('t1') + ->leftJoin(TABLE_WORKFLOWGROUP)->alias('t2')->on('t1.root=t2.id') + ->where('t1.type')->eq('deliverable') + ->andWhere('t1.extra')->eq('design') + ->andWhere('t2.projectModel')->in($modelList) + ->fetchAll(); + + $this->app->loadLang('design'); + foreach($moduleList as $module) + { + $nameFilter = array(); + + $deliverable = new stdClass(); + $deliverable->workflowGroup = $module->workflowGroup; + $deliverable->module = $module->id; + $deliverable->status = 'disabled'; + $deliverable->createdBy = 'system'; + $deliverable->createdDate = helper::now(); + $deliverable->template = '[]'; + foreach(array_filter($this->lang->design->typeList) as $key => $value) + { + if(empty($key) || !in_array($module->projectModel, array('waterfall', 'ipd'))) continue; + + $this->dao->insert(TABLE_DELIVERABLE)->data($deliverable)->exec(); + $deliverableID = $this->dao->lastInsertID(); + + $deliverableStage = new stdClass(); + $deliverableStage->deliverable = $deliverableID; + $deliverableStage->stage = 'project'; + $deliverableStage->required = '0'; + $this->dao->insert(TABLE_DELIVERABLESTAGE)->data($deliverableStage)->exec(); + } + } + } }