Merge pull request #19902 from eileenmcnaughton/mem_cont
authorcolemanw <coleman@civicrm.org>
Thu, 8 Apr 2021 22:15:06 +0000 (18:15 -0400)
committerGitHub <noreply@github.com>
Thu, 8 Apr 2021 22:15:06 +0000 (18:15 -0400)
[REF] [Towards membership api] Simplify determination on contribution recur contact id

1  2 
CRM/Member/Form/Membership.php
tests/phpunit/CRM/Member/Form/MembershipTest.php

index 558245a11161e72eef68c37fd9341a1c0af46943,d6779d6de492ff2b77fed0d0c296dee349b965fa..c435bde7294f48ab14a8f3494128c95dab9e51f0
@@@ -1702,12 -1789,12 +1700,12 @@@ DESC limit 1")
      if (!$this->isCreateRecurringContribution()) {
        return NULL;
      }
-     $recurParams = ['contact_id' => $contactID];
+     $recurParams = ['contact_id' => $this->getContributionContactID()];
      $recurParams['amount'] = $this->order->getTotalAmount();
 -    $recurParams['auto_renew'] = $params['auto_renew'] ?? NULL;
 -    $recurParams['frequency_unit'] = $params['frequency_unit'] ?? NULL;
 -    $recurParams['frequency_interval'] = $params['frequency_interval'] ?? NULL;
 -    $recurParams['installments'] = $params['installments'] ?? NULL;
 +    // for the legacyProcessRecurringContribution function to be reached auto_renew must be true
 +    $recurParams['auto_renew'] = TRUE;
 +    $recurParams['frequency_unit'] = $this->getFrequencyUnit();
 +    $recurParams['frequency_interval'] = $this->getFrequencyInterval();
      $recurParams['financial_type_id'] = $this->getFinancialTypeID();
      $recurParams['currency'] = $this->getCurrency();
      $recurParams['payment_instrument_id'] = $this->getPaymentInstrumentID();