CRM-17636 fix for items not being recorded correctly (modified_date, invoice_id,...
authoreileenmcnaughton <eileen@fuzion.co.nz>
Mon, 30 Nov 2015 05:40:50 +0000 (05:40 +0000)
committereileenmcnaugton <eileen@fuzion.co.nz>
Mon, 30 Nov 2015 07:29:48 +0000 (20:29 +1300)
Conflicts:
CRM/Member/Form/MembershipRenewal.php

CRM/Member/Form.php
CRM/Member/Form/MembershipRenewal.php
api/v3/ContributionRecur.php

index 47b220cd5bbd726522cbf533c0d7706970f11d0c..f429a721965d584ee01fc7af35b97b134dfc3670 100644 (file)
@@ -239,13 +239,13 @@ class CRM_Member_Form extends CRM_Contribute_Form_AbstractEditPayment {
     $contributionRecurParams = array(
       'contact_id' => $paymentParams['contactID'],
       'amount' => $paymentParams['total_amount'],
+      'contribution_status_id' => 'Pending',
       'payment_processor_id' => $paymentParams['payment_processor_id'],
       'campaign_id' => CRM_Utils_Array::value('campaign_id', $paymentParams),
       'financial_type_id' => $paymentParams['financial_type_id'],
-      'is_email_receipt' => CRM_Utils_Array::value('is_email_receipt', $paymentParams),
-      // This is not great as it could also be direct debit - but is consistent with elsewhere & all need fixing.
+      'is_email_receipt' => $paymentParams['is_email_receipt'],
       'payment_instrument_id' => 1,
-      'invoice_id' => CRM_Utils_Array::value('invoiceID ', $paymentParams),
+      'invoice_id' => $paymentParams['invoice_id'],
     );
 
     $mapping = array(
index 31f556e0efd929baaa1845f4f23054383cbec90e..fdc6fa37d56acc04bd314f864b30a6baa766f93d 100644 (file)
@@ -597,15 +597,16 @@ WHERE   id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )';
       $this->_params['amount'] = $formValues['total_amount'];
       $this->_params['currencyID'] = $config->defaultCurrency;
       $this->_params['payment_action'] = 'Sale';
-      $paymentParams['invoiceID'] = $this->_params['invoiceID'] = md5(uniqid(rand(), TRUE));
-
       // at this point we've created a contact and stored its address etc
       // all the payment processors expect the name and address to be in the passed params
       // so we copy stuff over to first_name etc.
       $paymentParams = $this->_params;
+      $paymentParams['invoiceID'] = $paymentParams['invoice_id'] = $this->_params['invoiceID'] = md5(uniqid(rand(), TRUE));
+
       if (!empty($this->_params['send_receipt'])) {
         $paymentParams['email'] = $this->_contributorEmail;
       }
+      $paymentParams['is_email_receipt'] = !empty($this->_params['send_receipt']);
 
       $paymentParams['contactID'] = $this->_contributorContactID;
 
index 2db4c8dc3c5d00eda3700dc95cc6e191df57f241..403865b0b89122e809cd327df2b1cdbaad1c205b 100644 (file)
@@ -57,6 +57,7 @@ function _civicrm_api3_contribution_recur_create_spec(&$params) {
   $params['create_date']['api.default'] = 'now';
   $params['frequency_interval']['api.required'] = 1;
   $params['start_date']['api.default'] = 'now';
+  $params['modified_date']['api.default'] = 'now';
 }
 
 /**