Fix name placeholder not being used correctly in scheduled emails (#2794)

This commit is contained in:
Raphael Michel
2022-09-15 13:35:35 +02:00
committed by GitHub
parent 0fc7d78281
commit 87cfd8f538
3 changed files with 7 additions and 5 deletions

View File

@@ -140,7 +140,7 @@ class ScheduledMail(models.Model):
ia = InvoiceAddress(order=o)
if send_to_orders and o.email:
email_ctx = get_email_context(event=e, order=o, position_or_address=ia)
email_ctx = get_email_context(event=e, order=o, invoice_address=ia)
try:
o.send_mail(self.rule.subject, self.rule.template, email_ctx,
log_entry_type='pretix.plugins.sendmail.rule.order.email.sent')
@@ -155,12 +155,13 @@ class ScheduledMail(models.Model):
positions = [p for p in positions if p.subevent_id == self.subevent_id]
for p in positions:
email_ctx = get_email_context(event=e, order=o, position_or_address=ia, position=p)
try:
if p.attendee_email and (p.attendee_email != o.email or not o_sent):
email_ctx = get_email_context(event=e, order=o, invoice_address=ia, position=p)
p.send_mail(self.rule.subject, self.rule.template, email_ctx,
log_entry_type='pretix.plugins.sendmail.rule.order.position.email.sent')
elif not o_sent and o.email:
email_ctx = get_email_context(event=e, order=o, invoice_address=ia)
o.send_mail(self.rule.subject, self.rule.template, email_ctx,
log_entry_type='pretix.plugins.sendmail.rule.order.email.sent')
o_sent = True

View File

@@ -87,7 +87,7 @@ def send_mails(event: Event, user: int, subject: dict, message: dict, orders: li
try:
with language(o.locale, event.settings.region):
email_context = get_email_context(event=event, order=o, position_or_address=p, position=p)
email_context = get_email_context(event=event, order=o, invoice_address=ia, position=p)
mail(
p.attendee_email,
subject,
@@ -116,7 +116,7 @@ def send_mails(event: Event, user: int, subject: dict, message: dict, orders: li
if send_to_order and o.email:
try:
with language(o.locale, event.settings.region):
email_context = get_email_context(event=event, order=o, position_or_address=ia)
email_context = get_email_context(event=event, order=o, invoice_address=ia)
mail(
o.email,
subject,