CRM-17146: updating the contribution state in finding contriutions does not update...
authoryashodha <yashodha.chaku@webaccessglobal.com>
Fri, 4 Sep 2015 09:18:41 +0000 (14:48 +0530)
committeryashodha <yashodha.chaku@webaccessglobal.com>
Fri, 4 Sep 2015 09:18:41 +0000 (14:48 +0530)
----------------------------------------
* CRM-17146: updating the contribution state in finding contriutions does not update the receive date
  https://issues.civicrm.org/jira/browse/CRM-17146

CRM/Contribute/BAO/Contribution.php

index f0035ca5ae60c95fc375f56026ad0e3bfbc4a818..861b6494e9a9565db12941d64ae01e73099136c4 100644 (file)
@@ -4073,8 +4073,7 @@ WHERE con.id = {$contributionId}
    * @param int $isFirstOrLastRecurringPayment
    *   Deprecated param only used by AuthorizeNetIPN.
    */
-  public static function completeOrder(&$input, &$ids, $objects, $transaction, $recur, $contribution, $isRecurring,
-      $isFirstOrLastRecurringPayment) {
+  public static function completeOrder(&$input, &$ids, $objects, $transaction, $recur, $contribution, $isRecurring, $isFirstOrLastRecurringPayment) {
     $primaryContributionID = isset($contribution->id) ? $contribution->id : $objects['first_contribution']->id;
     // The previous details are used when calculating line items so keep it before any code that 'does something'
     if (!empty($contribution->id)) {
@@ -4131,6 +4130,10 @@ WHERE con.id = {$contributionId}
         $values['receipt_from_email'] = $domainValues[1];
       }
 
+      if (empty($values['receive_date']) && $changeDate) {
+        $contributionParams['receive_date'] = $changeDate;
+      }
+
       if ($recurContrib && $recurContrib->id && !isset($input['is_email_receipt'])) {
         //CRM-13273 - is_email_receipt setting on recurring contribution should take precedence over contribution page setting
         // but CRM-16124 if $input['is_email_receipt'] is set then that should not be overridden.