}
// function to format definition column
- $params['definition'] = self::convertDefinitionToXML($params['name'], $params['definition']);
+ if (isset($params['definition']) && is_array($params['definition'])) {
+ $params['definition'] = self::convertDefinitionToXML($params['name'], $params['definition']);
+ }
$caseTypeDAO->copyValues($params);
return $caseTypeDAO->save();
*/
function _civicrm_api3_case_type_get_formatResult(&$result) {
foreach ($result['values'] as $key => $caseType) {
- $definition = CRM_Case_BAO_CaseType::convertXmlToDefinition(
- CRM_Case_XMLRepository::singleton()->retrieve($caseType['name'])
- );
- $result['values'][$key]['definition'] = $definition;
+ $xml = CRM_Case_XMLRepository::singleton()->retrieve($caseType['name']);
+ if ($xml) {
+ $result['values'][$key]['definition'] = CRM_Case_BAO_CaseType::convertXmlToDefinition($xml);
+ } else {
+ $result['values'][$key]['definition'] = array();
+ }
}
return $result;
}