* Optimize code.

This commit is contained in:
wangyuting2
2022-10-28 08:05:21 +00:00
parent 46aafd792c
commit b7ebe4ee2b
5 changed files with 33 additions and 11 deletions
+6
View File
@@ -233,6 +233,12 @@ class admin extends control
$this->display();
}
/**
* Set closed features config.
*
* @access public
* @return void
*/
public function setModule()
{
if($_POST)
+10 -4
View File
@@ -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;
+10 -4
View File
@@ -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;
+5 -1
View File
@@ -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();
+2 -2
View File
@@ -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)