From b7ebe4ee2b83a89051ab626c80fa296ee3a300fd Mon Sep 17 00:00:00 2001 From: wangyuting2 <851424971@qq.com> Date: Fri, 28 Oct 2022 08:05:21 +0000 Subject: [PATCH] * Optimize code. --- module/admin/control.php | 6 ++++++ module/block/control.php | 14 ++++++++++---- module/block/model.php | 14 ++++++++++---- module/custom/model.php | 6 +++++- module/group/lang/resource.php | 4 ++-- 5 files changed, 33 insertions(+), 11 deletions(-) diff --git a/module/admin/control.php b/module/admin/control.php index 1f8d6879ff..dc8dd3c1b4 100644 --- a/module/admin/control.php +++ b/module/admin/control.php @@ -233,6 +233,12 @@ class admin extends control $this->display(); } + /** + * Set closed features config. + * + * @access public + * @return void + */ public function setModule() { if($_POST) diff --git a/module/block/control.php b/module/block/control.php index 8ee7d93613..11d9b9227a 100755 --- a/module/block/control.php +++ b/module/block/control.php @@ -1752,10 +1752,16 @@ class block extends control */ public function printAssignToMeBlock($longBlock = true) { - $hasWaterfall = strpos(",{$this->config->disabledFeatures},", ',waterfall,') === false; - $hasIssue = strpos(",{$this->config->disabledFeatures},", ',scrumIssue,') === false or $hasWaterfall; - $hasRisk = strpos(",{$this->config->disabledFeatures},", ',scrumRisk,') === false or $hasWaterfall; - $hasMeeting = strpos(",{$this->config->disabledFeatures},", ',scrumMeeting,') === false or $hasWaterfall; + $hasWaterfall = strpos(",{$this->config->disabledFeatures},", ',waterfall,') === false; + $hasScrumIssue = strpos(",{$this->config->disabledFeatures},", ',scrumIssue,') === false; + $hasScrumRisk = strpos(",{$this->config->disabledFeatures},", ',scrumRisk,') === false; + $hasScrumMeeting = strpos(",{$this->config->disabledFeatures},", ',scrumMeeting,') === false; + $hasWaterfallIssue = (strpos(",{$this->config->disabledFeatures},", ',waterfallIssue,') === false and $hasWaterfall); + $hasWaterfallRisk = (strpos(",{$this->config->disabledFeatures},", ',waterfallRisk,') === false and $hasWaterfall); + $hasWaterfallMeeting = (strpos(",{$this->config->disabledFeatures},", ',waterfallMeeting,') === false and $hasWaterfall); + $hasIssue = ($hasScrumIssue or $hasWaterfallIssue); + $hasRisk = ($hasScrumRisk or $hasWaterfallRisk); + $hasMeeting = ($hasScrumMeeting or $hasWaterfallMeeting); $hasViewPriv = array(); if(common::hasPriv('todo', 'view')) $hasViewPriv['todo'] = true; diff --git a/module/block/model.php b/module/block/model.php index 1cdef805a0..f1010eb630 100644 --- a/module/block/model.php +++ b/module/block/model.php @@ -774,10 +774,16 @@ class blockModel extends model */ public function getAssignToMeParams() { - $hasWaterfall = strpos(",{$this->config->disabledFeatures},", ',waterfall,') === false; - $hasIssue = strpos(",{$this->config->disabledFeatures},", ',scrumIssue,') === false or $hasWaterfall; - $hasRisk = strpos(",{$this->config->disabledFeatures},", ',scrumRisk,') === false or $hasWaterfall; - $hasMeeting = strpos(",{$this->config->disabledFeatures},", ',scrumMeeting,') === false or $hasWaterfall; + $hasWaterfall = strpos(",{$this->config->disabledFeatures},", ',waterfall,') === false; + $hasScrumIssue = strpos(",{$this->config->disabledFeatures},", ',scrumIssue,') === false; + $hasScrumRisk = strpos(",{$this->config->disabledFeatures},", ',scrumRisk,') === false; + $hasScrumMeeting = strpos(",{$this->config->disabledFeatures},", ',scrumMeeting,') === false; + $hasWaterfallIssue = (strpos(",{$this->config->disabledFeatures},", ',waterfallIssue,') === false and $hasWaterfall); + $hasWaterfallRisk = (strpos(",{$this->config->disabledFeatures},", ',waterfallRisk,') === false and $hasWaterfall); + $hasWaterfallMeeting = (strpos(",{$this->config->disabledFeatures},", ',waterfallMeeting,') === false and $hasWaterfall); + $hasIssue = ($hasScrumIssue or $hasWaterfallIssue); + $hasRisk = ($hasScrumRisk or $hasWaterfallRisk); + $hasMeeting = ($hasScrumMeeting or $hasWaterfallMeeting); $params = new stdclass(); $params->todoCount['name'] = $this->lang->block->todoCount; diff --git a/module/custom/model.php b/module/custom/model.php index 9399111999..485235ca4b 100644 --- a/module/custom/model.php +++ b/module/custom/model.php @@ -1080,7 +1080,11 @@ class customModel extends model public function processMeasrecordCron($disabledFeatures) { $cronStatus = 'normal'; - if(strpos(",$disabledFeatures,", ',waterfall,') !== false and strpos(",$disabledFeatures,", ',scrumMeasrecord,') !== false) $cronStatus = 'stop'; + + $hasWaterfall = strpos(",{$this->config->disabledFeatures},", ',waterfall,') === false; + $hasScrumMeasrecord = strpos(",{$this->config->disabledFeatures},", ',scrumMeasrecord,') === false; + $hasWaterfallMeasrecord = (strpos(",{$this->config->disabledFeatures},", ',waterfallMeasrecord,') === false and $hasWaterfall); + if(!$hasScrumMeasrecord and !$hasWaterfallMeasrecord) $cronStatus = 'stop'; $this->loadModel('cron'); $cron = $this->dao->select('id,status')->from(TABLE_CRON)->where('command')->like('%methodName=initCrontabQueue')->fetch(); diff --git a/module/group/lang/resource.php b/module/group/lang/resource.php index 7f3b5d67b4..e697c513c1 100644 --- a/module/group/lang/resource.php +++ b/module/group/lang/resource.php @@ -1889,8 +1889,8 @@ $lang->dev->methodOrder[20] = 'translate'; global $config; $hasWaterfall = (strpos(",$config->disabledFeatures,", ',waterfall,') === false or (defined('IN_UPGRADE') and IN_UPGRADE)); -$hasProductTrack = (strpos(",$config->disabledFeatures,", ',productTrack,') === false); -$hasProductRoadmap = (strpos(",$config->disabledFeatures,", ',productRoadmap,') === false); +$hasProductTrack = (strpos(",$config->disabledFeatures,", ',productTrack,') === false or (defined('IN_UPGRADE') and IN_UPGRADE)); +$hasProductRoadmap = (strpos(",$config->disabledFeatures,", ',productRoadmap,') === false or (defined('IN_UPGRADE') and IN_UPGRADE)); $isURSR = ($config->URAndSR or (defined('IN_UPGRADE') and IN_UPGRADE)); $hasProgram = ($config->systemMode == 'new' or (defined('IN_UPGRADE') and IN_UPGRADE)); if(!$hasWaterfall)