Cancelling events: Allow to inform waiting list

This commit is contained in:
Raphael Michel
2020-03-05 10:22:59 +01:00
parent 447b6b7fee
commit 9b50ec2d74
5 changed files with 101 additions and 5 deletions

View File

@@ -552,6 +552,12 @@ class EventCancelForm(forms.Form):
)
send_subject = forms.CharField()
send_message = forms.CharField()
send_waitinglist = forms.BooleanField(
label=_("Send information to waiting list"),
required=False
)
send_waitinglist_subject = forms.CharField()
send_waitinglist_message = forms.CharField()
def _set_field_placeholders(self, fn, base_parameters):
phs = [
@@ -596,6 +602,28 @@ class EventCancelForm(forms.Form):
'order', 'event'])
self._set_field_placeholders('send_message', ['event_or_subevent', 'refund_amount', 'position_or_address',
'order', 'event'])
self.fields['send_waitinglist_subject'] = I18nFormField(
label=_("Subject"),
required=True,
initial=_('Canceled: {event}'),
widget=I18nTextInput,
locales=self.event.settings.get('locales'),
)
self.fields['send_waitinglist_message'] = I18nFormField(
label=_('Message'),
widget=I18nTextarea,
required=True,
locales=self.event.settings.get('locales'),
initial=LazyI18nString.from_gettext(gettext_noop(
'Hello,\n\n'
'with this email, we regret to inform you that {event} has been canceled.\n\n'
'You will therefore not receive a ticket from the waiting list.\n\n'
'Best regards,\n\n'
'Your {event} team'
))
)
self._set_field_placeholders('send_waitinglist_subject', ['event_or_subevent', 'event'])
self._set_field_placeholders('send_waitinglist_message', ['event_or_subevent', 'event'])
if self.event.has_subevents:
self.fields['subevent'].queryset = self.event.subevents.all()

View File

@@ -43,6 +43,26 @@
{% bootstrap_field form.send_subject layout="horizontal" %}
{% bootstrap_field form.send_message layout="horizontal" %}
</fieldset>
<fieldset>
<legend>{% trans "Waiting list" %}</legend>
<p>
{% blocktrans trimmed %}
Your waiting list will not be deleted automatically, but it will receive no new tickets due to the
products being disabled. You can choose to inform people on the waiting list by using this option.
{% endblocktrans %}
</p>
<p>
<strong>
{% blocktrans trimmed %}
You should not execute this function multiple times for the same event, or everyone on the
waiting list will get multiple emails.
{% endblocktrans %}
</strong>
</p>
{% bootstrap_field form.send_waitinglist layout="control" %}
{% bootstrap_field form.send_waitinglist_subject layout="horizontal" %}
{% bootstrap_field form.send_waitinglist_message layout="horizontal" %}
</fieldset>
<div class="form-group submit-group">
<button type="submit" class="btn btn-danger btn-save">
{% trans "Cancel all orders" %}

View File

@@ -1915,6 +1915,9 @@ class EventCancel(EventPermissionRequiredMixin, AsyncAction, FormView):
send=form.cleaned_data.get('send'),
send_subject=form.cleaned_data.get('send_subject').data,
send_message=form.cleaned_data.get('send_message').data,
send_waitinglist=form.cleaned_data.get('send'),
send_waitinglist_subject=form.cleaned_data.get('send_waitinglist_subject').data,
send_waitinglist_message=form.cleaned_data.get('send_waitinglist_message').data,
user=self.request.user.pk,
)