* @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);