diff options
author | Magnus Hagander | 2019-07-05 21:20:50 +0000 |
---|---|---|
committer | Magnus Hagander | 2019-07-08 09:47:03 +0000 |
commit | 6011655a27ed428a9a2ebc10f7dcf75ff72e6eff (patch) | |
tree | ee1c39b22a3c928e02f175f959854cd0c82a1064 /postgresqleu/confreg/util.py | |
parent | 00adf6940d1fb86bce899ee023ae4793d0bdd817 (diff) |
Add button to registration dashbaord to re-send welcome email
Diffstat (limited to 'postgresqleu/confreg/util.py')
-rw-r--r-- | postgresqleu/confreg/util.py | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/postgresqleu/confreg/util.py b/postgresqleu/confreg/util.py index 8da672f9..f56e0d0a 100644 --- a/postgresqleu/confreg/util.py +++ b/postgresqleu/confreg/util.py @@ -150,6 +150,34 @@ def attendee_cost_from_bulk_payment(reg): return (totalnovat, totalvat) +def send_welcome_email(reg): + # Do we need to send the welcome email? + if not reg.conference.sendwelcomemail: + return + + if reg.conference.tickets: + buf = BytesIO() + render_jinja_ticket(reg, buf, systemroot=JINJA_TEMPLATE_ROOT) + attachments = [ + ('{0}_ticket.pdf'.format(reg.conference.urlname), 'application/pdf', buf.getvalue()), + ] + else: + attachments = None + + # Ok, this attendee needs a notification. For now we don't support + # any string replacements in it, maybe in the future. + send_conference_mail(reg.conference, + reg.email, + "Registration complete", + 'confreg/mail/welcomemail.txt', + { + 'reg': reg, + }, + receivername=reg.fullname, + attachments=attachments, + ) + + def notify_reg_confirmed(reg, updatewaitlist=True): # This one was off the waitlist, so generate a history entry if updatewaitlist and hasattr(reg, 'registrationwaitlistentry'): @@ -212,31 +240,7 @@ def notify_reg_confirmed(reg, updatewaitlist=True): receivername=reg.conference.conferencename, ) - # Do we need to send the welcome email? - if not reg.conference.sendwelcomemail: - return - - if reg.conference.tickets: - buf = BytesIO() - render_jinja_ticket(reg, buf, systemroot=JINJA_TEMPLATE_ROOT) - attachments = [ - ('{0}_ticket.pdf'.format(reg.conference.urlname), 'application/pdf', buf.getvalue()), - ] - else: - attachments = None - - # Ok, this attendee needs a notification. For now we don't support - # any string replacements in it, maybe in the future. - send_conference_mail(reg.conference, - reg.email, - "Registration complete", - 'confreg/mail/welcomemail.txt', - { - 'reg': reg, - }, - receivername=reg.fullname, - attachments=attachments, - ) + send_welcome_email(reg) def cancel_registration(reg, is_unconfirmed=False, reason=None): |