Reproduce CRM-18092 fix for 4.6
authorLaryn <laryn@cedc.org>
Thu, 17 Mar 2016 16:36:08 +0000 (11:36 -0500)
committerLaryn <laryn@cedc.org>
Thu, 17 Mar 2016 16:36:08 +0000 (11:36 -0500)
Reproduce this fix for 4.6
https://github.com/civicrm/civicrm-core/commit/0f578135c6f9d151fd2e4fef230ec0f91418224b

CRM/Report/Form/Contribute/Bookkeeping.php

index e084aefe927e0ba01f62e7e19789a79ee2441bba..cc80e84e7817d3c3f1435642bfd3edbec354d1f6 100644 (file)
@@ -226,6 +226,21 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form {
           'financial_type_id' => array('title' => ts('Financial Type')),
         ),
       ),
+      'civicrm_batch' => array(
+        'dao' => 'CRM_Batch_DAO_Batch',
+        'fields' => array(
+          'title' => array(
+            'title' => ts('Batch Title'),
+            'alias' => 'batch',
+            'default' => FALSE,
+          ),
+          'name' => array(
+            'title' => ts('Batch Name'),
+            'alias' => 'batch',
+            'default' => TRUE,
+          ),
+        ),
+      ),
       'civicrm_contribution' => array(
         'dao' => 'CRM_Contribute_DAO_Contribution',
         'fields' => array(
@@ -410,6 +425,12 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form {
                     ON fitem.financial_account_id = {$this->_aliases['civicrm_financial_account']}_credit_2.id
               LEFT JOIN civicrm_line_item {$this->_aliases['civicrm_line_item']}
                     ON  fitem.entity_id = {$this->_aliases['civicrm_line_item']}.id AND fitem.entity_table = 'civicrm_line_item' ";
+              if ($this->isTableSelected('civicrm_batch')) {
+                    $this->_from .= "LEFT JOIN civicrm_entity_batch ent_batch
+                          ON  {$this->_aliases['civicrm_financial_trxn']}.id = ent_batch.entity_id AND ent_batch.entity_table = 'civicrm_financial_trxn' 
+                    LEFT JOIN civicrm_batch batch
+                          ON  ent_batch.batch_id = batch.id";
+              }
   }
 
   public function orderBy() {