Merge pull request #2635 from colemanw/master
[civicrm-core.git] / CRM / Event / Form / ParticipantView.php
index 983beb2df6ac10f2a100989d7964ec5bfcabe6dd..fd69ba2945eb041ea8634ce56d8e9427c4e8cd37 100644 (file)
@@ -62,10 +62,15 @@ class CRM_Event_Form_ParticipantView extends CRM_Core_Form {
 
     CRM_Event_BAO_Participant::resolveDefaults($values[$participantID]);
 
-    if (CRM_Utils_Array::value('fee_level', $values[$participantID])) {
+    if (!empty($values[$participantID]['fee_level'])) {
       CRM_Event_BAO_Participant::fixEventLevel($values[$participantID]['fee_level']);
     }
 
+    $this->assign('contactId', $contactID);
+    $this->assign('participantId', $participantID);
+    $statusId = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Participant', $participantID, 'status_id', 'id');
+    $participantStatuses = CRM_Event_PseudoConstant::participantStatus();
+
     if ($values[$participantID]['is_test']) {
       $values[$participantID]['status'] .= ' (test) ';
     }
@@ -86,7 +91,7 @@ class CRM_Event_Form_ParticipantView extends CRM_Core_Form {
     $values[$participantID]['totalAmount'] = CRM_Utils_Array::value('fee_amount', $values[$participantID]);
 
     // Get registered_by contact ID and display_name if participant was registered by someone else (CRM-4859)
-    if (CRM_Utils_Array::value('participant_registered_by_id', $values[$participantID])) {
+    if (!empty($values[$participantID]['participant_registered_by_id'])) {
       $values[$participantID]['registered_by_contact_id'] = CRM_Core_DAO::getFieldValue("CRM_Event_DAO_Participant",
         $values[$participantID]['participant_registered_by_id'],
         'contact_id', 'id'
@@ -124,7 +129,7 @@ class CRM_Event_Form_ParticipantView extends CRM_Core_Form {
     CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $finalTree);
     $eventTitle = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $values[$participantID]['event_id'], 'title');
     //CRM-7150, show event name on participant view even if the event is disabled
-    if (!CRM_Utils_Array::value('event', $values[$participantID])) {
+    if (empty($values[$participantID]['event'])) {
       $values[$participantID]['event'] = $eventTitle;
     }
 
@@ -193,10 +198,11 @@ class CRM_Event_Form_ParticipantView extends CRM_Core_Form {
   /**
    * Function to build the form
    *
-   * @return None
+   * @return void
    * @access public
    */
   public function buildQuickForm() {
+    CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js');
     $this->addButtons(array(
         array(
           'type' => 'cancel',