From: kurund Date: Sat, 10 Aug 2013 12:18:53 +0000 (+0530) Subject: CRM-13170, fixed the query to respect batch criteria X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=61412579520487c70ed546375de0a0f565129c60;p=civicrm-core.git 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 --- 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; }