forked from CGM_Public/pretix_original
send canonical mails depending on sales channel
This commit is contained in:
@@ -1491,7 +1491,7 @@ class OrderPayment(models.Model):
|
|||||||
trigger_pdf=not send_mail or not self.order.event.settings.invoice_email_attachment
|
trigger_pdf=not send_mail or not self.order.event.settings.invoice_email_attachment
|
||||||
)
|
)
|
||||||
|
|
||||||
if send_mail:
|
if send_mail and self.order.sales_channel in self.order.event.settings.mail_sales_channel_paid_placed:
|
||||||
self._send_paid_mail(invoice, user, mail_text)
|
self._send_paid_mail(invoice, user, mail_text)
|
||||||
if self.order.event.settings.mail_send_order_paid_attendee:
|
if self.order.event.settings.mail_send_order_paid_attendee:
|
||||||
for p in self.order.positions.all():
|
for p in self.order.positions.all():
|
||||||
|
|||||||
@@ -960,11 +960,12 @@ def _perform_order(event: Event, payment_provider: str, position_ids: List[str],
|
|||||||
email_attendees = event.settings.mail_send_order_placed_attendee
|
email_attendees = event.settings.mail_send_order_placed_attendee
|
||||||
email_attendees_template = event.settings.mail_text_order_placed_attendee
|
email_attendees_template = event.settings.mail_text_order_placed_attendee
|
||||||
|
|
||||||
_order_placed_email(event, order, pprov, email_template, log_entry, invoice, payment)
|
if sales_channel in event.settings.mail_sales_channel_placed_paid:
|
||||||
if email_attendees:
|
_order_placed_email(event, order, pprov, email_template, log_entry, invoice, payment)
|
||||||
for p in order.positions.all():
|
if email_attendees:
|
||||||
if p.addon_to_id is None and p.attendee_email and p.attendee_email != order.email:
|
for p in order.positions.all():
|
||||||
_order_placed_email_attendee(event, order, p, email_attendees_template, log_entry)
|
if p.addon_to_id is None and p.attendee_email and p.attendee_email != order.email:
|
||||||
|
_order_placed_email_attendee(event, order, p, email_attendees_template, log_entry)
|
||||||
|
|
||||||
return order.id
|
return order.id
|
||||||
|
|
||||||
@@ -1056,6 +1057,9 @@ def send_download_reminders(sender, **kwargs):
|
|||||||
if days is None:
|
if days is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if o.sales_channel not in event.settings.mail_sales_channel_placed_paid:
|
||||||
|
continue
|
||||||
|
|
||||||
reminder_date = (o.first_date - timedelta(days=days)).replace(hour=0, minute=0, second=0, microsecond=0)
|
reminder_date = (o.first_date - timedelta(days=days)).replace(hour=0, minute=0, second=0, microsecond=0)
|
||||||
if now() < reminder_date or o.datetime > reminder_date:
|
if now() < reminder_date or o.datetime > reminder_date:
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -1190,6 +1190,14 @@ DEFAULTS = {
|
|||||||
"Defaults to your event name."),
|
"Defaults to your event name."),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
'mail_sales_channel_placed_paid': {
|
||||||
|
'default': ['web'],
|
||||||
|
'type': list,
|
||||||
|
},
|
||||||
|
'mail_sales_channel_ticket_reminder': {
|
||||||
|
'default': ['web'],
|
||||||
|
'type': list,
|
||||||
|
},
|
||||||
'mail_text_signature': {
|
'mail_text_signature': {
|
||||||
'type': LazyI18nString,
|
'type': LazyI18nString,
|
||||||
'default': ""
|
'default': ""
|
||||||
|
|||||||
@@ -758,6 +758,26 @@ class MailSettingsForm(SettingsForm):
|
|||||||
'mail_attach_ical',
|
'mail_attach_ical',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
mail_sales_channel_placed_paid = forms.MultipleChoiceField(
|
||||||
|
choices=[(ident, sc.verbose_name) for ident, sc in get_all_sales_channels().items()],
|
||||||
|
label=_('Sales Channels for Checkout Emails'),
|
||||||
|
help_text=_('Restrict Order placed and paid emails to orders from certain sales channels.'),
|
||||||
|
widget=forms.CheckboxSelectMultiple(
|
||||||
|
attrs={'class': 'scrolling-multiple-choice'}
|
||||||
|
),
|
||||||
|
required=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
mail_sales_channel_ticket_reminder = forms.MultipleChoiceField(
|
||||||
|
choices=[(ident, sc.verbose_name) for ident, sc in get_all_sales_channels().items()],
|
||||||
|
label=_('Sales Channels for Ticket Emails'),
|
||||||
|
help_text=_('Restrict ticket reminder emails to orders from certain sales channels.'),
|
||||||
|
widget=forms.CheckboxSelectMultiple(
|
||||||
|
attrs={'class': 'scrolling-multiple-choice'}
|
||||||
|
),
|
||||||
|
required=False,
|
||||||
|
)
|
||||||
|
|
||||||
mail_bcc = forms.CharField(
|
mail_bcc = forms.CharField(
|
||||||
label=_("Bcc address"),
|
label=_("Bcc address"),
|
||||||
help_text=_("All emails will be sent to this address as a Bcc copy"),
|
help_text=_("All emails will be sent to this address as a Bcc copy"),
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
{% bootstrap_field form.mail_text_signature layout="control" %}
|
{% bootstrap_field form.mail_text_signature layout="control" %}
|
||||||
{% bootstrap_field form.mail_bcc layout="control" %}
|
{% bootstrap_field form.mail_bcc layout="control" %}
|
||||||
{% bootstrap_field form.mail_attach_ical layout="control" %}
|
{% bootstrap_field form.mail_attach_ical layout="control" %}
|
||||||
|
{% bootstrap_field form.mail_sales_channel_placed_paid layout="control" %}
|
||||||
|
{% bootstrap_field form.mail_sales_channel_ticket_reminder layout="control" %}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{% trans "E-mail design" %}</legend>
|
<legend>{% trans "E-mail design" %}</legend>
|
||||||
|
|||||||
Reference in New Issue
Block a user