}
break;
case 'Case':
- $caseId = $event->id;
+ // by the time we get the post-delete event, the record is gone, so
+ // there's nothing to analyze
+ if ($event->action != 'delete') {
+ $caseId = $event->id;
+ }
break;
default:
throw new \CRM_Core_Exception("CRM_Case_Listener does not support entity {$event->entity}");
*/
function _civicrm_api3_case_format_params(&$params) {
// figure out case type id from case type and vice-versa
- $caseTypes = CRM_Case_PseudoConstant::caseType('title', FALSE);
+ $caseTypes = CRM_Case_PseudoConstant::caseType('name', FALSE);
if (empty($params['case_type_id'])) {
$params['case_type_id'] = array_search($params['case_type'], $caseTypes);
}
$params = $this->_params;
// Test using label instead of value
unset($params['case_type_id']);
- $params['case_type'] = 'Housing Support';
+ $params['case_type'] = 'housing_support';
$result = $this->callAPISuccess('case', 'create', $params);
$id = $result['id'];
$params = $this->_params;
// Test using name instead of value
unset($params['case_type_id']);
- $params['case_type'] = 'Housing Support';
+ $params['case_type'] = 'housing_support';
$result = $this->callAPISuccess('case', 'create', $params);
$id = $result['id'];
$result = $this->callAPISuccess('case', 'get', array('id' => $id));