This commit is contained in:
wangyuting2
2022-09-27 03:07:47 +00:00
parent b43b1c844a
commit 3874a3e22b
2 changed files with 43 additions and 1 deletions
+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;
}
}
}