* Do task #70850.
This commit is contained in:
@@ -635,11 +635,13 @@ class custom extends control
|
||||
if($mode == 'lean' and empty($program)) return $this->send(array('result' => 'fail', 'message' => array('program' => $this->lang->custom->switchModeHelper)));
|
||||
|
||||
$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'));
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user