2

I've been requested to add a feature to our installation that allows an admin to copy or duplicate an existing contribution, including all it's custom fields.

I was wondering if anyone has tackled this before, or if there is an extension out there which may help.

If not, any pointers to doing this the right way? Should/Can this be written as an extension?

I was thinking to add a button on the contribution view page (not sure which template this may be yet), and then use the API to pull the current contribution (hopefully with custom fields) and create a new one with the same fields (removing/replacing the transaction id so we don't have a duplicate key).

I'd appreciate any tips on this.

  • What is the use case for this? Although you could use the API to get the fields of an existing contribution and create a new one, there are other fields besides transaction id that would not make sense to copy like dates, check_number, recurrence info, maybe status etc. It would be safer to determine which fields you want to copy for your needs than just duplicate an existing one. – Aidan Apr 29 '17 at 13:41
  • The use case is for recurring checks and other offline type payments. We have certain folks who donate regularly offline (check/cash), and each time the info is all similar (same custom fields, which there are a bunch of, etc). And yes, my plan is to reset certain fields, most of the ones you mentioned and a couple of others. I was thinking to grab them all, reset the ones I need to, then create the new. The admins trigger the copy and then review immediately after creation (will send them to the new cont's edit page right after successfully creating it). – Paul B Apr 29 '17 at 18:04
  • Related: How can I clone a contact? - maybe there's room for an extension which provides a generic "clone this entity" functionality ... – Chris Burgess May 2 '17 at 10:42
2

To this very old but unanswered question, I'll answer that there's now an extension that does exactly what you're asking: Clone Contribution. Quoting from the description:

Screenshot

This extension provides:

  • UI controls to clone a particular contribution, wherever contributions are listed (e.g., a contact's Contributions tab; contributions search results).
  • Options to omit certain contribution properties from the cloning process (i.e., properties that will not be copied from the source contribution to the new contribution).
  • An API Contribution.clone for cloning any number of contributions.

During the cloning process, the following contribution properties can be changed so that they're immediately different in the new contribution:

  • Contribution Status

I'm the developer on this extension.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.