From aaeeb9372d8c0239527c3a4c8b97c29948fae9a6 Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Sun, 19 Feb 2023 09:17:49 +0000 Subject: [PATCH] * Code for task #84583. --- db/zentaopms284.sql | 2 ++ module/execution/js/all.js | 17 +++++++++++++++++ module/execution/model.php | 9 +++++---- module/execution/view/all.html.php | 29 ++--------------------------- module/programplan/model.php | 8 ++++++-- 5 files changed, 32 insertions(+), 33 deletions(-) diff --git a/db/zentaopms284.sql b/db/zentaopms284.sql index 91fe06b398..c9978a3866 100644 --- a/db/zentaopms284.sql +++ b/db/zentaopms284.sql @@ -4,3 +4,5 @@ REPLACE INTO `zt_lang` (`lang`, `module`, `section`, `key`, `value`, `system`, ` REPLACE INTO `zt_lang` (`lang`, `module`, `section`, `key`, `value`, `system`, `vision`) SELECT `lang`, `module`, 'agileplusClassify', `key`, `value`, `system`, `vision` FROM `zt_lang` WHERE `module` = 'process' and `section` = 'classify' ORDER BY id ASC; UPDATE `zt_project` AS parent INNER JOIN (select `id`,`parent`,`attribute` from `zt_project` where `parent` != 0 and `type` = 'stage') AS child ON parent.`id` = child.`parent` SET parent.`attribute`='mix' where parent.`grade`=1 and parent.`type`='stage' and parent.`attribute` != child.`attribute`; + +REPLACE INTO `zt_grouppriv` (SELECT `group`,`module`,'batchChangeStatus' FROM `zt_grouppriv` WHERE `module` = 'execution' AND `method` = 'batchEdit'); diff --git a/module/execution/js/all.js b/module/execution/js/all.js index 4e5cfbee4a..91ef53a14a 100644 --- a/module/execution/js/all.js +++ b/module/execution/js/all.js @@ -52,3 +52,20 @@ function setBadgeStyle(obj, isShow) $label.find('.label-badge').css({"color":"#838a9d", "border-color":"#838a9d"}); } } + +function buildForm(action, target) +{ + var tempform = document.createElement("form"); + tempform.action = action; + tempform.method = "post"; + tempform.target = typeof(target) == 'undefined' ? '' : target; + tempform.style.display = "none"; + + var opt = document.createElement("input"); + opt.name = 'executionIDList'; + opt.value = checkItems; + + tempform.appendChild(opt); + document.body.appendChild(tempform); + tempform.submit(); +} diff --git a/module/execution/model.php b/module/execution/model.php index 2c76c4d05e..62f17fc31b 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -985,12 +985,13 @@ class executionModel extends model $this->loadModel('programplan'); $this->loadModel('action'); - $selfAndChildrenList = $this->programplan->getSelfAndChildrenList($executionIdList); - $siblingStages = $this->programplan->getSiblings($executionIdList); - $pointOutStages = ''; - + $pointOutStages = ''; foreach($executionIdList as $executionID) { + /* The state of the parent stage or the sibling stage may be affected by the child stage before the change, so it cannot be checked in advance. */ + $selfAndChildrenList = $this->programplan->getSelfAndChildrenList($executionID); + $siblingStages = $this->programplan->getSiblings($executionID); + $selfAndChildren = $selfAndChildrenList[$executionID]; $execution = $selfAndChildren[$executionID]; $executionType = $execution->type; diff --git a/module/execution/view/all.html.php b/module/execution/view/all.html.php index b6007fc541..95b7521673 100644 --- a/module/execution/view/all.html.php +++ b/module/execution/view/all.html.php @@ -160,37 +160,12 @@ js::set('isCNLang', !$this->loadModel('common')->checkNotCN()); $('#batchEditBtn').click(function() { - var batchEditLink = createLink('execution', 'batchEdit'); - var tempform = document.createElement("form"); - tempform.action = batchEditLink; - tempform.method = "post"; - tempform.style.display = "none"; - - var opt = document.createElement("input"); - opt.name = 'executionIDList'; - opt.value = checkItems; - - tempform.appendChild(opt); - document.body.appendChild(tempform); - tempform.submit(); + buildForm(createLink('execution', 'batchEdit')); }) $('.statusLink').click(function() { - var changeStatusLink = $(this).data('link'); - var tempform = document.createElement("form"); - tempform.action = changeStatusLink; - tempform.method = "post"; - tempform.target = "hiddenwin"; - tempform.style.display = "none"; - - var opt = document.createElement("input"); - opt.name = 'executionIDList'; - opt.value = checkItems; - - tempform.appendChild(opt); - document.body.appendChild(tempform); - tempform.submit(); + buildForm($(this).data('link'), 'hiddenwin'); }) diff --git a/module/programplan/model.php b/module/programplan/model.php index 05efcceeb2..746d1b9cd5 100755 --- a/module/programplan/model.php +++ b/module/programplan/model.php @@ -1620,12 +1620,14 @@ class programplanModel extends model /** * Get plan and its children. * - * @param array $planIdList + * @param string|int|array $planIdList * @access public * @return array */ public function getSelfAndChildrenList($planIdList) { + if(is_numeric($planIdList)) $planIdList = (array)$planIdList; + $planList = $this->dao->select('t2.*')->from(TABLE_EXECUTION)->alias('t1') ->leftJoin(TABLE_EXECUTION)->alias('t2')->on('FIND_IN_SET(t1.id,t2.`path`)') ->where('t1.id')->in($planIdList) @@ -1648,12 +1650,14 @@ class programplanModel extends model /** * Get plan's siblings. * - * @param array $planIdList + * @param string|int|array $planIdList * @access public * @return array */ public function getSiblings($planIdList) { + if(is_numeric($planIdList)) $planIdList = (array)$planIdList; + $siblingsList = $this->dao->select('t1.*')->from(TABLE_EXECUTION)->alias('t1') ->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.parent=t2.parent') ->where('t2.id')->in($planIdList)