CRM-17679: Mismatch between financial transactions & contributions
authoryashodha <yashodha.chaku@webaccessglobal.com>
Tue, 8 Dec 2015 09:13:53 +0000 (14:43 +0530)
committeryashodha <yashodha.chaku@webaccessglobal.com>
Tue, 8 Dec 2015 09:13:53 +0000 (14:43 +0530)
----------------------------------------
* CRM-17679: Mismatch between financial transactions & contributions
  https://issues.civicrm.org/jira/browse/CRM-17679

sql/GenerateData.php

index f58da8f5ce47afc8cad2c5367813ae8558e85b57..a133b9e9949e1d7d8fc7a3850d11ff2e12a8ccb8 100644 (file)
@@ -1852,9 +1852,10 @@ WHERE cefa.account_relationship = 1; ";
 
   private function addParticipantFinancialItem() {
 
-    $sql = " SELECT cpp.contribution_id, cli.id as line_item_id, cp.contact_id, now() as receive_date, cp.fee_amount as total_amount, cp.fee_currency as currency, cli.label, cli.financial_type_id, cefa.financial_account_id, 4 as payment_instrument_id, NULL as check_number, NULL as trxn_id
-FROM `civicrm_participant` cp
+    $sql = " SELECT cpp.contribution_id, cli.id as line_item_id, cp.contact_id, now() as receive_date, cp.fee_amount as total_amount, cp.fee_currency as currency, cli.label, cli.financial_type_id, cefa.financial_account_id, cc.payment_instrument_id, NULL as check_number, NULL as trxn_id
+ FROM `civicrm_participant` cp
 INNER JOIN civicrm_participant_payment cpp ON cpp.participant_id = cp.id
+INNER JOIN civicrm_contribution cc on cc.id = cpp.contribution_id
 INNER JOIN civicrm_line_item cli ON cli.entity_id = cp.id and cli.entity_table = 'civicrm_participant'
 INNER JOIN civicrm_entity_financial_account cefa ON cefa.entity_id =  cli.financial_type_id
 WHERE cefa.account_relationship = 1";