Inherited Membership is updated by a non owner
Overview
Inherited Membership is updated by a non-owner.
Reproduction steps
- Create an inherited General membership on a contact.
- Visit the Membership signup page and choose Student type (same org).
- Existing Inherited membership is updated to hold the Student Type. The primary membership is of type General.
It's a different membership type and the user should not be allowed to 'renew' a membership given by a relationship?
Civi behaviour is like 'treat it as a renewal with a membership change' which is well and good for two 'same org' memberships for a person. But with an inherited one there needs to be a different set of rules? because inheritees should not be able to touch/change their inherited membership EXCEPT by adjusting the relationship. Only the membership owner should be able to update them?
If the above make sense, i think this if clause https://github.com/civicrm/civicrm-core/blob/master/CRM/Member/BAO/Membership.php#L1799 need to include an additional check for
$inheritedMemTypeChange = FALSE;
if (!empty($currentMembership['owner_membership_id'] && $membershipTypeID != $currentMembership['membership_type_id'])) {
$inheritedMemTypeChange = TRUE;
}
if ($currentMembership && !$inheritedMemTypeChange) {