lcdservices / biz.lcdservices.movecontrib

CiviCRM extension to support moving a contribution from one contact to another.
Other
4 stars 8 forks source link

Financial items aren't updated, resulting in deletion #2

Closed MegaphoneJon closed 3 years ago

MegaphoneJon commented 5 years ago

To replicate:

This is because there's a foreign key (with cascading delete) on the contact_id field in civicrm_financial_item. There is a check in place to prevent deleting a contact with a contribution - but not a contact with a financial item and no contribution.

If, instead of moving the contribution and deleting it, you merge the two contacts, the contact_id on the financial item is updated. This is, I believe, the correct behavior.

MegaphoneJon commented 5 years ago

Looking through how Dedupe code handles it, I also wonder what the correct behavior is if the contribution is tied to a pledge, membership or participant record. I'm leaving that out of scope for now though.

lcdservices commented 5 years ago

Good find. I'll work on a fix.

Re: linked entities -- we don't touch them (on purpose). So if a contrib is linked to a membership, moving it will retain the link to the membership. That's useful in a case where you have a membership created and then later find that someone else will be paying for it, thus the need to move the contribution but keep the membership attached to the original contact.

lcdservices commented 3 years ago

fixed with version 2.1