Merge pull request #11441 from civicrm/4.7.29-rc
authorEileen McNaughton <eileen@mcnaughty.com>
Wed, 20 Dec 2017 20:40:55 +0000 (09:40 +1300)
committerGitHub <noreply@github.com>
Wed, 20 Dec 2017 20:40:55 +0000 (09:40 +1300)
4.7.29 rc merge to master

1  2 
CRM/Contribute/Form/Contribution/Confirm.php
CRM/Contribute/Form/ContributionBase.php

index 6f08e26221ee303efe9643620861140386482bb3,3a7028a46fc5c326fd7d87325fdf341deed07c18..a8ba2af41fd1a6ba9ff5e38374e49dfb6b6bdf7e
@@@ -188,11 -188,6 +188,11 @@@ class CRM_Contribute_Form_Contribution_
      if ($paymentProcessorOutcome) {
        $contributionParams['payment_processor'] = CRM_Utils_Array::value('payment_processor', $paymentProcessorOutcome);
      }
 +    if (!empty($params["is_email_receipt"])) {
 +      $contributionParams += array(
 +        'receipt_date' => $receiptDate,
 +      );
 +    }
      if (!$pending && $paymentProcessorOutcome) {
        $contributionParams += array(
          'fee_amount' => CRM_Utils_Array::value('fee_amount', $paymentProcessorOutcome),
      // lineItem isn't set until Register postProcess
      $this->_lineItem = $this->get('lineItem');
      $this->_ccid = $this->get('ccid');
-     $this->_paymentProcessor = $this->get('paymentProcessor');
      $this->_params = $this->controller->exportValues('Main');
      $this->_params['ip_address'] = CRM_Utils_System::ipAddress();
      $this->_params['amount'] = $this->get('amount');
        try {
          $this->processMembership($membershipParams, $contactID, $customFieldsFormatted, $fieldTypes, $premiumParams, $membershipLineItems);
        }
 +      catch (\Civi\Payment\Exception\PaymentProcessorException $e) {
 +        CRM_Core_Session::singleton()->setStatus($e->getMessage());
 +        if (!empty($this->_contributionID)) {
 +          CRM_Contribute_BAO_Contribution::failPayment($this->_contributionID,
 +            $contactID, $e->getMessage());
 +        }
 +        CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contribute/transact', "_qf_Main_display=true&qfKey={$this->_params['qfKey']}"));
 +      }
        catch (CRM_Core_Exception $e) {
          CRM_Core_Session::singleton()->setStatus($e->getMessage());
          CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contribute/transact', "_qf_Main_display=true&qfKey={$this->_params['qfKey']}"));
index 3328b284f456191dd67a34b1664e06f983892ae9,933128ea3208145f49faa664a99b55728f0c6d8b..cdd2818f835efa03381b4296b0e720a5af82ce17
@@@ -294,6 -294,9 +294,9 @@@ class CRM_Contribute_Form_ContributionB
      $this->_fields = $this->get('fields');
      $this->_bltID = $this->get('bltID');
      $this->_paymentProcessor = $this->get('paymentProcessor');
+     if (!$this->_paymentProcessor) {
+       $this->_paymentProcessor = array('object' => Civi\Payment\System::singleton()->getById(0));
+     }
      $this->_priceSetId = $this->get('priceSetId');
      $this->_priceSet = $this->get('priceSet');
  
     * @param bool $isContributionMainPage
     *   Is this the main page? If so add form input fields.
     *   (or better yet don't have this functionality in a function shared with forms that don't share it).
 -   * @param int $selectedMembershipTypeID
 +   * @param int|array $selectedMembershipTypeID
     *   Selected membership id.
     * @param bool $thankPage
     *   Thank you page.
  
        // Assign autorenew option (0:hide,1:optional,2:required) so we can use it in confirmation etc.
        $autoRenewOption = CRM_Price_BAO_PriceSet::checkAutoRenewForPriceSet($this->_priceSetId);
 -      if (isset($membershipTypeValues[$selectedMembershipTypeID]['auto_renew'])) {
 +      //$selectedMembershipTypeID is retrieved as an array for membership priceset if multiple
 +      //options for different organisation is selected on the contribution page.
 +      if (is_numeric($selectedMembershipTypeID) && isset($membershipTypeValues[$selectedMembershipTypeID]['auto_renew'])) {
          $this->assign('autoRenewOption', $membershipTypeValues[$selectedMembershipTypeID]['auto_renew']);
        }
        else {