Skip to content

Avoid fatal errors when resending to an existing recipient

Rich requested to merge github/fork/mlutfy/issue3 into main

Created by: mlutfy

I ran into #3 (closed) and could reproduce it fairly systematically:

  • Send a mailing to some recipients normally (not using this extension)
  • Then use this extension to resend the mailing to a single contact
  • and then resend to them again (using the same form)

For the problem to happen, activity creation must be enabled (which is the CiviCRM default, iirc).

The interface would show "DB error: already exists", this is because of writeToDB which checks if an activity already exists for the mailing, and if so, it adds the contact as a target to that activity. If they already received the mailing, then it causes a duplicate, which the DB prevents because of unique indexes.

And then, for some mysterious reason which could only be found in the forgotten depths of old BAOs, CiviCRM resends the mailing to all the original recipients of the mailing.

Edited by bgm

Merge request reports