/**
* @param CRM_Extension_Info $info
*
- * @throws Exception
+ * @throws CRM_Core_Exception
*/
public function onPreInstall(CRM_Extension_Info $info) {
$customReports = $this->getCustomReportsByName();
if (array_key_exists($info->key, $customReports)) {
- CRM_Core_Error::fatal(ts('This report is already registered.'));
+ throw new CRM_Core_Exception(ts('This report is already registered.'));
}
if ($info->typeInfo['component'] === 'Contact') {
$compId = $comp->componentID;
}
if (empty($compId)) {
- CRM_Core_Error::fatal(ts('Component for which you are trying to install the extension (%1) is currently disabled.', [1 => $info->typeInfo['component']]));
+ throw new CRM_Core_Exception(ts('Component for which you are trying to install the extension (%1) is currently disabled.', [1 => $info->typeInfo['component']]));
}
$weight = CRM_Utils_Weight::getDefaultWeight('CRM_Core_DAO_OptionValue',
['option_group_id' => $this->groupId]
);
- $ids = [];
$params = [
'label' => $info->label . ' (' . $info->key . ')',
'value' => $info->typeInfo['reportUrl'],
'is_active' => 1,
];
- $optionValue = CRM_Core_BAO_OptionValue::add($params, $ids);
+ $optionValue = CRM_Core_BAO_OptionValue::add($params);
}
/**
* @return bool
*/
public function onPreUninstall(CRM_Extension_Info $info) {
-
- // if( !array_key_exists( $info->key, $this->customReports ) ) {
- // CRM_Core_Error::fatal( 'This report is not registered.' );
- // }
-
$customReports = $this->getCustomReportsByName();
$cr = $this->getCustomReportsById();
$id = $cr[$customReports[$info->key]];