mirror of
https://github.com/pretix/pretix.git
synced 2026-05-08 15:44:02 +00:00
Fix localization of payment reminder email
This commit is contained in:
@@ -387,28 +387,28 @@ class Order(LoggedModel):
|
|||||||
"""
|
"""
|
||||||
from pretix.base.services.mail import SendMailException, mail, render_mail
|
from pretix.base.services.mail import SendMailException, mail, render_mail
|
||||||
|
|
||||||
recipient = self.email
|
with language(self.locale):
|
||||||
try:
|
recipient = self.email
|
||||||
with language(self.locale):
|
try:
|
||||||
email_content = render_mail(template, context)[0]
|
email_content = render_mail(template, context)[0]
|
||||||
mail(
|
mail(
|
||||||
recipient, subject, template, context,
|
recipient, subject, template, context,
|
||||||
self.event, self.locale, self, headers, sender,
|
self.event, self.locale, self, headers, sender,
|
||||||
invoices=invoices
|
invoices=invoices
|
||||||
)
|
)
|
||||||
except SendMailException:
|
except SendMailException:
|
||||||
raise
|
raise
|
||||||
else:
|
else:
|
||||||
self.log_action(
|
self.log_action(
|
||||||
log_entry_type,
|
log_entry_type,
|
||||||
user=user,
|
user=user,
|
||||||
data={
|
data={
|
||||||
'subject': subject,
|
'subject': subject,
|
||||||
'message': email_content,
|
'message': email_content,
|
||||||
'recipient': recipient,
|
'recipient': recipient,
|
||||||
'invoices': [i.pk for i in invoices] if invoices else []
|
'invoices': [i.pk for i in invoices] if invoices else []
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def answerfile_name(instance, filename: str) -> str:
|
def answerfile_name(instance, filename: str) -> str:
|
||||||
|
|||||||
@@ -581,37 +581,38 @@ def send_expiry_warnings(sender, **kwargs):
|
|||||||
days = eventsettings.get('mail_days_order_expire_warning', as_type=int)
|
days = eventsettings.get('mail_days_order_expire_warning', as_type=int)
|
||||||
tz = pytz.timezone(eventsettings.get('timezone', settings.TIME_ZONE))
|
tz = pytz.timezone(eventsettings.get('timezone', settings.TIME_ZONE))
|
||||||
if days and (o.expires - today).days <= days:
|
if days and (o.expires - today).days <= days:
|
||||||
o.expiry_reminder_sent = True
|
with language(o.locale):
|
||||||
o.save()
|
o.expiry_reminder_sent = True
|
||||||
try:
|
o.save()
|
||||||
invoice_name = o.invoice_address.name
|
try:
|
||||||
invoice_company = o.invoice_address.company
|
invoice_name = o.invoice_address.name
|
||||||
except InvoiceAddress.DoesNotExist:
|
invoice_company = o.invoice_address.company
|
||||||
invoice_name = ""
|
except InvoiceAddress.DoesNotExist:
|
||||||
invoice_company = ""
|
invoice_name = ""
|
||||||
email_template = eventsettings.mail_text_order_expire_warning
|
invoice_company = ""
|
||||||
email_context = {
|
email_template = eventsettings.mail_text_order_expire_warning
|
||||||
'event': o.event.name,
|
email_context = {
|
||||||
'url': build_absolute_uri(o.event, 'presale:event.order', kwargs={
|
'event': o.event.name,
|
||||||
'order': o.code,
|
'url': build_absolute_uri(o.event, 'presale:event.order', kwargs={
|
||||||
'secret': o.secret
|
'order': o.code,
|
||||||
}),
|
'secret': o.secret
|
||||||
'expire_date': date_format(o.expires.astimezone(tz), 'SHORT_DATE_FORMAT'),
|
}),
|
||||||
'invoice_name': invoice_name,
|
'expire_date': date_format(o.expires.astimezone(tz), 'SHORT_DATE_FORMAT'),
|
||||||
'invoice_company': invoice_company,
|
'invoice_name': invoice_name,
|
||||||
}
|
'invoice_company': invoice_company,
|
||||||
if eventsettings.payment_term_expire_automatically:
|
}
|
||||||
email_subject = _('Your order is about to expire: %(code)s') % {'code': o.code}
|
if eventsettings.payment_term_expire_automatically:
|
||||||
else:
|
email_subject = _('Your order is about to expire: %(code)s') % {'code': o.code}
|
||||||
email_subject = _('Your order is pending payment: %(code)s') % {'code': o.code}
|
else:
|
||||||
|
email_subject = _('Your order is pending payment: %(code)s') % {'code': o.code}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
o.send_mail(
|
o.send_mail(
|
||||||
email_subject, email_template, email_context,
|
email_subject, email_template, email_context,
|
||||||
'pretix.event.order.email.expire_warning_sent'
|
'pretix.event.order.email.expire_warning_sent'
|
||||||
)
|
)
|
||||||
except SendMailException:
|
except SendMailException:
|
||||||
logger.exception('Reminder email could not be sent')
|
logger.exception('Reminder email could not be sent')
|
||||||
|
|
||||||
|
|
||||||
@receiver(signal=periodic_task)
|
@receiver(signal=periodic_task)
|
||||||
|
|||||||
Reference in New Issue
Block a user