Merge branch 'sprint/zentaopms240_task#70850' into 'sprint/zentaopms240'

* Do task #70850.

See merge request easycorp/zentaopms!5561
This commit is contained in:
王怡栋
2022-09-27 03:11:25 +00:00
2 changed files with 43 additions and 1 deletions
+3 -1
View File
@@ -636,11 +636,13 @@ class custom extends control
if($mode == 'lean' and empty($program)) $program = $this->loadModel('program')->createDefaultProgram();
$this->loadModel('setting')->setItem('system.common.global.mode', $mode);
$this->loadModel('setting')->setItem('system.common.global.defaultProgram', $program);
$this->setting->setItem('system.common.global.defaultProgram', $program);
/* 只有没有关联项目集的产品和项目关联到默认项目集下. */
$this->loadModel('upgrade')->relationDefaultProgram($program);
$this->custom->disableFeaturesByMode($mode);
if($mode == 'lean') $this->custom->processProjectAcl();
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'top'));
+40
View File
@@ -890,4 +890,44 @@ class customModel extends model
}
}
}
/**
* Set features to disable.
*
* @param int $mode
* @access public
* @return void
*/
public function disableFeaturesByMode($mode)
{
$disabledFeatures = '';
if($mode == 'lean')
{
$features = array('opportunity');
foreach($features as $feature)
{
$function = 'has' . ucfirst($feature) . 'Data';
if(!$this->$function()) $disabledFeatures .= "$feature,";
}
}
$this->loadModel('setting')->setItem('system.common.disabledFeatures', rtrim($disabledFeatures, ','));
}
/**
* Verify whether there is opportunity data
*
* @access public
* @return bool
*/
public function hasOpportunityData()
{
if($this->config->edition == 'max')
{
return $this->dao->select('id')->from(TABLE_OPPORTUNITY)->count();
}
else
{
return false;
}
}
}