3sd / civicrm-recalculate-recipients

Moved to https://lab.civicrm.org/extensions/civicrm-recalculate-recipients
Other
6 stars 5 forks source link

Look into taking advantage of Flexmailer #3

Closed michaelmcandrew closed 2 months ago

michaelmcandrew commented 6 years ago

From a Mattermost chat with @totten...

@michaelmcandrew My use of the API wrapper on job.process_mailings was a second choice - ideally, I would have liked to have a hook / event that is called exactly once just before starting a mailing.

But I couldn't find one in the current code base. Maybe there is such an event in Flexmailer?

@totten WalkBatchesEvent ( https://docs.civicrm.org/flexmailer/en/latest/develop/ ) might be a bit closer. It fires at the start of a job.

if there are cases of multiple-jobs for the same mailing, this wouldn't distinguish those implicitly. you'd have to do some kind of sql query. (edited)

in the example snippet of https://docs.civicrm.org/flexmailer/en/latest/develop/WalkBatchesEvent/, the example_civicrm_container() would be representative. but the _example_walk_batches() would be more like

function _example_walk_batches(Event $e)
  if ($e->getJob() is the first job for this mailing)
    then recompute recipients for $e->getMailing()
totten commented 6 years ago

FWIW, the RunEvent is probably a little more on-the-nose for this case, but it was missing from the docs.

Added: https://docs.civicrm.org/flexmailer/en/latest/develop/RunEvent/

michaelmcandrew commented 2 months ago

Closing this issue as I am archiving this repo - please open an issue on https://lab.civicrm.org/extensions/civicrm-recalculate-recipients and reference this issue if you'd like to continue the discussion.