mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
Make it optional to notify user on order change
This commit is contained in:
@@ -90,6 +90,14 @@ class OtherOperationsForm(forms.Form):
|
||||
'Use with care and only if you need to. Note that rounding differences might occur in this procedure.'
|
||||
)
|
||||
)
|
||||
notify = forms.BooleanField(
|
||||
label=_('Notify user'),
|
||||
required=False,
|
||||
initial=True,
|
||||
help_text=_(
|
||||
'Send an email to the customer notifying that their order has been changed.'
|
||||
)
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
kwargs.pop('order')
|
||||
|
||||
@@ -175,6 +175,7 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
{% bootstrap_field other_form.recalculate_taxes layout="control" %}
|
||||
{% bootstrap_field other_form.notify layout="control" %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -600,7 +600,12 @@ class OrderChange(OrderView):
|
||||
return True
|
||||
|
||||
def post(self, *args, **kwargs):
|
||||
ocm = OrderChangeManager(self.order, self.request.user)
|
||||
notify = self.other_form.cleaned_data['notify'] if self.other_form.is_valid() else True
|
||||
ocm = OrderChangeManager(
|
||||
self.order,
|
||||
user=self.request.user,
|
||||
notify=notify
|
||||
)
|
||||
form_valid = self._process_add(ocm) and self._process_change(ocm) and self._process_other(ocm)
|
||||
|
||||
if not form_valid:
|
||||
@@ -611,7 +616,10 @@ class OrderChange(OrderView):
|
||||
except OrderError as e:
|
||||
messages.error(self.request, str(e))
|
||||
else:
|
||||
messages.success(self.request, _('The order has been changed and the user has been notified.'))
|
||||
if notify:
|
||||
messages.success(self.request, _('The order has been changed and the user has been notified.'))
|
||||
else:
|
||||
messages.success(self.request, _('The order has been changed.'))
|
||||
return self._redirect_back()
|
||||
|
||||
return self.get(*args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user