From 8f6c49b845f7316b6bdf6f54488cf9d3ddcb83fb Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Thu, 16 Oct 2025 05:29:04 +0000 Subject: [PATCH] * [task#150564] Add default point when create stage for IPD. --- db/update22.0.sql | 3 +++ db/zentao.sql | 3 ++- module/programplan/config/form.php | 29 ++++++++++++++------------- module/programplan/js/create.ui.js | 12 +++++------ module/programplan/tao.php | 4 ++-- module/programplan/ui/create.html.php | 22 +++++++++++--------- module/stage/model.php | 2 +- 7 files changed, 41 insertions(+), 34 deletions(-) diff --git a/db/update22.0.sql b/db/update22.0.sql index 5abcf6e2b9..9385561d2f 100644 --- a/db/update22.0.sql +++ b/db/update22.0.sql @@ -118,3 +118,6 @@ CREATE TABLE IF NOT EXISTS `zt_decision` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ALTER TABLE `zt_stage` ADD `workflowGroup` mediumint(8) unsigned NOT NULL DEFAULT '0' AFTER `id`; + +ALTER TABLE `zt_object` ADD `execution` mediumint(8) unsigned NOT NULL DEFAULT '0' AFTER `project`; +ALTER TABLE `zt_object` MODIFY COLUMN `type` enum('reviewed','taged','decision') NOT NULL DEFAULT 'reviewed'; diff --git a/db/zentao.sql b/db/zentao.sql index 6b106e75a6..f8762e17cb 100755 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -14926,13 +14926,14 @@ CREATE UNIQUE INDEX `time` ON `zt_measrecords` (`year`, `month`, `day`, `week`); CREATE TABLE IF NOT EXISTS `zt_object` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `project` mediumint(8) unsigned NOT NULL DEFAULT '0', + `execution` mediumint(8) unsigned NOT NULL DEFAULT '0', `product` mediumint(8) NOT NULL DEFAULT '0', `from` mediumint(8) NOT NULL DEFAULT '0', `title` varchar(255) NOT NULL DEFAULT '', `category` char(30) NOT NULL DEFAULT '', `categoryVersion` text DEFAULT NULL, `version` varchar(255) NOT NULL DEFAULT '', - `type` enum('reviewed','taged') NOT NULL DEFAULT 'reviewed', + `type` enum('reviewed','taged', 'decision') NOT NULL DEFAULT 'reviewed', `status` varchar(20) NOT NULL DEFAULT '', `approval` mediumint(8) unsigned NOT NULL DEFAULT '0', `reviewResult` varchar(20) NOT NULL DEFAULT '', diff --git a/module/programplan/config/form.php b/module/programplan/config/form.php index 1f0f691d53..ac9d0cf9cc 100644 --- a/module/programplan/config/form.php +++ b/module/programplan/config/form.php @@ -12,20 +12,21 @@ $config->programplan->form->create['name'] = array('label' => $lang->nameA $config->programplan->form->create['code'] = array('label' => $lang->code, 'type' => 'string', 'control' => 'text', 'required' => false, 'default' => '', 'filter' => 'trim'); $config->programplan->form->create['PM'] = array('label' => $lang->programplan->PMAB, 'type' => 'string', 'control' => 'picker', 'required' => false, 'default' => '', 'options' => ''); if(!empty($config->setPercent)) $config->programplan->form->create['percent'] = array('label' => $lang->programplan->percent, 'type' => 'float', 'control' => 'text', 'required' => false, 'default' => 0); -$config->programplan->form->create['attribute'] = array('label' => $lang->programplan->attribute, 'type' => 'string', 'control' => 'picker', 'required' => false, 'default' => 0, 'options' => $lang->stage->typeList); -$config->programplan->form->create['type'] = array('label' => $lang->execution->method, 'type' => 'string', 'control' => 'picker', 'required' => true, 'default' => 'stage', 'options' => $lang->execution->typeList); -$config->programplan->form->create['point'] = array('label' => $lang->programplan->point, 'type' => 'array', 'control' => 'picker', 'required' => false, 'default' => '', 'options' => array(''), 'multiple' => true); -$config->programplan->form->create['parallel'] = array('label' => '', 'type' => 'int', 'control' => 'hidden', 'required' => false, 'default' => 0); -$config->programplan->form->create['acl'] = array('label' => $lang->programplan->acl, 'type' => 'string', 'control' => 'picker', 'required' => false, 'default' => 'open', 'options' => $lang->execution->aclList); -$config->programplan->form->create['begin'] = array('label' => $lang->programplan->begin, 'type' => 'date', 'control' => 'date', 'required' => true, 'default' => null, 'skipRequired' => array('enabled' => 'off')); -$config->programplan->form->create['end'] = array('label' => $lang->programplan->end, 'type' => 'date', 'control' => 'date', 'required' => true, 'default' => null, 'skipRequired' => array('enabled' => 'off')); -$config->programplan->form->create['realBegan'] = array('label' => $lang->programplan->realBegan, 'type' => 'date', 'control' => 'date', 'required' => false, 'default' => null); -$config->programplan->form->create['realEnd'] = array('label' => $lang->programplan->realEnd, 'type' => 'date', 'control' => 'date', 'required' => false, 'default' => null); -$config->programplan->form->create['milestone'] = array('label' => $lang->programplan->milestone, 'type' => 'int', 'control' => 'radioList','required' => false, 'default' => 0, 'options' => $lang->programplan->milestoneList); -$config->programplan->form->create['desc'] = array('label' => $lang->programplan->desc, 'type' => 'string', 'control' => 'textarea', 'required' => false, 'default' => '', 'filter' => 'trim'); -$config->programplan->form->create['output'] = array('label' => '', 'type' => 'string', 'control' => 'text', 'required' => false, 'default' => ''); -$config->programplan->form->create['level'] = array('label' => '', 'type' => 'string', 'control' => 'text', 'required' => false, 'default' => 0); -$config->programplan->form->create['syncData'] = array('label' => '', 'type' => 'string', 'control' => 'text', 'required' => false, 'default' => 0); +$config->programplan->form->create['attribute'] = array('label' => $lang->programplan->attribute, 'type' => 'string', 'control' => 'picker', 'required' => false, 'default' => 0, 'options' => $lang->stage->typeList); +$config->programplan->form->create['type'] = array('label' => $lang->execution->method, 'type' => 'string', 'control' => 'picker', 'required' => true, 'default' => 'stage', 'options' => $lang->execution->typeList); +$config->programplan->form->create['point'] = array('label' => $lang->programplan->point, 'type' => 'array', 'control' => 'picker', 'required' => false, 'default' => '', 'options' => array(''), 'multiple' => true); +$config->programplan->form->create['parallel'] = array('label' => '', 'type' => 'int', 'control' => 'hidden', 'required' => false, 'default' => 0); +$config->programplan->form->create['acl'] = array('label' => $lang->programplan->acl, 'type' => 'string', 'control' => 'picker', 'required' => false, 'default' => 'open', 'options' => $lang->execution->aclList); +$config->programplan->form->create['begin'] = array('label' => $lang->programplan->begin, 'type' => 'date', 'control' => 'date', 'required' => true, 'default' => null, 'skipRequired' => array('enabled' => 'off')); +$config->programplan->form->create['end'] = array('label' => $lang->programplan->end, 'type' => 'date', 'control' => 'date', 'required' => true, 'default' => null, 'skipRequired' => array('enabled' => 'off')); +$config->programplan->form->create['realBegan'] = array('label' => $lang->programplan->realBegan, 'type' => 'date', 'control' => 'date', 'required' => false, 'default' => null); +$config->programplan->form->create['realEnd'] = array('label' => $lang->programplan->realEnd, 'type' => 'date', 'control' => 'date', 'required' => false, 'default' => null); +$config->programplan->form->create['milestone'] = array('label' => $lang->programplan->milestone, 'type' => 'int', 'control' => 'radioList','required' => false, 'default' => 0, 'options' => $lang->programplan->milestoneList); +$config->programplan->form->create['desc'] = array('label' => $lang->programplan->desc, 'type' => 'string', 'control' => 'textarea', 'required' => false, 'default' => '', 'filter' => 'trim'); +$config->programplan->form->create['output'] = array('label' => '', 'type' => 'string', 'control' => 'text', 'required' => false, 'default' => ''); +$config->programplan->form->create['level'] = array('label' => '', 'type' => 'string', 'control' => 'text', 'required' => false, 'default' => 0); +$config->programplan->form->create['syncData'] = array('label' => '', 'type' => 'string', 'control' => 'text', 'required' => false, 'default' => 0); +$config->programplan->form->create['defaultPoint'] = array('label' => '', 'type' => 'array', 'control' => 'picker', 'required' => false, 'default' => '', 'options' => array(''), 'multiple' => true); $config->programplan->form->edit = array(); $config->programplan->form->edit['parent'] = array('required' => false, 'type' => 'int', 'default' => 0); diff --git a/module/programplan/js/create.ui.js b/module/programplan/js/create.ui.js index 971ac15ae1..de98dae7a8 100644 --- a/module/programplan/js/create.ui.js +++ b/module/programplan/js/create.ui.js @@ -243,7 +243,7 @@ window.handleRenderRow = function($row, index, data) $row.find('[data-name="attribute"]').find('.picker-box').on('inited', function(e, info){ info[0].render({disabled: true}); }); - const $point = $row.find('[data-name="point"]'); + const $point = $row.find('[data-name="point"],[data-name="defaultPoint"]'); $point.find('.picker-box').on('inited', function(e, info) { let items = [{text: '', value: ''}]; @@ -259,11 +259,11 @@ window.handleRenderRow = function($row, index, data) let hint = text; /* 如果已经评审过,则置灰不能选。*/ - if(reviewedPoints[value] !== undefined && reviewedPoints[value].disabled) - { - disabled = true; - hint = reviewedPointTip; - } + //if(reviewedPoints[value] !== undefined && reviewedPoints[value].disabled) + //{ + // disabled = true; + // hint = reviewedPointTip; + //} items.push({text: text, value: point, disabled: disabled, hint: hint}); } diff --git a/module/programplan/tao.php b/module/programplan/tao.php index 812cf0a160..1f56312bb7 100644 --- a/module/programplan/tao.php +++ b/module/programplan/tao.php @@ -549,7 +549,7 @@ class programplanTao extends programplanModel $plan->openedDate = helper::now(); $plan->openedVersion = $this->config->version; if(!isset($plan->acl)) $plan->acl = $this->dao->findByID($plan->parent)->from(TABLE_PROJECT)->fetch('acl'); - $this->dao->insert(TABLE_PROJECT)->data($plan, 'point')->exec(); + $this->dao->insert(TABLE_PROJECT)->data($plan, 'point,defaultPoint')->exec(); if(dao::isError()) return false; @@ -557,7 +557,7 @@ class programplanTao extends programplanModel $this->insertProjectSpec($stageID, $plan); /* Ipd project create default review points. */ - if($project && $project->model == 'ipd' && $this->config->edition == 'ipd' && !$parentID) $this->loadModel('review')->createDefaultPoint($project->id); + if($project && $project->model == 'ipd' && $this->config->edition == 'ipd' && !$parentID) $this->loadModel('review')->createDefaultPoint($project->id, $stageID, $plan->defaultPoint); if($plan->type == 'kanban') { diff --git a/module/programplan/ui/create.html.php b/module/programplan/ui/create.html.php index d7b41d6a34..b899421bc4 100644 --- a/module/programplan/ui/create.html.php +++ b/module/programplan/ui/create.html.php @@ -181,6 +181,7 @@ $fnGenerateFields = function() use ($lang, $requiredFields, $showFields, $fields 'data-class-name' => 'text-gray border border-gray-300' ); } + if($name == 'defaultPoint') $field['hidden'] = true; if($name == 'name') $field['width'] = '240px'; if(!isset($field['width'])) $field['width'] = '120px'; @@ -205,16 +206,17 @@ $fnGenerateDefaultData = function() use ($config, $plans, $planID, $stages, $exe $DCPpoints = isset($stage->pointList['DCP']) ? array_keys($stage->pointList['DCP']) : array(); $points = array_merge($TRpoints, $DCPpoints); - $item = new stdClass(); - $item->name = $stage->name; - $item->code = isset($stage->code) ? $stage->code : ''; - $item->percent = $stage->percent; - $item->attribute = $stage->type; - $item->acl = 'open'; - $item->milestone = 0; - $item->point = implode(',', $points); - $item->parallel = 0; - $item->stageID = $stage->id; + $item = new stdClass(); + $item->name = $stage->name; + $item->code = isset($stage->code) ? $stage->code : ''; + $item->percent = $stage->percent; + $item->attribute = $stage->type; + $item->acl = 'open'; + $item->milestone = 0; + $item->point = implode(',', $points); + $item->defaultPoint = implode(',', $points); + $item->parallel = 0; + $item->stageID = $stage->id; $items[] = $item; } diff --git a/module/stage/model.php b/module/stage/model.php index 6f96ca06a6..67b360a56d 100644 --- a/module/stage/model.php +++ b/module/stage/model.php @@ -185,7 +185,7 @@ class stageModel extends model { $stage->TRpoint = isset($pointList[$stage->id]['TR']) ? implode(', ', $pointList[$stage->id]['TR']) : ''; $stage->DCPpoint = isset($pointList[$stage->id]['DCP']) ? implode(', ', $pointList[$stage->id]['DCP']) : ''; - $stage->pointList = $pointList[$stage->id]; + $stage->pointList = zget($pointList, $stage->id, array()); } return $stages; }