From 61412579520487c70ed546375de0a0f565129c60 Mon Sep 17 00:00:00 2001 From: kurund Date: Sat, 10 Aug 2013 17:48:53 +0530 Subject: [PATCH] CRM-13170, fixed the query to respect batch criteria ---------------------------------------- * CRM-13170: Search Contribution by Batch no longer works since change to DB http://issues.civicrm.org/jira/browse/CRM-13170 --- CRM/Contribute/BAO/Query.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CRM/Contribute/BAO/Query.php b/CRM/Contribute/BAO/Query.php index cde8746fae..10c7b85060 100644 --- a/CRM/Contribute/BAO/Query.php +++ b/CRM/Contribute/BAO/Query.php @@ -678,8 +678,16 @@ class CRM_Contribute_BAO_Query { break; case 'contribution_batch': - $from .= " $side JOIN civicrm_entity_batch ON ( civicrm_entity_batch.entity_table = 'civicrm_contribution' AND - civicrm_contribution.id = civicrm_entity_batch.entity_id )"; + $from .= " $side JOIN civicrm_entity_financial_trxn ON ( + civicrm_entity_financial_trxn.entity_table = 'civicrm_contribution' + AND civicrm_contribution.id = civicrm_entity_financial_trxn.entity_id )"; + + $from .= " $side JOIN civicrm_financial_trxn ON ( + civicrm_entity_financial_trxn.financial_trxn_id = civicrm_financial_trxn.id )"; + + $from .= " $side JOIN civicrm_entity_batch ON ( civicrm_entity_batch.entity_table = 'civicrm_financial_trxn' + AND civicrm_financial_trxn.id = civicrm_entity_batch.entity_id )"; + $from .= " $side JOIN civicrm_batch ON civicrm_entity_batch.batch_id = civicrm_batch.id"; break; } -- 2.25.1