CRM-19151: Add the ability to merge memberships without data loss
authorOlivier Tétard <olivier.tetard@miskin.fr>
Sat, 18 Nov 2017 17:24:34 +0000 (18:24 +0100)
committerOlivier Tétard <olivier.tetard@miskin.fr>
Tue, 20 Mar 2018 09:43:17 +0000 (10:43 +0100)
commitc31e68ae2ff49765af3840b388b76a6be4d40d48
treeac14644b23a6eff4802e4830edcfe35fec9637e3
parent43d4ad93e20f69869f0ddfdf51d5fa33941a39b7
CRM-19151: Add the ability to merge memberships without data loss

Add a new custom processing function `mergeMemberships()` in
`CRM_Member_BAO_Membership` that allows to merge memberships.

General idea is to merge memberships in regards to their type. We move
the other contact’s contributions to the main contact’s membership
which has the same type (if any) and then we update membership to
avoid loosing `join_date`, `end_date`, etc.

Related issue: https://issues.civicrm.org/jira/browse/CRM-19151
CRM/Dedupe/Merger.php
CRM/Member/BAO/Membership.php