forked from CGM_Public/pretix_original
Customer accounts: Only link orders by email if wanted
This commit is contained in:
@@ -285,6 +285,7 @@ class OrganizerSettingsForm(SettingsForm):
|
||||
)
|
||||
auto_fields = [
|
||||
'customer_accounts',
|
||||
'customer_accounts_link_by_email',
|
||||
'contact_mail',
|
||||
'imprint_url',
|
||||
'organizer_info_text',
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
<fieldset>
|
||||
<legend>{% trans "Customer accounts" %}</legend>
|
||||
{% bootstrap_field sform.customer_accounts layout="control" %}
|
||||
{% bootstrap_field sform.customer_accounts_link_by_email layout="control" %}
|
||||
{% bootstrap_field sform.name_scheme layout="control" %}
|
||||
{% bootstrap_field sform.name_scheme_titles layout="control" %}
|
||||
</fieldset>
|
||||
|
||||
@@ -1747,9 +1747,12 @@ class CustomerDetailView(OrganizerDetailViewMixin, OrganizerPermissionRequiredMi
|
||||
context_object_name = 'orders'
|
||||
|
||||
def get_queryset(self):
|
||||
q = Q(customer=self.customer)
|
||||
if self.request.organizer.settings.customer_accounts_link_by_email:
|
||||
# This is safe because we only let customers with verified emails log in
|
||||
q |= Q(email__iexact=self.customer.email)
|
||||
qs = Order.objects.filter(
|
||||
Q(customer=self.customer)
|
||||
| Q(email__iexact=self.customer.email)
|
||||
q
|
||||
).select_related('event').order_by('-datetime')
|
||||
return qs
|
||||
|
||||
|
||||
Reference in New Issue
Block a user