Merge pull request #22458 from eileenmcnaughton/test
[civicrm-core.git] / CRM / Event / BAO / Participant.php
index d72012f5c1fb9cfd14a82aa29cde000ea84b3ef4..ed4ef1e67ebc7f84aee60a712ee477ef92851628 100644 (file)
@@ -44,12 +44,6 @@ class CRM_Event_BAO_Participant extends CRM_Event_DAO_Participant {
     'Pending from approval' => ['Registered', 'Cancelled'],
   ];
 
-  /**
-   */
-  public function __construct() {
-    parent::__construct();
-  }
-
   /**
    * Takes an associative array and creates a participant object.
    *
@@ -798,7 +792,7 @@ WHERE  civicrm_participant.id = {$participantId}
    *
    * @param array $defaults
    * @param string $property
-   * @param string $lookup
+   * @param string[] $lookup
    * @param bool $reverse
    *
    * @return bool
@@ -1236,15 +1230,7 @@ UPDATE  civicrm_participant
 
     //get all required contacts detail.
     if (!empty($contactIds)) {
-      // get the contact details.
-      list($currentContactDetails) = CRM_Utils_Token::getTokenDetails($contactIds, NULL,
-        FALSE, FALSE, NULL,
-        [],
-        'CRM_Event_BAO_Participant'
-      );
-      foreach ($currentContactDetails as $contactId => $contactValues) {
-        $contactDetails[$contactId] = $contactValues;
-      }
+      $contactDetails += civicrm_api3('Contact', 'get', ['id' => ['IN' => $contactIds, 'return' => 'display_name']])['values'];
     }
 
     //get all required events detail.
@@ -1312,7 +1298,7 @@ UPDATE  civicrm_participant
             $mail = self::sendTransitionParticipantMail($additionalId,
               $participantDetails[$additionalId],
               $eventDetails[$participantDetails[$additionalId]['event_id']],
-              $contactDetails[$participantDetails[$additionalId]['contact_id']],
+              NULL,
               $emailType
             );
 
@@ -1331,7 +1317,7 @@ UPDATE  civicrm_participant
         $mail = self::sendTransitionParticipantMail($participantId,
           $participantValues,
           $eventDetails[$participantValues['event_id']],
-          $contactDetails[$participantValues['contact_id']],
+          NULL,
           $emailType
         );
 
@@ -1485,7 +1471,7 @@ UPDATE  civicrm_participant
    *
    * @return string
    */
-  public function updateStatusMessage($participantId, $statusChangeTo, $fromStatusId) {
+  public static function updateStatusMessage($participantId, $statusChangeTo, $fromStatusId) {
     $statusMsg = NULL;
     $results = self::transitionParticipants([$participantId],
       $statusChangeTo, $fromStatusId, TRUE
@@ -1604,8 +1590,7 @@ UPDATE  civicrm_participant
    * @param int $newStatusId
    *   New status.
    *
-   * @return bool
-   *   true if allowed
+   * @return array
    */
   public static function getValidAdditionalIds($participantId, $oldStatusId, $newStatusId) {