Merge pull request #3943 from civicrm/master
[civicrm-core.git] / CRM / Event / Form / Participant.php
index 7b99f87ac7cf9e7487674407b8be591924ab6673..ef44f134932292c7e8f5184d86dc8d2b32f69754 100644 (file)
@@ -218,8 +218,10 @@ class CRM_Event_Form_Participant extends CRM_Contact_Form_Task {
     if ($this->_contactId) {
       $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId);
       $this->assign('displayName', $displayName);
-      // omitting contactImage from title for now since the summary overlay css doesn't work outside of our crm-container
-      CRM_Utils_System::setTitle(ts('Event Registration for') .  ' ' . $displayName);
+      $this->setPageTitle(ts('Event Registration for %1', array(1 => $displayName)));
+    }
+    else {
+      $this->setPageTitle(ts('Event Registration'));
     }
 
     // check the current path, if search based, then dont get participantID
@@ -1005,6 +1007,10 @@ class CRM_Event_Form_Participant extends CRM_Contact_Form_Task {
           CRM_Core_Session::setStatus(ts("No participants were added."));
           return;
         }
+        // We have to re-key $this->_contactIds so each contact has the same
+        // key as their corresponding record in the $participants array that
+        // will be created below.
+        $this->_contactIds = array_values($this->_contactIds);
       }
     }
 
@@ -1533,7 +1539,7 @@ class CRM_Event_Form_Participant extends CRM_Contact_Form_Task {
       $participantRoles = CRM_Utils_Array::value('role_id', $params);
       if (is_array($participantRoles)) {
         $selectedRoles = array();
-        foreach (array_keys($participantRoles) as $roleId) {
+        foreach ($participantRoles as $roleId) {
           $selectedRoles[] = $role[$roleId];
         }
         $event['participant_role'] = implode(', ', $selectedRoles);
@@ -1706,6 +1712,7 @@ class CRM_Event_Form_Participant extends CRM_Contact_Form_Task {
           $sent[] = $contactID;
           foreach ($participants as $ids => $values) {
             if ($values->contact_id == $contactID) {
+              $values->details = CRM_Utils_Array::value('receipt_text', $params);
               CRM_Activity_BAO_Activity::addActivity($values, 'Email');
               break;
             }