CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Bug: Contribution Loss on Membership Merge
Pages: [1]

Author Topic: Bug: Contribution Loss on Membership Merge  (Read 418 times)

Max Hunter

  • I’m new here
  • *
  • Posts: 21
  • Karma: 1
  • CiviCRM version: 4.4.x
  • CMS version: Drupal 7
Bug: Contribution Loss on Membership Merge
April 25, 2014, 06:14:48 am
Hi All,

When two contacts with memberships of the same type are merged and the "memberships" box is checked on the merge form, contributions that were recorded as membership payments will be dropped from the "duplicate" contact.

EFF first started to notice this behavior around 4.2.  It is reproducible on the Drupal demo site.  Should I open a JIRA ticket?

Max

JonGold

  • Ask me questions
  • ****
  • Posts: 638
  • Karma: 81
    • Palante Technology
  • CiviCRM version: 4.1 to the latest
  • CMS version: Drupal 6-7, Wordpress 4.0+
  • PHP version: PHP 5.3-5.5
Re: Bug: Contribution Loss on Membership Merge
April 26, 2014, 01:42:42 pm
Hi Max,

Good to see you again yesterday!

That sounds a bit tricky - but definitely worth filing an issue on JIRA.
Sign up to StackExchange and get free expert CiviCRM advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

Max Hunter

  • I’m new here
  • *
  • Posts: 21
  • Karma: 1
  • CiviCRM version: 4.4.x
  • CMS version: Drupal 7
Re: Bug: Contribution Loss on Membership Merge
May 01, 2014, 06:48:20 pm
So it looks like this bit of code was the culprit:

Code: [Select]
if ($mode == 'payment') {
        $sqls[] = "
DELETE contribution.* FROM civicrm_contribution contribution
INNER JOIN  civicrm_membership_payment payment ON payment.contribution_id = contribution.id
INNER JOIN  civicrm_membership membership1 ON membership1.id = payment.membership_id
            AND membership1.contact_id = {$mainId}
INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = membership2.membership_type_id
            AND membership2.contact_id = {$otherId}";
      }     

Seems to be designed to clean up contributions from membership_payment.  We could remove it outright, but then people wouldn't be able to copy memberships on merge without copying membership related contributions. 

Is there an edge case where someone would want to keep memberships and drop the payment data for them?  What do you think?

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Bug: Contribution Loss on Membership Merge

This forum was archived on 2017-11-26.