-- fixed for CRM-12699
authorPradeep Nayak <pradeep@pradeep.(none)>
Tue, 28 May 2013 20:39:45 +0000 (02:09 +0530)
committerPradeep Nayak <pradeep@pradeep.(none)>
Tue, 28 May 2013 20:39:45 +0000 (02:09 +0530)
----------------------------------------
* CRM-12699: Total_Amount field is incorrectly recorded as 0 for repeating credit card contribs.
  http://issues.civicrm.org/jira/browse/CRM-12699

CRM/Contribute/Form/Contribution.php
CRM/Core/BAO/FinancialTrxn.php
CRM/Core/Payment/BaseIPN.php
CRM/Member/Form/Membership.php

index 0253899e4d2009c270447b2674c876d7b24caae9..b42af2d888dc82205749a4c61683608c753b1c75 100644 (file)
@@ -1388,7 +1388,8 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
     );
 
     //get the payment processor id as per mode.
-    $params['payment_processor_id'] = $this->_params['payment_processor_id'] = $submittedValues['payment_processor_id'] = $this->_paymentProcessor['id'];
+    $this->_params['payment_processor'] = $params['payment_processor_id'] = 
+      $this->_params['payment_processor_id'] = $submittedValues['payment_processor_id'] = $this->_paymentProcessor['id'];
 
     $now = date('YmdHis');
     $fields = array();
index 95a675df667c3d8ec978141dc9b58abcebdcacb5..90109b33bd438edb1f05e58f72299b9a37ee2bd1 100644 (file)
@@ -336,6 +336,9 @@ WHERE ceft.entity_id = %1";
       $amount = $params['prevContribution']->fee_amount;
     }
     $amount = $params['fee_amount'] - $amount;
+    if (!$amount) {
+      return FALSE;
+    }
     $financialAccount = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id'], $expenseTypeId);
     $params['trxnParams']['from_financial_account_id'] = $params['to_financial_account_id'];
     $params['trxnParams']['to_financial_account_id'] = $financialAccount;
index accdaf5153b97517334aff20099405ee6ce90228..cb96a8b48a43a64e3505f30a88773a73ba37bb1d 100644 (file)
@@ -487,6 +487,7 @@ LIMIT 1;";
         $input['prevContribution']->contribution_status_id == array_search('Pending', $contributionStatuses)) {
         $input['payment_processor'] = $paymentProcessorId;
       }
+      $input['contribution_status_id'] = array_search('Completed', $contributionStatuses);
       $input['total_amount'] = $input['amount'];
       $input['contribution'] = $contribution;
       $input['financial_type_id'] = $contribution->financial_type_id;
index a66dcdfb85c5902d04979f0aa3f5defa595a1818..8b22bf1dbfeb04ac33fa78d6a32d0ca79900d656 100644 (file)
@@ -1511,25 +1511,6 @@ WHERE   id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )';
         $count++;
       }
 
-      if (!CRM_Utils_Array::value('is_recur', $params) && $params['total_amount'] > 0.0) {
-        $contribution = new CRM_Contribute_BAO_Contribution();
-        $contribution->trxn_id = CRM_Utils_Array::value('trxn_id', $result);
-        if ($contribution->find(TRUE)) {
-          // next create the transaction record
-          $trxnParams = array(
-            'contribution_id' => $contribution->id,
-            'trxn_date' => $now,
-            'trxn_type' => 'Debit',
-            'total_amount' => $params['total_amount'],
-            'fee_amount' => CRM_Utils_Array::value('fee_amount', $result),
-            'net_amount' => CRM_Utils_Array::value('net_amount', $result, $params['total_amount']),
-            'currency' => $config->defaultCurrency,
-            'payment_processor' => $this->_paymentProcessor['payment_processor_type'],
-            'trxn_id' => CRM_Utils_Array::value('trxn_id', $result),
-          );
-          $trxn = CRM_Core_BAO_FinancialTrxn::create($trxnParams);
-        }
-      }
     }
     else {
       $params['action'] = $this->_action;