Fixed errors with CRM-16107
authorTyrell Cook <tyrell@aghstrategies.com>
Fri, 27 Mar 2015 22:12:55 +0000 (18:12 -0400)
committerTyrell Cook <tyrell@aghstrategies.com>
Fri, 27 Mar 2015 22:12:55 +0000 (18:12 -0400)
CRM/Report/Form/Event/ParticipantListing.php

index 44e48000ac74f0856c103a821d2faa0614181a18..7863ea057c64b9639818b4cd045ad778670e243e 100644 (file)
@@ -532,17 +532,19 @@ ORDER BY  cv.label
       $this->_from .= "
             LEFT JOIN civicrm_line_item line_item_civireport
                   ON line_item_civireport.entity_table = 'civicrm_participant' AND
-                     line_item_civireport.entity_id = {$this->_aliases['civicrm_participant']}.id
+                     line_item_civireport.entity_id = {$this->_aliases['civicrm_participant']}.id AND
+                     line_item_civireport.qty > 0
       ";
     }
     if ($this->_balance) {
       $this->_from .= "
             LEFT JOIN civicrm_entity_financial_trxn eft
-                  ON (eft.entity_id = contribution_civireport.id)
+                  ON (eft.entity_id = {$this->_aliases['civicrm_contribution']}.id)
             LEFT JOIN civicrm_financial_account fa
                   ON (fa.account_type_code = 'AR')
             LEFT JOIN civicrm_financial_trxn ft
-                  ON (ft.id = eft.financial_trxn_id AND eft.entity_table = 'civicrm_contribution') AND (ft.from_financial_account_id = fa.id)
+                  ON (ft.id = eft.financial_trxn_id AND eft.entity_table = 'civicrm_contribution') AND
+                     (ft.to_financial_account_id != fa.id)
       ";
     }
   }