- if ($eventValues['is_template']) {
- $field = 'event_template';
- }
- else {
- $field = 'civicrm_event';
- }
- $mappingId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionMapping', $field, 'id', 'entity_value');
- $oldData = array('entity_value' => $id, 'mapping_id' => $mappingId);
- if ($copyEvent->is_template == 1) {
- $field = 'event_template';
- }
- else {
- $field = 'civicrm_event';
- }
- $copyMappingId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionMapping', $field, 'id', 'entity_value');
- $newData = array('entity_value' => $copyEvent->id, 'mapping_id' => $copyMappingId);
+ $oldMapping = CRM_Utils_Array::first(CRM_Core_BAO_ActionSchedule::getMappings(array(
+ 'id' => ($eventValues['is_template'] ? CRM_Event_ActionMapping::EVENT_TPL_MAPPING_ID : CRM_Event_ActionMapping::EVENT_NAME_MAPPING_ID),
+ )));
+ $copyMapping = CRM_Utils_Array::first(CRM_Core_BAO_ActionSchedule::getMappings(array(
+ 'id' => ($copyEvent->is_template == 1 ? CRM_Event_ActionMapping::EVENT_TPL_MAPPING_ID : CRM_Event_ActionMapping::EVENT_NAME_MAPPING_ID),
+ )));