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

Your Answer

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

Browse other questions tagged or ask your own question.