* List of component names.
* @param array $metadata
* Specification of the setting (per *.settings.php).
+ *
+ * @throws \CRM_Core_Exception.
*/
public static function onToggleComponents($oldValue, $newValue, $metadata) {
if (
$pathToCaseSampleTpl = __DIR__ . '/xml/configuration.sample/';
self::loadCaseSampleData($pathToCaseSampleTpl . 'case_sample.mysql.tpl');
if (!CRM_Case_BAO_Case::createCaseViews()) {
- $msg = ts("Could not create the MySQL views for CiviCase. Your mysql user needs to have the 'CREATE VIEW' permission");
- CRM_Core_Error::fatal($msg);
+ throw new CRM_Core_Exception(ts("Could not create the MySQL views for CiviCase. Your mysql user needs to have the 'CREATE VIEW' permission"));
}
}
}
}
else {
if ($this->_action & CRM_Core_Action::VIEW) {
- CRM_Core_Error::fatal('Contact Id is required for view action.');
+ CRM_Core_Error::statusBounce('Contact Id is required for view action.');
}
}
* @param string $caseType
* @param array $params
*
- * @return bool
- * @throws Exception
+ * @throws CRM_Core_Exception
*/
public function run($caseType, &$params) {
$xml = $this->retrieve($caseType);
if ($xml === FALSE) {
$docLink = CRM_Utils_System::docURL2("user/case-management/set-up");
- CRM_Core_Error::fatal(ts("Configuration file could not be retrieved for case type = '%1' %2.",
+ throw new CRM_Core_Exception(ts("Configuration file could not be retrieved for case type = '%1' %2.",
[1 => $caseType, 2 => $docLink]
));
- return FALSE;
}
$xmlProcessorProcess = new CRM_Case_XMLProcessor_Process();
$xml = $this->retrieve($caseType);
if ($xml === FALSE) {
$docLink = CRM_Utils_System::docURL2("user/case-management/set-up");
- CRM_Core_Error::fatal(ts("Unable to load configuration file for the referenced case type: '%1' %2.",
+ throw new CRM_Core_Exception(ts("Unable to load configuration file for the referenced case type: '%1' %2.",
[1 => $caseType, 2 => $docLink]
));
- return FALSE;
}
switch ($fieldSet) {
$params
)
) {
- CRM_Core_Error::fatal();
- return FALSE;
+ throw new CRM_Core_Exception('Unable to create case relationships');
}
}
}
list($relationshipType, $relationshipTypeName) = $this->locateNameOrLabel($relationshipTypeXML);
if ($relationshipType === FALSE) {
$docLink = CRM_Utils_System::docURL2("user/case-management/set-up");
- CRM_Core_Error::fatal(ts('Relationship type %1, found in case configuration file, is not present in the database %2',
+ throw new CRM_Core_Exception(ts('Relationship type %1, found in case configuration file, is not present in the database %2',
[1 => $relationshipTypeName, 2 => $docLink]
));
- return FALSE;
}
$client = $params['clientID'];
}
if (!$this->createRelationship($relationshipParams)) {
- CRM_Core_Error::fatal();
- return FALSE;
+ throw new CRM_Core_Exception('Unable to create case relationship');
}
}
return TRUE;
if (!$activityTypeInfo) {
$docLink = CRM_Utils_System::docURL2("user/case-management/set-up");
- CRM_Core_Error::fatal(ts('Activity type %1, found in case configuration file, is not present in the database %2',
+ throw new CRM_Core_Exception(ts('Activity type %1, found in case configuration file, is not present in the database %2',
[1 => $activityTypeName, 2 => $docLink]
));
- return FALSE;
}
$activityTypeID = $activityTypeInfo['id'];
$activity = CRM_Activity_BAO_Activity::create($activityParams);
if (!$activity) {
- CRM_Core_Error::fatal();
- return FALSE;
+ throw new CRM_Core_Exception('Unable to create Activity');
}
// create case activity record
$xml = $this->retrieve($caseType);
if ($xml === FALSE) {
- CRM_Core_Error::fatal();
- return FALSE;
+ throw new CRM_Core_Exception('Unable to read supplied XML File');
}
$activityInstances = $this->activityTypes($xml->ActivityTypes, TRUE);
* @param bool $force
*
* @return CRM_Core_Component_Info[]
- * @throws Exception
+ * @throws CRM_Core_Exception
*/
public static function &getComponents($force = FALSE) {
if (!isset(Civi::$statics[__CLASS__]['all']) || $force) {
require_once $infoClassFile;
$infoObject = new $infoClass($cr->name, $cr->namespace, $cr->id);
if ($infoObject->info['name'] !== $cr->name) {
- CRM_Core_Error::fatal("There is a discrepancy between name in component registry and in info file ({$cr->name}).");
+ throw new CRM_Core_Exception("There is a discrepancy between name in component registry and in info file ({$cr->name}).");
}
Civi::$statics[__CLASS__]['all'][$cr->name] = $infoObject;
unset($infoObject);
* @param string $className
*
* @return mixed
- * @throws Exception
+ * @throws CRM_Core_Exception
*/
public static function create($className) {
$type = self::$_classes[$className] ?? NULL;
if (!$type) {
- CRM_Core_Error::fatal("class $className not found");
+ throw new CRM_Core_Exception("class $className not found");
}
$class = self::$_prefix[$type] . $className;
return CRM_Utils_System::redirect();
}
else {
- CRM_Core_Error::fatal('You do not have permission to execute this url');
+ CRM_Core_Error::statusBounce('You do not have permission to execute this url');
}
}
}
if (!array_key_exists('page_callback', $item)) {
CRM_Core_Error::debug('Bad item', $item);
- CRM_Core_Error::fatal(ts('Bad menu record in database'));
+ CRM_Core_Error::statusBounce(ts('Bad menu record in database'));
}
// check that we are permissioned to access this page
$object = new $item['page_callback']($title, TRUE, $mode, NULL, $addSequence);
}
else {
- CRM_Core_Error::fatal();
+ throw new CRM_Core_Exception('Execute supplied menu action');
}
$result = $object->run($newArgs, $pageArgs);
}
* @param string $permissionName
* Name of the permission we are interested in.
*
+ * @throws CRM_Core_Exception.
*/
public function permissionEmails($permissionName) {
- CRM_Core_Error::fatal("this function only works in Drupal 6 at the moment");
+ throw new CRM_Core_Exception("this function only works in Drupal 6 at the moment");
}
/**
* @param string $roleName
* Name of the role we are interested in.
*
+ * @throws CRM_Core_Exception.
*/
public function roleEmails($roleName) {
- CRM_Core_Error::fatal("this function only works in Drupal 6 at the moment");
+ throw new CRM_Core_Exception("this function only works in Drupal 6 at the moment");
}
/**