CRM-18977, modified code to set alias for civicrm_line_item table
authorPradeep Nayak <pradpnayak@gmail.com>
Wed, 22 Jun 2016 00:36:21 +0000 (06:06 +0530)
committerPradeep Nayak <pradpnayak@gmail.com>
Fri, 22 Jul 2016 14:30:14 +0000 (20:00 +0530)
----------------------------------------
* CRM-18977: Contribution reports fails when Financial ACL is enabled
  https://issues.civicrm.org/jira/browse/CRM-18977

CRM/Report/Form.php

index 57145563ebf21f63029dfe49f1987397dd9ff687..9851120fdbfc76be7481ee833d3b84a0afc03743 100644 (file)
@@ -4551,10 +4551,13 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a
     else {
       $contFTs = $liFTs = implode(',', array_keys($financialTypes));
     }
+    $temp = CRM_Utils_Array::value('civicrm_line_item', $query->_aliases);
     if ($alias) {
-      $temp = CRM_Utils_Array::value('civicrm_line_item', $query->_aliases);
       $query->_aliases['civicrm_line_item'] = $alias;
     }
+    elseif (!$temp) {
+      $query->_aliases['civicrm_line_item'] = 'civicrm_line_item_civireport';
+    }
     if (empty($query->_where)) {
       $query->_where = "WHERE {$query->_aliases['civicrm_contribution']}.id IS NOT NULL ";
     }