fixed merge forward, CRM-12772
authorkurund <kurund@civicrm.org>
Sun, 24 Aug 2014 13:26:47 +0000 (18:56 +0530)
committerkurund <kurund@civicrm.org>
Sun, 24 Aug 2014 13:26:47 +0000 (18:56 +0530)
----------------------------------------
* CRM-12772: Member Report (Detail) locks in DB with large membership/contribution sets
  https://issues.civicrm.org/jira/browse/CRM-12772

CRM/Report/Form/Member/Detail.php

index a6732d5976b05bc985ef458c7266d56e119e0b89..030b90e7e2c09c7f7569d2e6533adf65b014476d 100644 (file)
@@ -379,15 +379,10 @@ class CRM_Report_Form_Member_Detail extends CRM_Report_Form {
     //used when contribution field is selected
     if ($this->_contribField) {
       $this->_from .= "
-              LEFT JOIN (
-                  SELECT cc.*, cmp.membership_id as membership_id
-                  FROM civicrm_membership_payment cmp
-                    JOIN civicrm_contribution cc
-                      ON cc.id = cmp.contribution_id
-                  ORDER BY cc.receive_date DESC
-                  ) {$this->_aliases['civicrm_contribution']}
-                ON {$this->_aliases['civicrm_membership']}.id =
-                  {$this->_aliases['civicrm_contribution']}.membership_id\n";
+             LEFT JOIN civicrm_membership_payment cmp
+                 ON {$this->_aliases['civicrm_membership']}.id = cmp.membership_id
+             LEFT JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
+                 ON cmp.contribution_id={$this->_aliases['civicrm_contribution']}.id\n";
     }
   }