From 009e3a6d36d5411589333285e939eb79502b0fd4 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Fri, 12 Apr 2024 15:00:00 +0200 Subject: [PATCH] Respect Order.valid_if_pending for mail_attach_ical_paid_only (#4065) --- src/pretix/base/services/orders.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/pretix/base/services/orders.py b/src/pretix/base/services/orders.py index 58991c30c..8e5a24d93 100644 --- a/src/pretix/base/services/orders.py +++ b/src/pretix/base/services/orders.py @@ -413,7 +413,9 @@ def approve_order(order, user=None, send_mail: bool=True, auth=None, force=False 'pretix.event.order.email.order_approved', user, attach_tickets=True, attach_ical=order.event.settings.mail_attach_ical and ( - not order.event.settings.mail_attach_ical_paid_only or order.total == Decimal('0.00') + not order.event.settings.mail_attach_ical_paid_only or + order.total == Decimal('0.00') or + order.valid_if_pending ), invoices=[invoice] if invoice and order.event.settings.invoice_email_attachment else [] ) @@ -1055,7 +1057,11 @@ def _order_placed_email(event: Event, order: Order, email_template, subject_temp log_entry, invoices=[invoice] if invoice and event.settings.invoice_email_attachment else [], attach_tickets=True, - attach_ical=event.settings.mail_attach_ical and (not event.settings.mail_attach_ical_paid_only or is_free), + attach_ical=event.settings.mail_attach_ical and ( + not event.settings.mail_attach_ical_paid_only or + is_free or + order.valid_if_pending + ), attach_other_files=[a for a in [ event.settings.get('mail_attachment_new_order', as_type=str, default='')[len('file://'):] ] if a], @@ -1074,7 +1080,11 @@ def _order_placed_email_attendee(event: Event, order: Order, position: OrderPosi log_entry, invoices=[], attach_tickets=True, - attach_ical=event.settings.mail_attach_ical and (not event.settings.mail_attach_ical_paid_only or is_free), + attach_ical=event.settings.mail_attach_ical and ( + not event.settings.mail_attach_ical_paid_only or + is_free or + order.valid_if_pending + ), attach_other_files=[a for a in [ event.settings.get('mail_attachment_new_order', as_type=str, default='')[len('file://'):] ] if a],