mirror of
https://github.com/pretix/pretix.git
synced 2026-05-07 15:34:02 +00:00
Flip order of invoices and tickets in email attachments
This commit is contained in:
@@ -276,20 +276,6 @@ def mail_send_task(self, *args, to: List[str], subject: str, body: str, html: st
|
|||||||
cm = lambda: scopes_disabled() # noqa
|
cm = lambda: scopes_disabled() # noqa
|
||||||
|
|
||||||
with cm():
|
with cm():
|
||||||
if invoices:
|
|
||||||
invoices = Invoice.objects.filter(pk__in=invoices)
|
|
||||||
for inv in invoices:
|
|
||||||
if inv.file:
|
|
||||||
try:
|
|
||||||
with language(inv.order.locale):
|
|
||||||
email.attach(
|
|
||||||
pgettext('invoice', 'Invoice {num}').format(num=inv.number).replace(' ', '_') + '.pdf',
|
|
||||||
inv.file.file.read(),
|
|
||||||
'application/pdf'
|
|
||||||
)
|
|
||||||
except:
|
|
||||||
logger.exception('Could not attach invoice to email')
|
|
||||||
pass
|
|
||||||
if event:
|
if event:
|
||||||
if order:
|
if order:
|
||||||
try:
|
try:
|
||||||
@@ -344,6 +330,21 @@ def mail_send_task(self, *args, to: List[str], subject: str, body: str, html: st
|
|||||||
|
|
||||||
email = email_filter.send_chained(event, 'message', message=email, order=order, user=user)
|
email = email_filter.send_chained(event, 'message', message=email, order=order, user=user)
|
||||||
|
|
||||||
|
if invoices:
|
||||||
|
invoices = Invoice.objects.filter(pk__in=invoices)
|
||||||
|
for inv in invoices:
|
||||||
|
if inv.file:
|
||||||
|
try:
|
||||||
|
with language(inv.order.locale):
|
||||||
|
email.attach(
|
||||||
|
pgettext('invoice', 'Invoice {num}').format(num=inv.number).replace(' ', '_') + '.pdf',
|
||||||
|
inv.file.file.read(),
|
||||||
|
'application/pdf'
|
||||||
|
)
|
||||||
|
except:
|
||||||
|
logger.exception('Could not attach invoice to email')
|
||||||
|
pass
|
||||||
|
|
||||||
email = global_email_filter.send_chained(event, 'message', message=email, user=user, order=order)
|
email = global_email_filter.send_chained(event, 'message', message=email, user=user, order=order)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user