You are browsing a read-only backup copy of Wikitech. The primary site can be found at wikitech.wikimedia.org

Fundraising/Internal Endpoints/End of year emails: Difference between revisions

From Wikitech-static
Jump to navigation Jump to search
imported>Eileen
No edit summary
imported>Eileen
(Removed references to drupal module)
Line 1: Line 1:
We send a letter for recurring donations once a year rather than as each donation is received. The code to do this is currently in 2 places (being consolidated to 1)
We send a letter for recurring donations once a year rather than as each donation is received. The code to do this is currently in  
 
* <code>civicrm_extension wmf-thankyou</code>
 
 
* <code>drupal module wmf_eoy_receipt</code> (old)
* <code>civicrm_extension wmf-thankyou</code> (new)


[[File:Action item.png|thumb]]
[[File:Action item.png|thumb]]
Line 12: Line 8:
The bulk jobs are to be scheduled - the idea is that there are 2 jobs
The bulk jobs are to be scheduled - the idea is that there are 2 jobs


* '''`<code>drush @wmff wmf-eoy-calculate-summaries --year=2021</code>`''' (being changed to `<code>drush @wmff cvapi EOYEmail.MakeJob version=4 year=2021</code>`) should be run just once. It populates a `<code>wmf_eoy_receipt_donor</code>` with basic details for all the emails sent and assigns them a job number, recorded in `<code>wmf_eoy_receipt_job</code>`. This job number is then an input into the second job.
* <code>drush @wmff cvapi EOYEmail.MakeJob version=4 year=2021</code>`) should be run just once. It populates a `<code>wmf_eoy_receipt_donor</code>` with a list of email addresses to receive an end of year summary, the relevant year, and the status of their summary
 
*<code>drush @wmff cvapi EOYEmail.Send version=4 year=2021</code>`) should be run just once. It populates a `<code>wmf_eoy_receipt_donor</code>` with a list of email addresses to receive an end of year summary, the relevant year, and the status of their summary
* '''`<code>drush @wmff wmf-eoy-send-letters --job_id=x</code>`''' should be scheduled to run regularly. It picks up the rows from the `<code>wmf_eoy_receipt_donor</code>` table with a status of queued & the relevant job id, sends them an email and updates them to 'sent'
 
 
The jobs can be called together with a 3rd drush command `<code>drush @wmff wmf-eoy-receipts --year=2021</code>` - this probably only makes sense in dev environments
 
=====What is the point of the job number=====
The job number survives from some very old code. I think the thinking behind the job number was around a degree of batching and maybe parallel queues that is not really in play. However, it still achieves 'something' - if you were to try to send an individual receipt out from the UI then the send part of that action needs to only pick up that contact - or else it would send to the next x in the queue rather than that 1 contact, while the user waits.
 
=====What is changing=====
 
*consolidating all the code into the extension
*switching from twig to smarty
*moving the templates into the database
*using API actions rather than drush commands as part of drupal module decommissioning
 
===== OLD docs =====
This is a drupal module that sends an email at the beginning of every year to all donors who have a recurring donation showing all their donations from the previous year.
 
<nowiki>'''Scripts'''</nowiki>
 
There are three scripts, one to set up the data for the year and two to send the emails.
 
<nowiki>'''eoy_receipt_calculate'''</nowiki>
 
This takes the year passed in and calculates the recurring information from them and puts it into the drupal db table <nowiki>'''wmf_eoy_receipt_donor.'''</nowiki>


When running this in 2021, it caused the civi UI to be slow as well as deadlocks for any running jobs.
When running the calculate job in 2021, it caused the civi UI to be slow as well as deadlocks for any running jobs.


<nowiki>'''eoy_receipt_send'''</nowiki>
<nowiki>'''eoy_receipt_send'''</nowiki>
Line 51: Line 22:


<nowiki>'''How to Run'''</nowiki>
<nowiki>'''How to Run'''</nowiki>
<nowiki>#</nowiki> There is a drupal variable to set [find the link] for the year you want the module to run for. This is used as the {year} variable in the content of the email sent.
<nowiki>#</nowiki> Clear out the previous years tables in the drupal db <nowiki>'''</nowiki>wmf_eoy_receipt_donor<nowiki>'''</nowiki> and <nowiki>'''</nowiki>wmf_eoy_receipt_job<nowiki>'''</nowiki>


<nowiki>#</nowiki> Turn off all the jobs and notify any civi users that the UI will be slow while the calculate job runs
<nowiki>#</nowiki> Turn off all the jobs and notify any civi users that the UI will be slow while the calculate job runs

Revision as of 23:07, 12 December 2021

We send a letter for recurring donations once a year rather than as each donation is received. The code to do this is currently in

  • civicrm_extension wmf-thankyou

The code was written to bulk receipt recurring donations but a user-requested feature was added to support sending from the UI for a single donor. This UI feature is accessible from the actions menu (bottom right) from the contact summary screen.


The bulk jobs are to be scheduled - the idea is that there are 2 jobs

  • drush @wmff cvapi EOYEmail.MakeJob version=4 year=2021`) should be run just once. It populates a `wmf_eoy_receipt_donor` with a list of email addresses to receive an end of year summary, the relevant year, and the status of their summary
  • drush @wmff cvapi EOYEmail.Send version=4 year=2021`) should be run just once. It populates a `wmf_eoy_receipt_donor` with a list of email addresses to receive an end of year summary, the relevant year, and the status of their summary

When running the calculate job in 2021, it caused the civi UI to be slow as well as deadlocks for any running jobs.

'''eoy_receipt_send'''

This sends half the emails through frmx1001

'''eoy_receipt_send_two'''

This sends the other half of the emails through frmx2001

'''How to Run'''

# Turn off all the jobs and notify any civi users that the UI will be slow while the calculate job runs

# Run eoy_receipt_calculate. This only needs to be run once then everything in in the table for the email sends.

# Turn the jobs back on

# Test sending a receipt with slow start

# Turn the main sending jobs on