Membership and Event Related Contributions - shows all contributions
When viewing a membership or participant record, the related contributions show all contributions, not those related to the membership.
- Go to a contact's Memberships tab. (Or Events tab)
- Click View on the Membership (Or Event)
Observe that the 'Related Contributions' shows all contributions, not just those related to the membership/event.
Related Contributions should only show those related to the membership.
This used to work correctly - eg in 5.18.4
The membership view uses CRM_Contribute_Form_Search and passes a
memberId. The handling of forced searches and the use of
$this->_formValues in CRM_Contribute_Form_Search and CRM_Core_Form_Search has changed with the result that
memberId is not passed into the query.
In https://github.com/civicrm/civicrm-core/blob/5.18/CRM/Contribute/Form/Search.php#L108 forced searches are performed after
$this->_formValues['contribution_membership_id'] is set at https://github.com/civicrm/civicrm-core/blob/5.18/CRM/Contribute/Form/Search.php#L101
The forced search is now carried out in
memberId from the URL needs to happen somewhere before the query. Note that with the changes to setFormValues(), getFormValues() just assigning to
$this->_formValues['contribution_membership_id'] is not the right approach. The question (probably for @eileen) is what the right approach is now.
The issue applies to
participantId and events.