Remove unreachable code
authorEileen McNaughton <emcnaughton@wikimedia.org>
Fri, 22 Sep 2023 04:03:57 +0000 (16:03 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Fri, 22 Sep 2023 04:03:57 +0000 (16:03 +1200)
The ContributionRecur::add function throws an error if there
is a problem - it doesn't return an error

CRM/Contribute/Form/Contribution/Confirm.php

index e43d107f1c7f88584a99caf496cd1b895ff0b1c3..cfb4635f6e03425439cfa50fe1c2057fc943f3cf 100644 (file)
@@ -1217,19 +1217,6 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     $campaignId = $params['campaign_id'] ?? $form->_values['campaign_id'] ?? NULL;
     $recurParams['campaign_id'] = $campaignId;
     $recurring = CRM_Contribute_BAO_ContributionRecur::add($recurParams);
-    if (is_a($recurring, 'CRM_Core_Error')) {
-      CRM_Core_Error::displaySessionError($recurring);
-      $urlString = 'civicrm/contribute/transact';
-      $urlParams = '_qf_Main_display=true';
-      if (get_class($form) == 'CRM_Contribute_Form_Contribution') {
-        $urlString = 'civicrm/contact/view/contribution';
-        $urlParams = "action=add&cid={$form->_contactID}";
-        if ($form->_mode) {
-          $urlParams .= "&mode={$form->_mode}";
-        }
-      }
-      CRM_Utils_System::redirect(CRM_Utils_System::url($urlString, $urlParams));
-    }
     $form->_params['contributionRecurID'] = $recurring->id;
 
     return $recurring->id;