Separate personalization from admission (#2990)

Co-authored-by: Richard Schreiber <schreiber@rami.io>
This commit is contained in:
Raphael Michel
2023-01-09 14:57:35 +01:00
committed by GitHub
parent e5528f7784
commit 603225d042
30 changed files with 293 additions and 52 deletions

View File

@@ -985,22 +985,22 @@ class QuestionsStep(QuestionsViewMixin, CartMixin, TemplateFlowStep):
if warn:
messages.warning(request, _('Please fill in answers to all required questions.'))
return False
if cp.item.admission and self.request.event.settings.get('attendee_names_required', as_type=bool) \
if cp.item.ask_attendee_data and self.request.event.settings.get('attendee_names_required', as_type=bool) \
and not cp.attendee_name_parts:
if warn:
messages.warning(request, _('Please fill in answers to all required questions.'))
return False
if cp.item.admission and self.request.event.settings.get('attendee_emails_required', as_type=bool) \
if cp.item.ask_attendee_data and self.request.event.settings.get('attendee_emails_required', as_type=bool) \
and cp.attendee_email is None:
if warn:
messages.warning(request, _('Please fill in answers to all required questions.'))
return False
if cp.item.admission and self.request.event.settings.get('attendee_company_required', as_type=bool) \
if cp.item.ask_attendee_data and self.request.event.settings.get('attendee_company_required', as_type=bool) \
and cp.company is None:
if warn:
messages.warning(request, _('Please fill in answers to all required questions.'))
return False
if cp.item.admission and self.request.event.settings.get('attendee_attendees_required', as_type=bool) \
if cp.item.ask_attendee_data and self.request.event.settings.get('attendee_attendees_required', as_type=bool) \
and (cp.street is None or cp.city is None or cp.country is None):
if warn:
messages.warning(request, _('Please fill in answers to all required questions.'))

View File

@@ -97,7 +97,7 @@
</summary>
<div>
<div class="panel-body questions-form">
{% if event.settings.attendee_data_explanation_text and pos.item.admission %}
{% if event.settings.attendee_data_explanation_text and pos.item.ask_attendee_data %}
{{ event.settings.attendee_data_explanation_text|rich_text }}
{% endif %}
{% if pos.seat %}

View File

@@ -127,7 +127,7 @@
{% endif %}
{% if line.has_questions %}
<dl class="dl-indented">
{% if line.item.admission %}
{% if line.item.ask_attendee_data %}
{% if event.settings.attendee_names_asked %}
<dt class="sr-only">
{% trans "Attendee name" %}

View File

@@ -149,7 +149,7 @@ class CartMixin:
# We do this by list manipulations instead of a GROUP BY query, as
# Django is unable to join related models in a .values() query
def group_key(pos): # only used for grouping, sorting is done before already
has_attendee_data = pos.item.admission and (
has_attendee_data = pos.item.ask_attendee_data and (
self.request.event.settings.attendee_names_asked
or self.request.event.settings.attendee_emails_asked
or self.request.event.settings.attendee_company_asked