Merge pull request #23982 from eileenmcnaughton/act_cont
[civicrm-core.git] / CRM / Event / Form / Registration.php
index a34fcecd907fddfd1e4e521a6dab35ecfb3f186b..f2f5e25831dcf451dd347b26d6b0c2e4a2059a2d 100644 (file)
@@ -456,7 +456,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form {
     $this->assign('address', CRM_Utils_Address::getFormattedBillingAddressFieldsFromParameters($params, $this->_bltID));
 
     // The concept of contributeMode is deprecated.
-    if ($this->_contributeMode == 'direct' && empty($params['is_pay_later'])) {
+    if ($this->_contributeMode === 'direct' && empty($params['is_pay_later'])) {
       $date = CRM_Utils_Date::format(CRM_Utils_Array::value('credit_card_exp_date', $params));
       $date = CRM_Utils_Date::mysqlToIso($date);
       $this->assign('credit_card_exp_date', $date);
@@ -465,18 +465,12 @@ class CRM_Event_Form_Registration extends CRM_Core_Form {
       );
     }
 
-    // assign is_email_confirm to templates
-    if (isset($this->_values['event']['is_email_confirm'])) {
-      $this->assign('is_email_confirm', $this->_values['event']['is_email_confirm']);
-    }
-
+    $this->assign('is_email_confirm', $this->_values['event']['is_email_confirm'] ?? NULL);
     // assign pay later stuff
-    $params['is_pay_later'] = CRM_Utils_Array::value('is_pay_later', $params, FALSE);
+    $params['is_pay_later'] = $params['is_pay_later'] ?? FALSE;
     $this->assign('is_pay_later', $params['is_pay_later']);
-    if ($params['is_pay_later']) {
-      $this->assign('pay_later_text', $this->getPayLaterLabel());
-      $this->assign('pay_later_receipt', $this->_values['event']['pay_later_receipt']);
-    }
+    $this->assign('pay_later_text', $params['is_pay_later'] ? $this->getPayLaterLabel() : FALSE);
+    $this->assign('pay_later_receipt', $params['is_pay_later'] ? $this->_values['event']['pay_later_receipt'] : NULL);
 
     // also assign all participantIDs to the template
     // useful in generating confirmation numbers if needed
@@ -539,7 +533,6 @@ class CRM_Event_Form_Registration extends CRM_Core_Form {
       $fields = array_diff_key($fields, $fieldsToIgnore);
       CRM_Core_Session::setStatus(ts('Some of the profile fields cannot be configured for this page.'));
     }
-    $addCaptcha = FALSE;
 
     if (!empty($this->_fields)) {
       $fields = @array_diff_assoc($fields, $this->_fields);
@@ -559,20 +552,11 @@ class CRM_Event_Form_Registration extends CRM_Core_Form {
         if ($button == 'skip') {
           $field['is_required'] = FALSE;
         }
-        // CRM-11316 Is ReCAPTCHA enabled for this profile AND is this an anonymous visitor
-        elseif ($field['add_captcha'] && !$contactID) {
-          // only add captcha for first page
-          $addCaptcha = TRUE;
-        }
         CRM_Core_BAO_UFGroup::buildProfile($this, $field, CRM_Profile_Form::MODE_CREATE, $contactID, TRUE);
 
         $this->_fields[$key] = $field;
       }
     }
-
-    if ($addCaptcha) {
-      CRM_Utils_ReCAPTCHA::enableCaptchaOnForm($this);
-    }
   }
 
   /**
@@ -1545,8 +1529,8 @@ class CRM_Event_Form_Registration extends CRM_Core_Form {
 
         //lets get additional participant id to cancel.
         if ($this->_allowConfirmation && is_array($cancelledIds)) {
-          $additonalId = $value['participant_id'] ?? NULL;
-          if ($additonalId && $key = array_search($additonalId, $cancelledIds)) {
+          $additionalId = $value['participant_id'] ?? NULL;
+          if ($additionalId && $key = array_search($additionalId, $cancelledIds)) {
             unset($cancelledIds[$key]);
           }
         }