Skip to content

Avoid fatal errors when resending to an existing recipient

bgm requested to merge bgm/resendmailing:issue3 into main

Replaces !5 (closed)

(original description)

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.

This MR also does a small change to the interface: it only lists non-SMS mailings (it does not work with SMS mailings, and nice to have them out of the way).

Edited by bgm

Merge request reports

Loading