function checkRegistration($params) { $alreadyRegistered = false; if (!CRM_Utils_Array::value('contact_id', $params)) { return $alreadyRegistered; } require_once 'CRM/Event/PseudoConstant.php'; require_once 'CRM/Event/DAO/Participant.php'; $statusTypes = CRM_Event_PseudoConstant::participantStatus(null, "is_counted = 1"); $participant = new CRM_Event_DAO_Participant(); $participant->copyValues($params); $participant->is_test = CRM_Utils_Array::value('is_test', $params, 0); $participant->selectAdd(); $participant->selectAdd('status_id'); if ($participant->find(true) && array_key_exists($participant->status_id, $statusTypes)) { $alreadyRegistered = true; } return $alreadyRegistered; }
/** * @param $params * * @return bool */ static function checkRegistration($params) { $alreadyRegistered = FALSE; if (empty($params['contact_id'])) { return $alreadyRegistered; } $statusTypes = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 1'); $participant = new CRM_Event_DAO_Participant(); $participant->copyValues($params); $participant->is_test = CRM_Utils_Array::value('is_test', $params, 0); $participant->selectAdd(); $participant->selectAdd('status_id'); if ($participant->find(TRUE) && array_key_exists($participant->status_id, $statusTypes)) { $alreadyRegistered = TRUE; } return $alreadyRegistered; }