From a2acd336ebc0d5d89ba99e78ee1b70d769c88b38 Mon Sep 17 00:00:00 2001 From: Flavia Bastos Date: Tue, 16 Oct 2018 20:50:00 -0300 Subject: [PATCH] Fix #970 -- invoice info consistency (#1043) resolves: Issue #970 --- src/pretix/base/forms/questions.py | 2 ++ .../templates/pretixpresale/event/checkout_confirm.html | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pretix/base/forms/questions.py b/src/pretix/base/forms/questions.py index de4614dd3..6223afaed 100644 --- a/src/pretix/base/forms/questions.py +++ b/src/pretix/base/forms/questions.py @@ -216,6 +216,8 @@ class BaseInvoiceAddressForm(forms.ModelForm): def clean(self): data = self.cleaned_data + if not data.get('is_business'): + data['company'] = '' if not data.get('name') and not data.get('company') and self.event.settings.invoice_address_required: raise ValidationError(_('You need to provide either a company name or your name.')) diff --git a/src/pretix/presale/templates/pretixpresale/event/checkout_confirm.html b/src/pretix/presale/templates/pretixpresale/event/checkout_confirm.html index c2e44dfb6..b4b3b5f3f 100644 --- a/src/pretix/presale/templates/pretixpresale/event/checkout_confirm.html +++ b/src/pretix/presale/templates/pretixpresale/event/checkout_confirm.html @@ -87,8 +87,10 @@
-
{% trans "Company" %}
-
{{ addr.company }}
+ {% if addr.company %} +
{% trans "Company" %}
+
{{ addr.company }}
+ {% endif %}
{% trans "Name" %}
{{ addr.name }}
{% trans "Address" %}