mirror of
https://github.com/pretix/pretix.git
synced 2026-05-09 15:54:03 +00:00
Do not allow modifications after checkin
This commit is contained in:
@@ -580,6 +580,7 @@ class EventSettingsSerializer(SettingsSerializer):
|
|||||||
'locale',
|
'locale',
|
||||||
'region',
|
'region',
|
||||||
'last_order_modification_date',
|
'last_order_modification_date',
|
||||||
|
'allow_modifications_after_checkin',
|
||||||
'show_quota_left',
|
'show_quota_left',
|
||||||
'waiting_list_enabled',
|
'waiting_list_enabled',
|
||||||
'waiting_list_hours',
|
'waiting_list_hours',
|
||||||
|
|||||||
@@ -666,6 +666,8 @@ class Order(LockModel, LoggedModel):
|
|||||||
related to the order. This checks order status and modification deadlines. It also
|
related to the order. This checks order status and modification deadlines. It also
|
||||||
returns ``False`` if there are no questions that can be answered.
|
returns ``False`` if there are no questions that can be answered.
|
||||||
"""
|
"""
|
||||||
|
from .checkin import Checkin
|
||||||
|
|
||||||
if self.status not in (Order.STATUS_PENDING, Order.STATUS_PAID, Order.STATUS_EXPIRED):
|
if self.status not in (Order.STATUS_PENDING, Order.STATUS_PAID, Order.STATUS_EXPIRED):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -681,10 +683,21 @@ class Order(LockModel, LoggedModel):
|
|||||||
|
|
||||||
if modify_deadline is not None and now() > modify_deadline:
|
if modify_deadline is not None and now() > modify_deadline:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
positions = list(
|
||||||
|
self.positions.all().annotate(
|
||||||
|
has_checkin=Exists(Checkin.objects.filter(position_id=OuterRef('pk')))
|
||||||
|
).select_related('item').prefetch_related('item__questions')
|
||||||
|
)
|
||||||
|
if not self.event.settings.allow_modifications_after_checkin:
|
||||||
|
for cp in positions:
|
||||||
|
if cp.has_checkin:
|
||||||
|
return False
|
||||||
|
|
||||||
if self.event.settings.get('invoice_address_asked', as_type=bool):
|
if self.event.settings.get('invoice_address_asked', as_type=bool):
|
||||||
return True
|
return True
|
||||||
ask_names = self.event.settings.get('attendee_names_asked', as_type=bool)
|
ask_names = self.event.settings.get('attendee_names_asked', as_type=bool)
|
||||||
for cp in self.positions.all().prefetch_related('item__questions'):
|
for cp in positions:
|
||||||
if (cp.item.admission and ask_names) or cp.item.questions.all():
|
if (cp.item.admission and ask_names) or cp.item.questions.all():
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
@@ -1082,6 +1082,15 @@ DEFAULTS = {
|
|||||||
help_text=_('If your event series has more than 50 dates in the future, only the month or week calendar can be used.')
|
help_text=_('If your event series has more than 50 dates in the future, only the month or week calendar can be used.')
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
'allow_modifications_after_checkin': {
|
||||||
|
'default': 'False',
|
||||||
|
'type': bool,
|
||||||
|
'form_class': forms.BooleanField,
|
||||||
|
'serializer_class': serializers.BooleanField,
|
||||||
|
'form_kwargs': dict(
|
||||||
|
label=_("Allow customers to modify their information after they checked in."),
|
||||||
|
)
|
||||||
|
},
|
||||||
'last_order_modification_date': {
|
'last_order_modification_date': {
|
||||||
'default': None,
|
'default': None,
|
||||||
'type': RelativeDateWrapper,
|
'type': RelativeDateWrapper,
|
||||||
|
|||||||
@@ -457,6 +457,7 @@ class EventSettingsForm(SettingsForm):
|
|||||||
'banner_text_bottom',
|
'banner_text_bottom',
|
||||||
'order_email_asked_twice',
|
'order_email_asked_twice',
|
||||||
'last_order_modification_date',
|
'last_order_modification_date',
|
||||||
|
'allow_modifications_after_checkin',
|
||||||
'checkout_show_copy_answers_button',
|
'checkout_show_copy_answers_button',
|
||||||
'primary_color',
|
'primary_color',
|
||||||
'theme_color_success',
|
'theme_color_success',
|
||||||
|
|||||||
@@ -243,6 +243,7 @@
|
|||||||
{% bootstrap_field form.presale_end layout="control" %}
|
{% bootstrap_field form.presale_end layout="control" %}
|
||||||
{% bootstrap_field sform.show_items_outside_presale_period layout="control" %}
|
{% bootstrap_field sform.show_items_outside_presale_period layout="control" %}
|
||||||
{% bootstrap_field sform.last_order_modification_date layout="control" %}
|
{% bootstrap_field sform.last_order_modification_date layout="control" %}
|
||||||
|
{% bootstrap_field sform.allow_modifications_after_checkin layout="control" %}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{% trans "Display" %}</legend>
|
<legend>{% trans "Display" %}</legend>
|
||||||
|
|||||||
Reference in New Issue
Block a user