Template support
3 unresolved threads
3 unresolved threads
Merge request reports
Activity
78 78 79 79 function certificates_civicrm_pre($op, $objectName, $id, &$params) { 80 80 if ($op == 'edit' && $objectName == 'Participant') { 81 $contactId = $params['contact_id']; 81 $contactID = $params['contact_id']; 82 82 try { 83 $statusId = CRM_Core_PseudoConstant::getKey('CRM_Event_BAO_Participant', 'status_id', 'Attended'); 84 85 83 //get current participant status before data is changed and get event type 86 84 $participant = \Civi\Api4\Participant::get(FALSE) 87 85 ->addSelect('status_id', 'id', 'event_id.Event_Certificate.event_certificate') 88 86 ->addJoin('Event AS event', 'LEFT', ['event_id', '=', 'event.id']) 89 87 ->addWhere('contact_id', '=', $contactId) 88 ->addWhere('status_id:name', '=', 'Attended') 81 $contactId = $params['contact_id']; 81 $contactID = $params['contact_id']; 82 82 try { 83 $statusId = CRM_Core_PseudoConstant::getKey('CRM_Event_BAO_Participant', 'status_id', 'Attended'); 84 85 83 //get current participant status before data is changed and get event type 86 84 $participant = \Civi\Api4\Participant::get(FALSE) 87 85 ->addSelect('status_id', 'id', 'event_id.Event_Certificate.event_certificate') 88 86 ->addJoin('Event AS event', 'LEFT', ['event_id', '=', 'event.id']) 89 87 ->addWhere('contact_id', '=', $contactId) 88 ->addWhere('status_id:name', '=', 'Attended') 90 89 ->execute()->first(); 91 $participantId = $participant['id']; 92 90 93 91 // checks if participant status_id is now status id for Attended --> then send email 94 if($participant['status_id'] !== $statusId && $params['status_id'] === $statusId) { mentioned in commit 6655046f
Please register or sign in to reply