forked from CGM_Public/pretix_original
Compare commits
18
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eff815056b | ||
|
|
45391b104a | ||
|
|
54d3d20d70 | ||
|
|
be1cb12286 | ||
|
|
c65b7f711d | ||
|
|
8e3d5511e2 | ||
|
|
9acfcf2526 | ||
|
|
32fd9f2f4d | ||
|
|
47ec03baac | ||
|
|
04884ce874 | ||
|
|
3337783d1f | ||
|
|
391bbc25f8 | ||
|
|
68017cc8cb | ||
|
|
5fee16035f | ||
|
|
6d32aa5220 | ||
|
|
3461c59cfe | ||
|
|
21b4dacee9 | ||
|
|
2663e9ff32 |
@@ -288,7 +288,6 @@ Example::
|
||||
[django]
|
||||
secret=j1kjps5a5&4ilpn912s7a1!e2h!duz^i3&idu@_907s$wrz@x-
|
||||
debug=off
|
||||
passwords_argon2=on
|
||||
|
||||
``secret``
|
||||
The secret to be used by Django for signing and verification purposes. If this
|
||||
@@ -304,10 +303,6 @@ Example::
|
||||
|
||||
.. WARNING:: Never set this to ``True`` in production!
|
||||
|
||||
``passwords_argon``
|
||||
Use the ``argon2`` algorithm for password hashing. Disable on systems with a small number of CPU cores (currently
|
||||
less than 8).
|
||||
|
||||
``profile``
|
||||
Enable code profiling for a random subset of requests. Disabled by default, see
|
||||
:ref:`perf-monitoring` for details.
|
||||
|
||||
@@ -231,10 +231,11 @@ The following snippet is an example on how to configure a nginx proxy for pretix
|
||||
}
|
||||
}
|
||||
server {
|
||||
listen 443 ssl default_server;
|
||||
listen [::]:443 ipv6only=on ssl default_server;
|
||||
listen 443 default_server;
|
||||
listen [::]:443 ipv6only=on default_server;
|
||||
server_name pretix.mydomain.com;
|
||||
|
||||
ssl on;
|
||||
ssl_certificate /path/to/cert.chain.pem;
|
||||
ssl_certificate_key /path/to/key.pem;
|
||||
|
||||
|
||||
@@ -216,10 +216,11 @@ The following snippet is an example on how to configure a nginx proxy for pretix
|
||||
}
|
||||
}
|
||||
server {
|
||||
listen 443 ssl default_server;
|
||||
listen [::]:443 ipv6only=on ssl default_server;
|
||||
listen 443 default_server;
|
||||
listen [::]:443 ipv6only=on default_server;
|
||||
server_name pretix.mydomain.com;
|
||||
|
||||
ssl on;
|
||||
ssl_certificate /path/to/cert.chain.pem;
|
||||
ssl_certificate_key /path/to/key.pem;
|
||||
|
||||
|
||||
+1
-1
@@ -107,7 +107,7 @@ dependencies = [
|
||||
[project.optional-dependencies]
|
||||
memcached = ["pylibmc"]
|
||||
dev = [
|
||||
"aiohttp==3.11.*",
|
||||
"aiohttp==3.10.*",
|
||||
"coverage",
|
||||
"coveralls",
|
||||
"fakeredis==2.26.*",
|
||||
|
||||
@@ -19,4 +19,4 @@
|
||||
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
|
||||
# <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
__version__ = "2024.11.0"
|
||||
__version__ = "2024.11.0.dev0"
|
||||
|
||||
@@ -54,6 +54,7 @@ from django.core.validators import (
|
||||
from django.db.models import QuerySet
|
||||
from django.forms import Select, widgets
|
||||
from django.forms.widgets import FILE_INPUT_CONTRADICTION
|
||||
from django.urls import reverse
|
||||
from django.utils.formats import date_format
|
||||
from django.utils.html import escape
|
||||
from django.utils.safestring import mark_safe
|
||||
@@ -77,7 +78,7 @@ from pretix.base.i18n import (
|
||||
get_babel_locale, get_language_without_region, language,
|
||||
)
|
||||
from pretix.base.models import InvoiceAddress, Item, Question, QuestionOption
|
||||
from pretix.base.models.tax import VAT_ID_COUNTRIES, ask_for_vat_id
|
||||
from pretix.base.models.tax import ask_for_vat_id
|
||||
from pretix.base.services.tax import (
|
||||
VATIDFinalError, VATIDTemporaryError, validate_vat_id,
|
||||
)
|
||||
@@ -602,6 +603,7 @@ class BaseQuestionsForm(forms.Form):
|
||||
questions = pos.item.questions_to_ask
|
||||
event = kwargs.pop('event')
|
||||
self.all_optional = kwargs.pop('all_optional', False)
|
||||
self.attendee_addresses_required = event.settings.attendee_addresses_required and not self.all_optional
|
||||
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
@@ -676,7 +678,7 @@ class BaseQuestionsForm(forms.Form):
|
||||
|
||||
if item.ask_attendee_data and event.settings.attendee_addresses_asked:
|
||||
add_fields['street'] = forms.CharField(
|
||||
required=event.settings.attendee_addresses_required and not self.all_optional,
|
||||
required=self.attendee_addresses_required,
|
||||
label=_('Address'),
|
||||
widget=forms.Textarea(attrs={
|
||||
'rows': 2,
|
||||
@@ -686,7 +688,7 @@ class BaseQuestionsForm(forms.Form):
|
||||
initial=(cartpos.street if cartpos else orderpos.street),
|
||||
)
|
||||
add_fields['zipcode'] = forms.CharField(
|
||||
required=event.settings.attendee_addresses_required and not self.all_optional,
|
||||
required=False,
|
||||
max_length=30,
|
||||
label=_('ZIP code'),
|
||||
initial=(cartpos.zipcode if cartpos else orderpos.zipcode),
|
||||
@@ -695,7 +697,7 @@ class BaseQuestionsForm(forms.Form):
|
||||
}),
|
||||
)
|
||||
add_fields['city'] = forms.CharField(
|
||||
required=event.settings.attendee_addresses_required and not self.all_optional,
|
||||
required=False,
|
||||
label=_('City'),
|
||||
max_length=255,
|
||||
initial=(cartpos.city if cartpos else orderpos.city),
|
||||
@@ -707,11 +709,12 @@ class BaseQuestionsForm(forms.Form):
|
||||
add_fields['country'] = CountryField(
|
||||
countries=CachedCountries
|
||||
).formfield(
|
||||
required=event.settings.attendee_addresses_required and not self.all_optional,
|
||||
required=self.attendee_addresses_required,
|
||||
label=_('Country'),
|
||||
initial=country,
|
||||
widget=forms.Select(attrs={
|
||||
'autocomplete': 'country',
|
||||
'data-country-information-url': reverse('js_helpers.states'),
|
||||
}),
|
||||
)
|
||||
c = [('', pgettext_lazy('address', 'Select state'))]
|
||||
@@ -946,9 +949,9 @@ class BaseQuestionsForm(forms.Form):
|
||||
d = super().clean()
|
||||
|
||||
if self.address_validation:
|
||||
self.cleaned_data = d = validate_address(d, True)
|
||||
self.cleaned_data = d = validate_address(d, all_optional=not self.attendee_addresses_required)
|
||||
|
||||
if d.get('city') and d.get('country') and str(d['country']) in COUNTRIES_WITH_STATE_IN_ADDRESS:
|
||||
if d.get('street') and d.get('country') and str(d['country']) in COUNTRIES_WITH_STATE_IN_ADDRESS:
|
||||
if not d.get('state'):
|
||||
self.add_error('state', _('This field is required.'))
|
||||
|
||||
@@ -1005,7 +1008,7 @@ class BaseInvoiceAddressForm(forms.ModelForm):
|
||||
'street': forms.Textarea(attrs={
|
||||
'rows': 2,
|
||||
'placeholder': _('Street and Number'),
|
||||
'autocomplete': 'street-address'
|
||||
'autocomplete': 'street-address',
|
||||
}),
|
||||
'beneficiary': forms.Textarea(attrs={'rows': 3}),
|
||||
'country': forms.Select(attrs={
|
||||
@@ -1021,7 +1024,7 @@ class BaseInvoiceAddressForm(forms.ModelForm):
|
||||
'data-display-dependency': '#id_is_business_1',
|
||||
'autocomplete': 'organization',
|
||||
}),
|
||||
'vat_id': forms.TextInput(attrs={'data-display-dependency': '#id_is_business_1', 'data-countries-with-vat-id': ','.join(VAT_ID_COUNTRIES)}),
|
||||
'vat_id': forms.TextInput(attrs={'data-display-dependency': '#id_is_business_1'}),
|
||||
'internal_reference': forms.TextInput,
|
||||
}
|
||||
labels = {
|
||||
@@ -1055,6 +1058,7 @@ class BaseInvoiceAddressForm(forms.ModelForm):
|
||||
])
|
||||
|
||||
self.fields['country'].choices = CachedCountries()
|
||||
self.fields['country'].widget.attrs['data-country-information-url'] = reverse('js_helpers.states')
|
||||
|
||||
c = [('', pgettext_lazy('address', 'Select state'))]
|
||||
fprefix = self.prefix + '-' if self.prefix else ''
|
||||
@@ -1083,6 +1087,10 @@ class BaseInvoiceAddressForm(forms.ModelForm):
|
||||
)
|
||||
self.fields['state'].widget.is_required = True
|
||||
|
||||
self.fields['street'].required = False
|
||||
self.fields['zipcode'].required = False
|
||||
self.fields['city'].required = False
|
||||
|
||||
# Without JavaScript the VAT ID field is not hidden, so we empty the field if a country outside the EU is selected.
|
||||
if cc and not ask_for_vat_id(cc) and fprefix + 'vat_id' in self.data:
|
||||
self.data = self.data.copy()
|
||||
@@ -1142,9 +1150,11 @@ class BaseInvoiceAddressForm(forms.ModelForm):
|
||||
data['vat_id'] = ''
|
||||
if self.event.settings.invoice_address_required:
|
||||
if data.get('is_business') and not data.get('company'):
|
||||
raise ValidationError(_('You need to provide a company name.'))
|
||||
raise ValidationError({"company": _('You need to provide a company name.')})
|
||||
if not data.get('is_business') and not data.get('name_parts'):
|
||||
raise ValidationError(_('You need to provide your name.'))
|
||||
if not data.get('street') and not data.get('zipcode') and not data.get('city'):
|
||||
raise ValidationError({"street": _('This field is required.')})
|
||||
|
||||
if 'vat_id' in self.changed_data or not data.get('vat_id'):
|
||||
self.instance.vat_id_validated = False
|
||||
|
||||
@@ -9,7 +9,6 @@ from decimal import Decimal
|
||||
import django.core.validators
|
||||
import django.db.models.deletion
|
||||
import i18nfield.fields
|
||||
from argon2.exceptions import HashingError
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.hashers import make_password
|
||||
from django.db import migrations, models
|
||||
@@ -26,14 +25,7 @@ def initial_user(apps, schema_editor):
|
||||
user = User(email='admin@localhost')
|
||||
user.is_staff = True
|
||||
user.is_superuser = True
|
||||
try:
|
||||
user.password = make_password('admin')
|
||||
except HashingError:
|
||||
raise Exception(
|
||||
"Could not hash password of initial user with argon2id. If this is a system with less than 8 CPU cores, "
|
||||
"you might need to disable argon2id by setting `passwords_argon2=off` in the `[django]` section of the "
|
||||
"pretix.cfg configuration file."
|
||||
)
|
||||
user.password = make_password('admin')
|
||||
user.save()
|
||||
|
||||
|
||||
|
||||
@@ -3204,9 +3204,9 @@ class InvoiceAddress(models.Model):
|
||||
company = models.CharField(max_length=255, blank=True, verbose_name=_('Company name'))
|
||||
name_cached = models.CharField(max_length=255, verbose_name=_('Full name'), blank=True)
|
||||
name_parts = models.JSONField(default=dict)
|
||||
street = models.TextField(verbose_name=_('Address'), blank=False)
|
||||
zipcode = models.CharField(max_length=30, verbose_name=_('ZIP code'), blank=False)
|
||||
city = models.CharField(max_length=255, verbose_name=_('City'), blank=False)
|
||||
street = models.TextField(verbose_name=_('Address'), blank=True)
|
||||
zipcode = models.CharField(max_length=30, verbose_name=_('ZIP code'), blank=True)
|
||||
city = models.CharField(max_length=255, verbose_name=_('City'), blank=True)
|
||||
country_old = models.CharField(max_length=255, verbose_name=_('Country'), blank=False)
|
||||
country = FastCountryField(verbose_name=_('Country'), blank=False, blank_label=_('Select country'),
|
||||
countries=CachedCountries)
|
||||
|
||||
@@ -209,24 +209,13 @@ def get_best_name(position_or_address, parts=False):
|
||||
def base_placeholders(sender, **kwargs):
|
||||
from pretix.multidomain.urlreverse import build_absolute_uri
|
||||
|
||||
def _event_sample(event):
|
||||
if event.has_subevents:
|
||||
se = event.subevents.first()
|
||||
if se:
|
||||
return se.name
|
||||
return event.name
|
||||
|
||||
ph = [
|
||||
SimpleFunctionalTextPlaceholder(
|
||||
'event', ['event'], lambda event: event.name, lambda event: event.name
|
||||
),
|
||||
SimpleFunctionalTextPlaceholder(
|
||||
'event', ['event_or_subevent'], lambda event_or_subevent: event_or_subevent.name,
|
||||
_event_sample,
|
||||
),
|
||||
SimpleFunctionalTextPlaceholder(
|
||||
'event_series_name', ['event', 'event_or_subevent'], lambda event, event_or_subevent: event.name,
|
||||
lambda event: event.name
|
||||
lambda event_or_subevent: event_or_subevent.name
|
||||
),
|
||||
SimpleFunctionalTextPlaceholder(
|
||||
'event_slug', ['event'], lambda event: event.slug, lambda event: event.slug
|
||||
|
||||
@@ -22,16 +22,30 @@
|
||||
import pycountry
|
||||
from django.http import JsonResponse
|
||||
|
||||
from pretix.base.addressvalidation import (
|
||||
COUNTRIES_WITH_STREET_ZIPCODE_AND_CITY_REQUIRED,
|
||||
)
|
||||
from pretix.base.models.tax import VAT_ID_COUNTRIES
|
||||
from pretix.base.settings import COUNTRIES_WITH_STATE_IN_ADDRESS
|
||||
|
||||
|
||||
def states(request):
|
||||
cc = request.GET.get("country", "DE")
|
||||
info = {
|
||||
'street': {'required': True},
|
||||
'zipcode': {'required': cc in COUNTRIES_WITH_STREET_ZIPCODE_AND_CITY_REQUIRED},
|
||||
'city': {'required': cc in COUNTRIES_WITH_STREET_ZIPCODE_AND_CITY_REQUIRED},
|
||||
'state': {'visible': cc in COUNTRIES_WITH_STATE_IN_ADDRESS, 'required': cc in COUNTRIES_WITH_STATE_IN_ADDRESS},
|
||||
'vat_id': {'visible': cc in VAT_ID_COUNTRIES, 'required': False},
|
||||
}
|
||||
if cc not in COUNTRIES_WITH_STATE_IN_ADDRESS:
|
||||
return JsonResponse({'data': []})
|
||||
return JsonResponse({'data': [], **info, })
|
||||
types, form = COUNTRIES_WITH_STATE_IN_ADDRESS[cc]
|
||||
statelist = [s for s in pycountry.subdivisions.get(country_code=cc) if s.type in types]
|
||||
return JsonResponse({'data': [
|
||||
{'name': s.name, 'code': s.code[3:]}
|
||||
for s in sorted(statelist, key=lambda s: s.name)
|
||||
]})
|
||||
return JsonResponse({
|
||||
'data': [
|
||||
{'name': s.name, 'code': s.code[3:]}
|
||||
for s in sorted(statelist, key=lambda s: s.name)
|
||||
],
|
||||
**info,
|
||||
})
|
||||
|
||||
@@ -136,11 +136,6 @@ class EventWizardBasicsForm(I18nModelForm):
|
||||
choices=settings.LANGUAGES,
|
||||
label=_("Default language"),
|
||||
)
|
||||
no_taxes = forms.BooleanField(
|
||||
label=_("I don't want to specify taxes now"),
|
||||
help_text=_("You can always configure tax rates later."),
|
||||
required=False,
|
||||
)
|
||||
tax_rate = forms.DecimalField(
|
||||
label=_("Sales tax rate"),
|
||||
help_text=_("Do you need to pay sales tax on your tickets? In this case, please enter the applicable tax rate "
|
||||
@@ -228,11 +223,6 @@ class EventWizardBasicsForm(I18nModelForm):
|
||||
raise ValidationError({
|
||||
'timezone': _('Your default locale must be specified.')
|
||||
})
|
||||
if not data.get("no_taxes") and not data.get("tax_rate"):
|
||||
raise ValidationError({
|
||||
'tax_rate': _('You have not specified a tax rate. If you do not want us to compute sales taxes, please '
|
||||
'check "{field}" above.').format(field=self.fields["no_taxes"].label)
|
||||
})
|
||||
|
||||
# change timezone
|
||||
zone = ZoneInfo(data.get('timezone'))
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
<script type="text/javascript" src="{% static "fileupload/jquery.fileupload.js" %}"></script>
|
||||
<script type="text/javascript" src="{% static "lightbox/js/lightbox.js" %}"></script>
|
||||
<script type="text/javascript" src="{% static "are-you-sure/jquery.are-you-sure.js" %}"></script>
|
||||
<script type="text/javascript" src="{% static "pretixbase/js/addressform.js" %}"></script>
|
||||
{% endcompress %}
|
||||
{{ html_head|safe }}
|
||||
|
||||
|
||||
@@ -41,10 +41,7 @@
|
||||
{% endif %}
|
||||
{% include "pretixcontrol/event/fragment_geodata.html" %}
|
||||
{% bootstrap_field form.currency layout="control" %}
|
||||
{% bootstrap_field form.no_taxes layout="control" %}
|
||||
<div data-display-dependency="#{{ form.no_taxes.id_for_label }}" data-inverse>
|
||||
{% bootstrap_field form.tax_rate addon_after="%" layout="control" %}
|
||||
</div>
|
||||
{% bootstrap_field form.tax_rate addon_after="%" layout="control" %}
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>{% trans "Display settings" %}</legend>
|
||||
|
||||
@@ -46,11 +46,13 @@
|
||||
<div id="cp{{ pos.id }}">
|
||||
<div class="panel-body">
|
||||
{% for form in forms %}
|
||||
{% if form.pos.item != pos.item %}
|
||||
{# Add-Ons #}
|
||||
<legend>+ {{ form.pos.item }}</legend>
|
||||
{% endif %}
|
||||
{% bootstrap_form form layout="control" %}
|
||||
<div class="profile-scope">
|
||||
{% if form.pos.item != pos.item %}
|
||||
{# Add-Ons #}
|
||||
<legend>+ {{ form.pos.item }}</legend>
|
||||
{% endif %}
|
||||
{% bootstrap_form form layout="control" %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+274
-290
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-11-19 15:34+0000\n"
|
||||
"POT-Creation-Date: 2024-11-18 15:30+0000\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -381,8 +381,8 @@ class RuleForm(FormPlaceholderMixin, I18nModelForm):
|
||||
]
|
||||
)
|
||||
|
||||
self._set_field_placeholders('subject', ['event', 'order', 'event_or_subevent'])
|
||||
self._set_field_placeholders('template', ['event', 'order', 'event_or_subevent'])
|
||||
self._set_field_placeholders('subject', ['event', 'order'])
|
||||
self._set_field_placeholders('template', ['event', 'order'])
|
||||
|
||||
choices = [(e, l) for e, l in Order.STATUS_CHOICE if e != 'n']
|
||||
choices.insert(0, ('n__valid_if_pending', _('payment pending but already confirmed')))
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
# Generated by Django 4.2.16 on 2024-11-13 13:43
|
||||
|
||||
from django.db import migrations
|
||||
from django.db.models import Q
|
||||
from i18nfield.strings import LazyI18nString
|
||||
|
||||
|
||||
def migrate_placeholders(apps, schema_editor):
|
||||
Rule = apps.get_model("sendmail", "Rule")
|
||||
for r in Rule.objects.filter(
|
||||
Q(template__contains="{event}") | Q(subject__contains="{event}"),
|
||||
event__has_subevents=True
|
||||
):
|
||||
r.template = LazyI18nString({
|
||||
k: v.replace("{event}", "{event_series_name}") for k, v in r.template.data.items()
|
||||
})
|
||||
r.subject = LazyI18nString({
|
||||
k: v.replace("{event}", "{event_series_name}") for k, v in r.subject.data.items()
|
||||
})
|
||||
r.save(update_fields=["template", "subject"])
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("sendmail", "008_remove_scheduled_mails"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
migrate_placeholders,
|
||||
migrations.RunPython.noop,
|
||||
)
|
||||
]
|
||||
@@ -174,12 +174,7 @@ class ScheduledMail(models.Model):
|
||||
ia = InvoiceAddress(order=o)
|
||||
|
||||
if send_to_orders and o.email:
|
||||
email_ctx = get_email_context(
|
||||
event=e,
|
||||
order=o,
|
||||
invoice_address=ia,
|
||||
event_or_subevent=self.subevent or e,
|
||||
)
|
||||
email_ctx = get_email_context(event=e, order=o, invoice_address=ia)
|
||||
try:
|
||||
o.send_mail(self.rule.subject, self.rule.template, email_ctx,
|
||||
attach_ical=self.rule.attach_ical,
|
||||
@@ -197,23 +192,12 @@ class ScheduledMail(models.Model):
|
||||
for p in positions:
|
||||
try:
|
||||
if p.attendee_email and (p.attendee_email != o.email or not o_sent):
|
||||
email_ctx = get_email_context(
|
||||
event=e,
|
||||
order=o,
|
||||
invoice_address=ia,
|
||||
position=p,
|
||||
event_or_subevent=self.subevent or e,
|
||||
)
|
||||
email_ctx = get_email_context(event=e, order=o, invoice_address=ia, position=p)
|
||||
p.send_mail(self.rule.subject, self.rule.template, email_ctx,
|
||||
attach_ical=self.rule.attach_ical,
|
||||
log_entry_type='pretix.plugins.sendmail.rule.order.position.email.sent')
|
||||
elif not o_sent and o.email:
|
||||
email_ctx = get_email_context(
|
||||
event=e,
|
||||
order=o,
|
||||
invoice_address=ia,
|
||||
event_or_subevent=self.subevent or e,
|
||||
)
|
||||
email_ctx = get_email_context(event=e, order=o, invoice_address=ia)
|
||||
o.send_mail(self.rule.subject, self.rule.template, email_ctx,
|
||||
attach_ical=self.rule.attach_ical,
|
||||
log_entry_type='pretix.plugins.sendmail.rule.order.email.sent')
|
||||
|
||||
@@ -492,18 +492,12 @@ class StripeSettingsHolder(BasePaymentProvider):
|
||||
# label=_('PayPal'),
|
||||
# disabled=self.event.currency not in [
|
||||
# 'EUR', 'GBP', 'USD', 'CHF', 'CZK', 'DKK', 'NOK', 'PLN', 'SEK', 'AUD', 'CAD', 'HKD', 'NZD', 'SGD'
|
||||
# ],
|
||||
# help_text=_('Some payment methods might need to be enabled in the settings of your Stripe account '
|
||||
# 'before they work properly.'),
|
||||
# required=False,
|
||||
# ]
|
||||
# )),
|
||||
('method_mobilepay',
|
||||
forms.BooleanField(
|
||||
label=_('MobilePay'),
|
||||
disabled=self.event.currency not in ['DKK', 'EUR', 'NOK', 'SEK'],
|
||||
help_text=_('Some payment methods might need to be enabled in the settings of your Stripe account '
|
||||
'before they work properly.'),
|
||||
required=False,
|
||||
)),
|
||||
] + extra_fields + list(super().settings_form_fields.items()) + moto_settings
|
||||
)
|
||||
|
||||
@@ -160,7 +160,7 @@ class BaseCheckoutFlowStep:
|
||||
kwargs['cart_namespace'] = request.resolver_match.kwargs['cart_namespace']
|
||||
return eventreverse(self.request.event, 'presale:event.index', kwargs=kwargs)
|
||||
else:
|
||||
return prev.get_step_url(request) + '?dir=prev'
|
||||
return prev.get_step_url(request)
|
||||
|
||||
def get_next_url(self, request):
|
||||
n = self.get_next_applicable(request)
|
||||
@@ -662,7 +662,7 @@ class AddOnsStep(CartMixin, AsyncAction, TemplateFlowStep):
|
||||
if 'async_id' in request.GET and settings.HAS_CELERY:
|
||||
return self.get_result(request)
|
||||
if len(self.forms) == 0 and len(self.cross_selling_data) == 0 and self.is_completed(request):
|
||||
return redirect(self.get_prev_url(request) if request.GET.get('dir') == 'prev' else self.get_next_url(request))
|
||||
return redirect(self.get_next_url(request))
|
||||
return TemplateFlowStep.get(self, request)
|
||||
|
||||
def _clean_category(self, form, category):
|
||||
@@ -1076,8 +1076,8 @@ class QuestionsStep(QuestionsViewMixin, CartMixin, TemplateFlowStep):
|
||||
if warn:
|
||||
messages.warning(request, _('Please fill in answers to all required questions.'))
|
||||
return False
|
||||
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 cp.item.ask_attendee_data and self.request.event.settings.get('attendee_addresses_required', as_type=bool) \
|
||||
and (cp.street is None and cp.city is None and cp.country is None):
|
||||
if warn:
|
||||
messages.warning(request, _('Please fill in answers to all required questions.'))
|
||||
return False
|
||||
|
||||
@@ -20,4 +20,5 @@
|
||||
<script type="text/javascript" src="{% static "pretixpresale/js/ui/cart.js" %}"></script>
|
||||
<script type="text/javascript" src="{% static "lightbox/js/lightbox.js" %}"></script>
|
||||
<script type="text/javascript" src="{% static "pretixpresale/js/ui/iframe.js" %}"></script>
|
||||
<script type="text/javascript" src="{% static "pretixbase/js/addressform.js" %}"></script>
|
||||
{% endcompress %}
|
||||
|
||||
@@ -89,7 +89,7 @@ class CheckoutView(View):
|
||||
else:
|
||||
previous_step = step
|
||||
step.c_is_before = True
|
||||
step.c_resolved_url = step.get_step_url(request) + '?dir=prev'
|
||||
step.c_resolved_url = step.get_step_url(request)
|
||||
raise Http404()
|
||||
|
||||
def redirect(self, url):
|
||||
|
||||
@@ -726,11 +726,7 @@ PASSWORD_HASHERS = [
|
||||
# the HistoricPassword model will not be changed automatically. In case a serious issue with a hasher
|
||||
# comes to light, dropping the contents of the HistoricPassword table might be the more risk-adequate
|
||||
# decision.
|
||||
*(
|
||||
["django.contrib.auth.hashers.Argon2PasswordHasher"]
|
||||
if config.getboolean('django', 'passwords_argon2', fallback=True)
|
||||
else []
|
||||
),
|
||||
"django.contrib.auth.hashers.Argon2PasswordHasher",
|
||||
"django.contrib.auth.hashers.PBKDF2PasswordHasher",
|
||||
"django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher",
|
||||
"django.contrib.auth.hashers.BCryptSHA256PasswordHasher",
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
$(function () {
|
||||
"use strict";
|
||||
|
||||
$("select[data-country-information-url]").each(function () {
|
||||
let xhr;
|
||||
const dependency = $(this),
|
||||
loader = $("<span class='fa fa-cog fa-spin'></span>").hide().prependTo(dependency.closest(".form-group").find("label")),
|
||||
url = this.getAttribute('data-country-information-url'),
|
||||
form = dependency.closest(".panel-body, form, .profile-scope"),
|
||||
isRequired = dependency.closest(".form-group").is(".required"),
|
||||
dependents = {
|
||||
'city': form.find("input[name$=city]"),
|
||||
'zipcode': form.find("input[name$=zipcode]"),
|
||||
'street': form.find("textarea[name$=street]"),
|
||||
'state': form.find("select[name$=state]"),
|
||||
'vat_id': form.find("input[name$=vat_id]"),
|
||||
},
|
||||
update = function (ev) {
|
||||
if (xhr) {
|
||||
xhr.abort();
|
||||
}
|
||||
for (var k in dependents) dependents[k].prop("disabled", true);
|
||||
loader.fadeIn();
|
||||
xhr = $.getJSON(url + '?country=' + dependency.val(), function (data) {
|
||||
var selected_value = dependents.state.prop("data-selected-value");
|
||||
if (selected_value) dependents.state.prop("data-selected-value", "");
|
||||
dependents.state.find("option:not([value=''])").remove();
|
||||
if (data.data.length > 0) {
|
||||
$.each(data.data, function (k, s) {
|
||||
var o = $("<option>").attr("value", s.code).text(s.name);
|
||||
if (selected_value == s.code) o.prop("selected", true);
|
||||
dependents.state.append(o);
|
||||
});
|
||||
}
|
||||
for(var k in dependents) {
|
||||
const options = data[k],
|
||||
dependent = dependents[k],
|
||||
visible = 'visible' in options ? options.visible : true,
|
||||
required = 'required' in options && options.required && isRequired && visible;
|
||||
|
||||
dependent.closest(".form-group").toggle(visible).toggleClass('required', required);
|
||||
dependent.prop("required", required);
|
||||
}
|
||||
for (var k in dependents) dependents[k].prop("disabled", false);
|
||||
}).always(function() {
|
||||
loader.fadeOut();
|
||||
}).fail(function(){
|
||||
// TODO: handle failed request
|
||||
});
|
||||
};
|
||||
dependents.state.prop("data-selected-value", dependents.state.val());
|
||||
update();
|
||||
dependency.on("change", update);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -122,29 +122,29 @@ $label-warning-bg-hover: var(--pretix-brand-warning-darken-10);
|
||||
$label-danger-bg: var(--pretix-brand-danger);
|
||||
$label-danger-bg-hover: var(--pretix-brand-danger-darken-10);
|
||||
|
||||
$alert-success-bg: var(--pretix-brand-success-tint-85);
|
||||
$alert-success-text: var(--pretix-brand-success-shade-42);
|
||||
$alert-success-bg: var(--pretix-brand-success-lighten-48);
|
||||
$alert-success-text: var(--pretix-brand-success-darken-10);
|
||||
$alert-success-border: var(--pretix-brand-success);
|
||||
$alert-success-hr: var(--pretix-brand-success-darken-5);
|
||||
$alert-success-link: var(--pretix-brand-success-shade-42);
|
||||
$alert-success-link: var(--pretix-brand-success-darken-20);
|
||||
|
||||
$alert-info-bg: var(--pretix-brand-info-tint-85);
|
||||
$alert-info-text: var(--pretix-brand-info-shade-42);
|
||||
$alert-info-bg: var(--pretix-brand-info-lighten-33);
|
||||
$alert-info-text: var(--pretix-brand-info-darken-20);
|
||||
$alert-info-border: var(--pretix-brand-info);
|
||||
$alert-info-hr: var(--pretix-brand-info-darken-5);
|
||||
$alert-info-link: var(--pretix-brand-info-shade-42);
|
||||
$alert-info-link: var(--pretix-brand-info-darken-30);
|
||||
|
||||
$alert-warning-bg: var(--pretix-brand-warning-tint-85);
|
||||
$alert-warning-text: var(--pretix-brand-warning-shade-42);
|
||||
$alert-warning-bg: var(--pretix-brand-warning-lighten-41);
|
||||
$alert-warning-text: var(--pretix-brand-warning-darken-25);
|
||||
$alert-warning-border: var(--pretix-brand-warning);
|
||||
$alert-warning-hr: var(--pretix-brand-warning-darken-5);
|
||||
$alert-warning-link: var(--pretix-brand-warning-shade-42);
|
||||
$alert-warning-link: var(--pretix-brand-warning-darken-35);
|
||||
|
||||
$alert-danger-bg: var(--pretix-brand-danger-tint-85);
|
||||
$alert-danger-text: var(--pretix-brand-danger-shade-42);
|
||||
$alert-danger-bg: var(--pretix-brand-danger-lighten-43);
|
||||
$alert-danger-text: var(--pretix-brand-danger-darken-5);
|
||||
$alert-danger-border: var(--pretix-brand-danger);
|
||||
$alert-danger-hr: var(--pretix-brand-danger-darken-5);
|
||||
$alert-danger-link: var(--pretix-brand-danger-shade-42);
|
||||
$alert-danger-link: var(--pretix-brand-danger-darken-15);
|
||||
|
||||
$main-box-bg: #FFFFFF;
|
||||
|
||||
@@ -156,4 +156,4 @@ $slider-secondary-bottom: var(--pretix-brand-primary-lighten-23-saturate-2);
|
||||
/* The following vars default to $body-bg in bootstrap, which we don't want */
|
||||
$nav-tabs-active-link-hover-bg: #FFFFFF;
|
||||
$nav-tabs-justified-active-link-border-color: #FFFFFF;
|
||||
$thumbnail-bg: #FFFFFF;
|
||||
$thumbnail-bg: #FFFFFF;
|
||||
@@ -73,9 +73,7 @@ $in-border-radius-small: 2px !default;
|
||||
--pretix-brand-success-darken-20: #{darken($in-brand-success, 20%)};
|
||||
--pretix-brand-success-darken-30: #{darken($in-brand-success, 30%)};
|
||||
--pretix-brand-success-tint-50: #{tint($in-brand-success, 50%)};
|
||||
--pretix-brand-success-tint-85: #{tint($in-brand-success, 85%)};
|
||||
--pretix-brand-success-shade-25: #{shade($in-brand-success, 25%)};
|
||||
--pretix-brand-success-shade-42: #{shade($in-brand-success, 42%)};
|
||||
|
||||
--pretix-brand-info-lighten-23: #{lighten($in-brand-info, 23%)};
|
||||
--pretix-brand-info-lighten-25: #{lighten($in-brand-info, 25%)};
|
||||
@@ -86,9 +84,7 @@ $in-border-radius-small: 2px !default;
|
||||
--pretix-brand-info-darken-17: #{darken($in-brand-info, 17%)};
|
||||
--pretix-brand-info-darken-20: #{darken($in-brand-info, 20%)};
|
||||
--pretix-brand-info-darken-30: #{darken($in-brand-info, 30%)};
|
||||
--pretix-brand-info-tint-85: #{tint($in-brand-info, 85%)};
|
||||
--pretix-brand-info-shade-25: #{shade($in-brand-info, 25%)};
|
||||
--pretix-brand-info-shade-42: #{shade($in-brand-info, 42%)};
|
||||
|
||||
--pretix-brand-warning-lighten-12: #{lighten($in-brand-warning, 12%)};
|
||||
--pretix-brand-warning-lighten-31: #{lighten($in-brand-warning, 31%)};
|
||||
@@ -105,9 +101,7 @@ $in-border-radius-small: 2px !default;
|
||||
--pretix-brand-warning-darken-30: #{darken($in-brand-warning, 30%)};
|
||||
--pretix-brand-warning-darken-35: #{darken($in-brand-warning, 35%)};
|
||||
--pretix-brand-warning-tint-50: #{tint($in-brand-warning, 50%)};
|
||||
--pretix-brand-warning-tint-85: #{tint($in-brand-warning, 85%)};
|
||||
--pretix-brand-warning-shade-25: #{shade($in-brand-warning, 25%)};
|
||||
--pretix-brand-warning-shade-42: #{shade($in-brand-warning, 42%)};
|
||||
--pretix-brand-warning-transparent-60: #{transparentize($in-brand-warning, 0.6)};
|
||||
|
||||
--pretix-brand-danger-lighten-5: #{lighten($in-brand-danger, 5%)};
|
||||
@@ -124,9 +118,7 @@ $in-border-radius-small: 2px !default;
|
||||
--pretix-brand-danger-darken-20: #{darken($in-brand-danger, 20%)};
|
||||
--pretix-brand-danger-darken-30: #{darken($in-brand-danger, 30%)};
|
||||
--pretix-brand-danger-tint-50: #{tint($in-brand-danger, 50%)};
|
||||
--pretix-brand-danger-tint-85: #{tint($in-brand-danger, 85%)};
|
||||
--pretix-brand-danger-shade-25: #{shade($in-brand-danger, 25%)};
|
||||
--pretix-brand-danger-shade-42: #{shade($in-brand-danger, 42%)};
|
||||
|
||||
--pretix-border-radius-base: #{$in-border-radius-base};
|
||||
--pretix-border-radius-large: #{$in-border-radius-large};
|
||||
@@ -148,4 +140,4 @@ $in-border-radius-small: 2px !default;
|
||||
--pretix-body-bg-white-0: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -434,60 +434,6 @@ var form_handlers = function (el) {
|
||||
dependency.closest('.form-group').find('input[name=' + dependency.attr("name") + ']').on("dp.change", update);
|
||||
});
|
||||
|
||||
$("input[name$=vat_id][data-countries-with-vat-id]").each(function () {
|
||||
var dependent = $(this),
|
||||
dependency_country = $(this).closest(".panel-body, form").find('select[name$=country]'),
|
||||
dependency_id_is_business_1 = $(this).closest(".panel-body, form").find('input[id$=id_is_business_1]'),
|
||||
update = function (ev) {
|
||||
if (dependency_id_is_business_1.length && !dependency_id_is_business_1.prop("checked")) {
|
||||
dependent.closest(".form-group").hide();
|
||||
} else if (dependent.attr('data-countries-with-vat-id').split(',').includes(dependency_country.val())) {
|
||||
dependent.closest(".form-group").show();
|
||||
} else {
|
||||
dependent.closest(".form-group").hide();
|
||||
}
|
||||
};
|
||||
update();
|
||||
dependency_country.on("change", update);
|
||||
dependency_id_is_business_1.on("change", update);
|
||||
});
|
||||
|
||||
$("select[name$=state]:not([data-static])").each(function () {
|
||||
var dependent = $(this),
|
||||
counter = 0,
|
||||
dependency = $(this).closest(".panel-body, form").find('select[name$=country]'),
|
||||
update = function (ev) {
|
||||
counter++;
|
||||
var curCounter = counter;
|
||||
dependent.prop("disabled", true);
|
||||
dependency.closest(".form-group").find("label").prepend("<span class='fa fa-cog fa-spin'></span> ");
|
||||
$.getJSON('/js_helpers/states/?country=' + dependency.val(), function (data) {
|
||||
if (counter > curCounter) {
|
||||
return; // Lost race
|
||||
}
|
||||
dependent.find("option").filter(function (t) {return !!$(this).attr("value")}).remove();
|
||||
if (data.data.length > 0) {
|
||||
$.each(data.data, function (k, s) {
|
||||
dependent.append($("<option>").attr("value", s.code).text(s.name));
|
||||
});
|
||||
dependent.closest(".form-group").show();
|
||||
dependent.prop('required', dependency.prop("required"));
|
||||
} else {
|
||||
dependent.closest(".form-group").hide();
|
||||
dependent.prop("required", false);
|
||||
}
|
||||
dependent.prop("disabled", false);
|
||||
dependency.closest(".form-group").find("label .fa-spin").remove();
|
||||
});
|
||||
};
|
||||
if (dependent.find("option").length === 1) {
|
||||
dependent.closest(".form-group").hide();
|
||||
} else {
|
||||
dependent.prop('required', dependency.prop("required"));
|
||||
}
|
||||
dependency.on("change", update);
|
||||
});
|
||||
|
||||
el.find("div.scrolling-choice:not(.no-search)").each(function () {
|
||||
if ($(this).find("input[type=text]").length > 0) {
|
||||
return;
|
||||
|
||||
@@ -517,65 +517,6 @@ $(function () {
|
||||
dependency.closest('.form-group, form').find('input[name=' + dependency.attr("name") + ']').on("dp.change", update);
|
||||
});
|
||||
|
||||
$("input[name$=vat_id][data-countries-with-vat-id]").each(function () {
|
||||
var dependent = $(this),
|
||||
dependency_country = $(this).closest(".panel-body, form").find('select[name$=country]'),
|
||||
dependency_id_is_business_1 = $(this).closest(".panel-body, form").find('input[id$=id_is_business_1]'),
|
||||
update = function (ev) {
|
||||
if (dependency_id_is_business_1.length && !dependency_id_is_business_1.prop("checked")) {
|
||||
dependent.closest(".form-group").hide();
|
||||
} else if (dependent.attr('data-countries-with-vat-id').split(',').includes(dependency_country.val())) {
|
||||
dependent.closest(".form-group").show();
|
||||
} else {
|
||||
dependent.closest(".form-group").hide();
|
||||
}
|
||||
};
|
||||
update();
|
||||
dependency_country.on("change", update);
|
||||
dependency_id_is_business_1.on("change", update);
|
||||
});
|
||||
|
||||
$("select[name$=state]").each(function () {
|
||||
var dependent = $(this),
|
||||
counter = 0,
|
||||
dependency = $(this).closest(".panel-body, form").find('select[name$=country]'),
|
||||
update = function (ev) {
|
||||
counter++;
|
||||
var curCounter = counter;
|
||||
dependent.prop("disabled", true);
|
||||
dependency.closest(".form-group").find("label").prepend("<span class='fa fa-cog fa-spin'></span> ");
|
||||
$.getJSON('/js_helpers/states/?country=' + dependency.val(), function (data) {
|
||||
if (counter > curCounter) {
|
||||
return; // Lost race
|
||||
}
|
||||
var selected_value = dependent.prop("data-selected-value");
|
||||
dependent.find("option").filter(function (t) {return !!$(this).attr("value")}).remove();
|
||||
if (data.data.length > 0) {
|
||||
$.each(data.data, function (k, s) {
|
||||
var o = $("<option>").attr("value", s.code).text(s.name);
|
||||
if (s.code == selected_value || (selected_value && selected_value.indexOf && selected_value.indexOf(s.code) > -1)) {
|
||||
o.prop("selected", true);
|
||||
}
|
||||
dependent.append(o);
|
||||
});
|
||||
dependent.closest(".form-group").show();
|
||||
dependent.prop('required', dependency.prop("required"));
|
||||
} else {
|
||||
dependent.closest(".form-group").hide();
|
||||
dependent.prop("required", false);
|
||||
}
|
||||
dependent.prop("disabled", false);
|
||||
dependency.closest(".form-group").find("label .fa-spin").remove();
|
||||
});
|
||||
};
|
||||
if (dependent.find("option").length === 1) {
|
||||
dependent.closest(".form-group").hide();
|
||||
} else {
|
||||
dependent.prop('required', dependency.prop("required"));
|
||||
}
|
||||
dependency.on("change", update);
|
||||
});
|
||||
|
||||
form_handlers($("body"));
|
||||
|
||||
var local_tz = moment.tz.guess()
|
||||
|
||||
@@ -763,7 +763,6 @@ class EventsTest(SoupTest):
|
||||
'basics-location_1': 'Hamburg',
|
||||
'basics-currency': 'EUR',
|
||||
'basics-tax_rate': '',
|
||||
'basics-no_taxes': 'on',
|
||||
'basics-locale': 'en',
|
||||
'basics-timezone': 'Europe/Berlin',
|
||||
'basics-presale_start': '2016-11-01 10:00:00',
|
||||
@@ -793,7 +792,6 @@ class EventsTest(SoupTest):
|
||||
'basics-location_1': 'Hamburg',
|
||||
'basics-currency': 'EUR',
|
||||
'basics-tax_rate': '',
|
||||
'basics-no_taxes': 'on',
|
||||
'basics-locale': 'en',
|
||||
'basics-timezone': 'Europe/Berlin',
|
||||
'basics-presale_start_0': '2016-11-01',
|
||||
@@ -890,7 +888,6 @@ class EventsTest(SoupTest):
|
||||
'basics-location_1': 'Hamburg',
|
||||
'basics-currency': 'EUR',
|
||||
'basics-tax_rate': '',
|
||||
'basics-no_taxes': 'on',
|
||||
'basics-locale': 'en',
|
||||
'basics-timezone': 'Europe/Berlin',
|
||||
'basics-presale_start_0': '2016-11-01',
|
||||
@@ -1076,7 +1073,6 @@ class EventsTest(SoupTest):
|
||||
'basics-location_0': 'Hamburg',
|
||||
'basics-currency': 'EUR',
|
||||
'basics-tax_rate': '',
|
||||
'basics-no_taxes': 'on',
|
||||
'basics-locale': 'en',
|
||||
'basics-timezone': 'UTC',
|
||||
'basics-presale_start_0': '',
|
||||
@@ -1125,7 +1121,6 @@ class EventsTest(SoupTest):
|
||||
'basics-location_0': 'Hamburg',
|
||||
'basics-currency': 'EUR',
|
||||
'basics-tax_rate': '',
|
||||
'basics-no_taxes': 'on',
|
||||
'basics-locale': 'en',
|
||||
'basics-timezone': 'UTC',
|
||||
'basics-presale_start_0': '',
|
||||
@@ -1176,7 +1171,6 @@ class EventsTest(SoupTest):
|
||||
'basics-location_0': 'Hamburg',
|
||||
'basics-currency': 'EUR',
|
||||
'basics-tax_rate': '',
|
||||
'basics-no_taxes': 'on',
|
||||
'basics-locale': 'en',
|
||||
'basics-timezone': 'Europe/Berlin',
|
||||
'basics-presale_start_0': '2016-11-01',
|
||||
@@ -1206,7 +1200,6 @@ class EventsTest(SoupTest):
|
||||
'basics-location_0': 'Hamburg',
|
||||
'basics-currency': '$',
|
||||
'basics-tax_rate': '',
|
||||
'basics-no_taxes': 'on',
|
||||
'basics-locale': 'en',
|
||||
'basics-timezone': 'Europe/Berlin',
|
||||
'basics-presale_start_0': '2016-11-01',
|
||||
@@ -1236,7 +1229,6 @@ class EventsTest(SoupTest):
|
||||
'basics-location_0': 'Hamburg',
|
||||
'basics-currency': 'ASD',
|
||||
'basics-tax_rate': '',
|
||||
'basics-no_taxes': 'on',
|
||||
'basics-locale': 'en',
|
||||
'basics-timezone': 'Europe/Berlin',
|
||||
'basics-presale_start_0': '2016-11-01',
|
||||
|
||||
@@ -1207,6 +1207,65 @@ class CheckoutTestCase(BaseCheckoutTestCase, TimemachineTestMixin, TestCase):
|
||||
}
|
||||
assert ia.name_cached == 'Mr John Kennedy'
|
||||
|
||||
def test_invoice_address_required_no_zipcode_country(self):
|
||||
self.event.settings.invoice_address_asked = True
|
||||
self.event.settings.invoice_address_required = True
|
||||
self.event.settings.invoice_address_not_asked_free = True
|
||||
self.event.settings.set('name_scheme', 'title_given_middle_family')
|
||||
|
||||
with scopes_disabled():
|
||||
CartPosition.objects.create(
|
||||
event=self.event, cart_id=self.session_key, item=self.ticket,
|
||||
price=23, expires=now() + timedelta(minutes=10)
|
||||
)
|
||||
response = self.client.get('/%s/%s/checkout/questions/' % (self.orga.slug, self.event.slug), follow=True)
|
||||
doc = BeautifulSoup(response.content.decode(), "lxml")
|
||||
self.assertEqual(len(doc.select('input[name="city"]')), 1)
|
||||
|
||||
# Not all required fields filled out, expect failure
|
||||
response = self.client.post('/%s/%s/checkout/questions/' % (self.orga.slug, self.event.slug), {
|
||||
'is_business': 'business',
|
||||
'company': 'Foo',
|
||||
'name_parts_0': 'Mr',
|
||||
'name_parts_1': 'John',
|
||||
'name_parts_2': '',
|
||||
'name_parts_3': 'Kennedy',
|
||||
'street': '',
|
||||
'zipcode': '',
|
||||
'city': '',
|
||||
'country': 'BI',
|
||||
'email': 'admin@localhost'
|
||||
}, follow=True)
|
||||
doc = BeautifulSoup(response.content.decode(), "lxml")
|
||||
self.assertGreaterEqual(len(doc.select('.has-error')), 1)
|
||||
|
||||
# Correct request for a country where zip code is not required in address
|
||||
response = self.client.post('/%s/%s/checkout/questions/' % (self.orga.slug, self.event.slug), {
|
||||
'is_business': 'business',
|
||||
'company': 'Foo',
|
||||
'name_parts_0': 'Mr',
|
||||
'name_parts_1': 'John',
|
||||
'name_parts_2': '',
|
||||
'name_parts_3': 'Kennedy',
|
||||
'street': 'BP 12345',
|
||||
'zipcode': '',
|
||||
'city': 'Bujumbura',
|
||||
'country': 'BI',
|
||||
'email': 'admin@localhost'
|
||||
}, follow=True)
|
||||
self.assertRedirects(response, '/%s/%s/checkout/payment/' % (self.orga.slug, self.event.slug),
|
||||
target_status_code=200)
|
||||
with scopes_disabled():
|
||||
ia = InvoiceAddress.objects.last()
|
||||
assert ia.name_parts == {
|
||||
'title': 'Mr',
|
||||
'given_name': 'John',
|
||||
'middle_name': '',
|
||||
'family_name': 'Kennedy',
|
||||
"_scheme": "title_given_middle_family"
|
||||
}
|
||||
assert ia.name_cached == 'Mr John Kennedy'
|
||||
|
||||
def test_invoice_address_validated(self):
|
||||
self.event.settings.invoice_address_asked = True
|
||||
self.event.settings.invoice_address_required = True
|
||||
|
||||
Reference in New Issue
Block a user