Details
-
Type: Patch
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.2.0
-
Fix Version/s: 4.2.0
-
Component/s: None
-
Labels:None
Description
I've just installed the new Contribute/MembershipDetail report on a customer's site & found that the join was not the best & won't facilitate the possibility of the contribution coming from a different person to the membership (as discussed w dgg)
Currently it joins the membership on contact_id to contribution & then joins the membership_payment table on both those IDs
Patch (I can commit) changes it to put the membership_payment table inbetween contribution & payment
As an aside - I was confused by the amount column in the report - it appears to be total amount paid for the given membership
Index: CRM/Report/Form/Contribute/MembershipDetail.php
===================================================================
— CRM/Report/Form/Contribute/MembershipDetail.php (revision 40228)
+++ CRM/Report/Form/Contribute/MembershipDetail.php (working copy)
@@ -449,14 +449,14 @@
FROM civicrm_contribution {$this->_aliases['civicrm_contribution']}
INNER JOIN civicrm_contact {$this->_aliases['civicrm_contact']} {$this->_aclFrom}
ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_contribution']}.contact_id AND {$this->_aliases['civicrm_contribution']}.is_test = 0
- INNER JOIN civicrm_membership {$this->_aliases['civicrm_membership']}
- ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_membership']}.contact_id AND {$this->_aliases['civicrm_membership']}.is_test = 0
+ INNER JOIN civicrm_membership_payment {$this->_aliases['civicrm_membership_payment']}
+ ON {$this->_aliases['civicrm_contribution']}.id = {$this->_aliases['civicrm_membership_payment']}.contribution_id
+
+ INNER JOIN civicrm_membership {$this->_aliases['civicrm_membership']}
+ ON {$this->_aliases['civicrm_membership_payment']}.membership_id = {$this->_aliases['civicrm_membership']}.id AND {$this->_aliases['civicrm_membership']}.is_test = 0
LEFT JOIN civicrm_membership_status {$this->_aliases['civicrm_membership_status']}
ON {$this->_aliases['civicrm_membership_status']}.id = - {$this->_aliases['civicrm_membership']}.status_id
- INNER JOIN civicrm_membership_payment {$this->_aliases['civicrm_membership_payment']}
- ON {$this->_aliases['civicrm_membership']}.id = {$this->_aliases['civicrm_membership_payment']}.membership_id AND {$this->_aliases['civicrm_contribution']}.id = {$this->_aliases['civicrm_membership_payment']}.contribution_id";
-
+ {$this->_aliases['civicrm_membership']}.status_id ";
//for premium products
$this->_from .= "
LEFT JOIN civicrm_contribution_product {$this->_aliases['civicrm_contribution_product']}