mirror of
https://github.com/pretix/pretix.git
synced 2026-11-20 02:56:03 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ecaeb45241 | ||
|
|
8a2d732925 |
No files matched your search
@@ -123,7 +123,7 @@ jobs:
|
||||
working-directory: ./src
|
||||
run: make all compress
|
||||
- name: Install Playwright browsers
|
||||
run: playwright install chromium --with-deps
|
||||
run: playwright install --with-deps
|
||||
- name: Run E2E tests
|
||||
working-directory: ./src
|
||||
run: PRETIX_CONFIG_FILE=tests/ci_postgres.cfg py.test tests/e2e/ -v --maxfail=10 --tracing=retain-on-failure
|
||||
|
||||
@@ -57,7 +57,6 @@ seating_plan integer If reserved sea
|
||||
seat_category_mapping object An object mapping categories of the seating plan
|
||||
(strings) to items in the event (integers or ``null``).
|
||||
last_modified datetime Last modification of this object
|
||||
comment string Internal comment for this subevent (or ``null``)
|
||||
===================================== ========================== =======================================================
|
||||
|
||||
.. versionchanged:: 2023.8.0
|
||||
@@ -118,10 +117,7 @@ Endpoints
|
||||
}
|
||||
],
|
||||
"variation_price_overrides": [],
|
||||
"meta_data": {},
|
||||
"frontpage_text": {},
|
||||
"last_modified": "2017-12-01T10:00:30Z",
|
||||
"comment": "internal comment"
|
||||
"meta_data": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -191,9 +187,7 @@ Endpoints
|
||||
}
|
||||
],
|
||||
"variation_price_overrides": [],
|
||||
"meta_data": {},
|
||||
"last_modified": "2017-12-01T10:00:30Z",
|
||||
"comment": ""
|
||||
"meta_data": {}
|
||||
}
|
||||
|
||||
|
||||
@@ -230,9 +224,7 @@ Endpoints
|
||||
}
|
||||
],
|
||||
"variation_price_overrides": [],
|
||||
"meta_data": {},
|
||||
"last_modified": "2017-12-01T10:00:30Z",
|
||||
"comment": ""
|
||||
"meta_data": {}
|
||||
}
|
||||
|
||||
|
||||
@@ -290,9 +282,7 @@ Endpoints
|
||||
}
|
||||
],
|
||||
"variation_price_overrides": [],
|
||||
"meta_data": {},
|
||||
"last_modified": "2017-12-01T10:00:30Z",
|
||||
"comment": ""
|
||||
"meta_data": {}
|
||||
}
|
||||
|
||||
:param organizer: The ``slug`` field of a valid organizer
|
||||
@@ -453,9 +443,7 @@ Endpoints
|
||||
}
|
||||
],
|
||||
"variation_price_overrides": [],
|
||||
"meta_data": {},
|
||||
"last_modified": "2017-12-01T10:00:30Z",
|
||||
"comment": ""
|
||||
"meta_data": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
sphinx==9.0.*
|
||||
sphinx-rtd-theme~=3.1.0
|
||||
sphinxcontrib-httpdomain~=2.2.1
|
||||
sphinxcontrib-httpdomain~=2.1.0
|
||||
sphinxcontrib-images~=1.0.1
|
||||
sphinxcontrib-jquery~=4.1
|
||||
sphinxcontrib-spelling~=8.0.2
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
-e ../
|
||||
sphinx==9.0.*
|
||||
sphinx-rtd-theme~=3.1.0
|
||||
sphinxcontrib-httpdomain~=2.2.1
|
||||
sphinxcontrib-httpdomain~=2.1.0
|
||||
sphinxcontrib-images~=1.0.1
|
||||
sphinxcontrib-jquery~=4.1
|
||||
sphinxcontrib-spelling~=8.0.2
|
||||
|
||||
+4
-5
@@ -34,7 +34,7 @@ dependencies = [
|
||||
"celery==5.6.*",
|
||||
"chardet==5.2.*",
|
||||
"cryptography>=50.0.2",
|
||||
"css-inline==0.24.*",
|
||||
"css-inline==0.23.*",
|
||||
"defusedcsv>=3.0.0",
|
||||
"dnspython==2.9.*",
|
||||
"Django[argon2]==5.2.*,>=5.2.17",
|
||||
@@ -62,7 +62,7 @@ dependencies = [
|
||||
"geoip2==5.*",
|
||||
"isoweek",
|
||||
"jsonschema",
|
||||
"kombu==5.7.*",
|
||||
"kombu==5.6.*",
|
||||
"libsass==0.23.*",
|
||||
"lxml",
|
||||
"markdown==3.11.2",
|
||||
@@ -81,7 +81,7 @@ dependencies = [
|
||||
"pycountry",
|
||||
"pycparser==3.12",
|
||||
"pycryptodome==3.24.*",
|
||||
"pypdf==6.21.*",
|
||||
"pypdf==6.20.*",
|
||||
"python-bidi==0.6.*", # Support for Arabic in reportlab
|
||||
"python-dateutil==4.0.*",
|
||||
"pytz",
|
||||
@@ -123,8 +123,7 @@ dev = [
|
||||
"pytest-sugar",
|
||||
"pytest-xdist==3.8.*",
|
||||
"pytest-playwright",
|
||||
"pytest-base-url",
|
||||
"pytest==9.2.*",
|
||||
"pytest==9.1.*",
|
||||
"playwright",
|
||||
"responses",
|
||||
"pypdfium2"
|
||||
|
||||
@@ -33,7 +33,7 @@ from rest_framework import status
|
||||
|
||||
from pretix.api.models import ApiCall
|
||||
from pretix.base.models import Organizer
|
||||
from pretix.helpers.database import LOCK_SELF_NO_KEY
|
||||
from pretix.helpers import OF_SELF
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -60,7 +60,7 @@ class IdempotencyMiddleware:
|
||||
idempotency_key = request.headers.get('X-Idempotency-Key', '')
|
||||
|
||||
with transaction.atomic(durable=True):
|
||||
call, created = ApiCall.objects.select_for_update(**LOCK_SELF_NO_KEY).get_or_create(
|
||||
call, created = ApiCall.objects.select_for_update(of=OF_SELF).get_or_create(
|
||||
auth_hash=auth_hash,
|
||||
idempotency_key=idempotency_key,
|
||||
defaults={
|
||||
|
||||
@@ -156,8 +156,6 @@ class ExportFormDataField(serializers.Field):
|
||||
return JobRunSerializer(exporter=exporter).to_internal_value(data["export_form_data"])
|
||||
else:
|
||||
return data['export_form_data']
|
||||
else: # partial PATCH without export_form_data keeps it unchanged
|
||||
return self.parent.instance.export_form_data
|
||||
|
||||
|
||||
class ScheduledExportSerializer(serializers.ModelSerializer):
|
||||
@@ -190,12 +188,6 @@ class ScheduledExportSerializer(serializers.ModelSerializer):
|
||||
raise ValidationError('Please enter less than 25 recipients.')
|
||||
return d
|
||||
|
||||
def validate(self, attrs):
|
||||
attrs = super().validate(attrs)
|
||||
if self.instance and self.instance.pk and 'export_identifier' in attrs and self.instance.export_identifier != attrs['export_identifier']:
|
||||
raise ValidationError({"export_identifier": "export_identifier cannot be changed for existing exports."})
|
||||
return attrs
|
||||
|
||||
|
||||
class ScheduledEventExportSerializer(ScheduledExportSerializer):
|
||||
|
||||
|
||||
@@ -378,7 +378,6 @@ class ItemSerializer(SalesChannelMigrationMixin, I18nAwareModelSerializer):
|
||||
def validate_bundles(self, value):
|
||||
if not self.instance:
|
||||
for b_data in value:
|
||||
ItemBundle.clean_count(b_data.get('count', 1))
|
||||
ItemBundle.clean_itemvar(self.context['event'], b_data.get('bundled_item'), b_data.get('bundled_variation'))
|
||||
return value
|
||||
|
||||
@@ -387,8 +386,8 @@ class ItemSerializer(SalesChannelMigrationMixin, I18nAwareModelSerializer):
|
||||
for addon_data in value:
|
||||
ItemAddOn.clean_categories(self.context['event'], None, self.instance, addon_data['addon_category'])
|
||||
ItemAddOn.clean_min_count(addon_data.get('min_count', 0))
|
||||
ItemAddOn.clean_max_count(addon_data.get('max_count', 1))
|
||||
ItemAddOn.clean_max_min_count(addon_data.get('max_count', 1), addon_data.get('min_count', 0))
|
||||
ItemAddOn.clean_max_count(addon_data.get('max_count', 0))
|
||||
ItemAddOn.clean_max_min_count(addon_data.get('max_count', 0), addon_data.get('min_count', 0))
|
||||
return value
|
||||
|
||||
def validate_program_times(self, value):
|
||||
|
||||
@@ -197,8 +197,6 @@ class ReusableMediaSerializer(I18nAwareModelSerializer):
|
||||
'linked_giftcard',
|
||||
'info',
|
||||
'notes',
|
||||
# When adding fields, check if they should be hidden in ReusableMediaViewSet
|
||||
# for cross-organizer lookups
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ from pretix.base.services.checkin import (
|
||||
)
|
||||
from pretix.base.services.media import perform_media_exchange
|
||||
from pretix.base.signals import checkin_annulled
|
||||
from pretix.helpers import LOCK_SELF_NO_KEY
|
||||
from pretix.helpers import OF_SELF
|
||||
|
||||
with scopes_disabled():
|
||||
class CheckinListFilter(FilterSet):
|
||||
@@ -1184,14 +1184,14 @@ class CheckinRPCAnnulView(views.APIView):
|
||||
if isinstance(request.auth, Device):
|
||||
qs = qs.filter(device=request.auth)
|
||||
ci = qs.select_for_update(
|
||||
**LOCK_SELF_NO_KEY,
|
||||
of=OF_SELF,
|
||||
).select_related("position", "position__order", "position__order__event").get(
|
||||
list__in=s.validated_data['lists'],
|
||||
nonce=s.validated_data['nonce'],
|
||||
)
|
||||
if connection.features.has_select_for_update_of and ci.position_id:
|
||||
# Lock position as well, can't do it with of= above because relation is nullable
|
||||
OrderPosition.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=ci.position_id)
|
||||
OrderPosition.objects.select_for_update(of=OF_SELF).get(pk=ci.position_id)
|
||||
|
||||
if not ci.successful or not ci.position:
|
||||
raise ValidationError("Cannot annul an unsuccessful checkin")
|
||||
|
||||
@@ -272,8 +272,6 @@ class ScheduledEventExportViewSet(ScheduledExportersViewSet):
|
||||
perm_holder = self.request.auth if isinstance(self.request.auth, (TeamAPIToken, Device)) else self.request.user
|
||||
if not perm_holder.has_event_permission(self.request.organizer, self.request.event, exporter.get_required_event_permission()):
|
||||
raise PermissionDenied("No permission to edit exports you could not run.")
|
||||
# An additional check for the new config, such as on organizer level, is not necessary. Since the event is
|
||||
# fixed and the export_identifier is read-only, the update cannot include a meaningful change of permissions.
|
||||
|
||||
serializer.save(event=self.request.event)
|
||||
serializer.instance.compute_next_run()
|
||||
@@ -346,40 +344,6 @@ class ScheduledOrganizerExportViewSet(ScheduledExportersViewSet):
|
||||
))
|
||||
return {e.identifier: e for e in exporters}
|
||||
|
||||
def _check_permission_for_export(self, identifier, form_data):
|
||||
perm_holder = (
|
||||
self.request.auth if isinstance(self.request.auth, (Device, TeamAPIToken)) else self.request.user
|
||||
)
|
||||
exporter = self.exporters.get(identifier)
|
||||
if not exporter:
|
||||
raise PermissionDenied("No access to exporter.")
|
||||
if isinstance(exporter, OrganizerLevelExportMixin):
|
||||
if not perm_holder.has_organizer_permission(
|
||||
self.request.organizer, exporter.get_required_organizer_permission(), request=self.request,
|
||||
):
|
||||
raise PermissionDenied("No permission to edit exports you could not run.")
|
||||
else:
|
||||
if form_data.get("all_events", False):
|
||||
if isinstance(self.request.auth, Device):
|
||||
if not self.request.auth.all_events:
|
||||
raise PermissionDenied("No permission to edit exports you could not run.")
|
||||
elif isinstance(self.request.auth, TeamAPIToken):
|
||||
if not self.request.auth.team.all_events:
|
||||
raise PermissionDenied("No permission to edit exports you could not run.")
|
||||
elif self.request.user.is_authenticated:
|
||||
if not self.request.user.teams.filter(
|
||||
TeamQuerySet.event_permission_q(exporter.get_required_event_permission()),
|
||||
all_events=True,
|
||||
).exists():
|
||||
raise PermissionDenied("No permission to edit exports you could not run.")
|
||||
else:
|
||||
events_selected = form_data.get("events", [])
|
||||
events_permission = set(perm_holder.get_events_with_permission(
|
||||
exporter.get_required_event_permission(), request=self.request
|
||||
).values_list("pk", flat=True))
|
||||
if not all(e in events_permission for e in events_selected):
|
||||
raise PermissionDenied("No permission to edit exports you could not run.")
|
||||
|
||||
@transaction.atomic()
|
||||
def perform_update(self, serializer):
|
||||
if not self.request.user.is_authenticated or self.request.user != serializer.instance.owner:
|
||||
@@ -387,12 +351,37 @@ class ScheduledOrganizerExportViewSet(ScheduledExportersViewSet):
|
||||
# user B has settings permission (= they can see the export configuration), but not enough permission
|
||||
# to run the export themselves. Without this check, user B could modify the export and add themselves
|
||||
# as a recipient. Thereby, user B would gain access to data they can't have.
|
||||
self._check_permission_for_export(serializer.instance.export_identifier, serializer.instance.export_form_data)
|
||||
# After we checked that the API user can work with the original export, we also need to check that they can
|
||||
# work with the changed export, otherwise they could change e.g. from "some events" to "all events" and add
|
||||
# themselves as a recipient.
|
||||
if serializer.validated_data.get('export_form_data') is not None:
|
||||
self._check_permission_for_export(serializer.instance.export_identifier, serializer.validated_data['export_form_data'])
|
||||
exporter = self.exporters.get(serializer.instance.export_identifier)
|
||||
if not exporter:
|
||||
raise PermissionDenied("No access to exporter.")
|
||||
perm_holder = (self.request.auth if isinstance(self.request.auth, (Device, TeamAPIToken))
|
||||
else self.request.user)
|
||||
if isinstance(exporter, OrganizerLevelExportMixin):
|
||||
if not perm_holder.has_organizer_permission(
|
||||
self.request.organizer, exporter.get_required_organizer_permission(), request=self.request,
|
||||
):
|
||||
raise PermissionDenied("No permission to edit exports you could not run.")
|
||||
else:
|
||||
if serializer.instance.export_form_data.get("all_events", False):
|
||||
if isinstance(self.request.auth, Device):
|
||||
if not self.request.auth.all_events:
|
||||
raise PermissionDenied("No permission to edit exports you could not run.")
|
||||
elif isinstance(self.request.auth, TeamAPIToken):
|
||||
if not self.request.auth.team.all_events:
|
||||
raise PermissionDenied("No permission to edit exports you could not run.")
|
||||
elif self.request.user.is_authenticated:
|
||||
if not self.request.user.teams.filter(
|
||||
TeamQuerySet.event_permission_q(exporter.get_required_event_permission()),
|
||||
all_events=True,
|
||||
).exists():
|
||||
raise PermissionDenied("No permission to edit exports you could not run.")
|
||||
else:
|
||||
events_selected = serializer.instance.export_form_data.get("events", [])
|
||||
events_permission = set(perm_holder.get_events_with_permission(
|
||||
exporter.get_required_event_permission(), request=self.request
|
||||
).values_list("pk", flat=True))
|
||||
if not all(e in events_permission for e in events_selected):
|
||||
raise PermissionDenied("No permission to edit exports you could not run.")
|
||||
|
||||
serializer.save(organizer=self.request.organizer)
|
||||
serializer.instance.compute_next_run()
|
||||
|
||||
@@ -43,7 +43,7 @@ from pretix.base.models import (
|
||||
ReusableMedium,
|
||||
)
|
||||
from pretix.base.models.orders import PrintLog
|
||||
from pretix.helpers import LOCK_SELF_NO_KEY
|
||||
from pretix.helpers import OF_SELF
|
||||
from pretix.helpers.dicts import merge_dicts
|
||||
|
||||
with scopes_disabled():
|
||||
@@ -119,7 +119,7 @@ class ReusableMediaViewSet(viewsets.ModelViewSet):
|
||||
|
||||
@transaction.atomic()
|
||||
def perform_update(self, serializer):
|
||||
rm = ReusableMedium.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=self.get_object().pk)
|
||||
rm = ReusableMedium.objects.select_for_update(of=OF_SELF).get(pk=self.get_object().pk)
|
||||
prev_linked_ops_pks = list(rm.linked_orderpositions.values_list("pk", flat=True))
|
||||
inst = serializer.save(identifier=serializer.instance.identifier, type=serializer.instance.type)
|
||||
linked_ops_pks = inst.linked_orderpositions.values_list("pk", flat=True)
|
||||
@@ -183,18 +183,9 @@ class ReusableMediaViewSet(viewsets.ModelViewSet):
|
||||
type=s.validated_data["type"],
|
||||
identifier=s.validated_data["identifier"],
|
||||
)
|
||||
m.customer = None # not relevant for cross-organizer
|
||||
s = self.get_serializer(m)
|
||||
data = s.data
|
||||
# Remove fields that are not relevant for cross-organizer usage
|
||||
data["customer"] = None
|
||||
data["linked_orderposition"] = None
|
||||
data["linked_orderpositions"] = []
|
||||
data["info"] = {}
|
||||
data["notes"] = None
|
||||
data["claim_token"] = None
|
||||
data["label"] = None
|
||||
|
||||
return Response({"result": data})
|
||||
return Response({"result": s.data})
|
||||
except ReusableMedium.DoesNotExist:
|
||||
mt = MEDIA_TYPES.get(s.validated_data["type"])
|
||||
if mt:
|
||||
|
||||
@@ -102,7 +102,7 @@ from pretix.base.signals import (
|
||||
order_modified, order_paid, order_placed, register_ticket_outputs,
|
||||
)
|
||||
from pretix.control.signals import order_search_filter_q
|
||||
from pretix.helpers import LOCK_SELF_NO_KEY
|
||||
from pretix.helpers import OF_SELF
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -600,7 +600,7 @@ class EventOrderViewSet(OrderViewSetMixin, viewsets.ModelViewSet):
|
||||
@transaction.atomic()
|
||||
def create_invoice(self, request, **kwargs):
|
||||
order = self.get_object()
|
||||
order = Order.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=order.pk)
|
||||
order = Order.objects.select_for_update(of=OF_SELF).get(pk=order.pk)
|
||||
has_inv = order.invoices.exists() and not (
|
||||
order.status in (Order.STATUS_PAID, Order.STATUS_PENDING)
|
||||
and order.invoices.filter(is_cancellation=True).count() >= order.invoices.filter(is_cancellation=False).count()
|
||||
@@ -2026,7 +2026,7 @@ class InvoiceViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
raise PermissionDenied('The invoice file is no longer stored on the server.')
|
||||
|
||||
with transaction.atomic(durable=True):
|
||||
invoice = Invoice.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=invoice.pk)
|
||||
invoice = Invoice.objects.select_for_update(of=OF_SELF).get(pk=invoice.pk)
|
||||
|
||||
if invoice.transmission_status == Invoice.TRANSMISSION_STATUS_INFLIGHT:
|
||||
raise CurrentlyInflightException()
|
||||
@@ -2080,7 +2080,7 @@ class InvoiceViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
elif inv.shredded:
|
||||
raise PermissionDenied('The invoice file is no longer stored on the server.')
|
||||
else:
|
||||
order = Order.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=inv.order_id)
|
||||
order = Order.objects.select_for_update(of=OF_SELF).get(pk=inv.order_id)
|
||||
c = generate_cancellation(inv)
|
||||
if invoice_qualified(order):
|
||||
inv = generate_invoice(order)
|
||||
|
||||
@@ -58,7 +58,7 @@ from pretix.base.models import (
|
||||
from pretix.base.plugins import (
|
||||
PLUGIN_LEVEL_EVENT, PLUGIN_LEVEL_EVENT_ORGANIZER_HYBRID,
|
||||
)
|
||||
from pretix.helpers import LOCK_SELF_NO_KEY
|
||||
from pretix.helpers import OF_SELF
|
||||
from pretix.helpers.dicts import merge_dicts
|
||||
|
||||
|
||||
@@ -274,7 +274,7 @@ class GiftCardViewSet(viewsets.ModelViewSet):
|
||||
def perform_update(self, serializer):
|
||||
if 'include_accepted' in self.request.GET:
|
||||
raise PermissionDenied("Accepted gift cards cannot be updated, use transact instead.")
|
||||
GiftCard.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=self.get_object().pk)
|
||||
GiftCard.objects.select_for_update(of=OF_SELF).get(pk=self.get_object().pk)
|
||||
|
||||
value = serializer.validated_data.pop('value', None)
|
||||
|
||||
@@ -310,7 +310,7 @@ class GiftCardViewSet(viewsets.ModelViewSet):
|
||||
@action(detail=True, methods=["POST"])
|
||||
@transaction.atomic()
|
||||
def transact(self, request, **kwargs):
|
||||
gc = GiftCard.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=self.get_object().pk)
|
||||
gc = GiftCard.objects.select_for_update(of=OF_SELF).get(pk=self.get_object().pk)
|
||||
value = serializers.DecimalField(max_digits=13, decimal_places=2).to_internal_value(
|
||||
request.data.get('value')
|
||||
)
|
||||
|
||||
@@ -42,7 +42,7 @@ from pretix.base.models import LogEntry
|
||||
from pretix.base.services.tasks import ProfiledTask, TransactionAwareTask
|
||||
from pretix.base.signals import periodic_task
|
||||
from pretix.celery_app import app
|
||||
from pretix.helpers import LOCK_SELF_NO_KEY
|
||||
from pretix.helpers import OF_SELF
|
||||
from pretix.helpers.celery import get_task_priority
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -678,7 +678,7 @@ def manually_retry_all_calls(webhook_id: int):
|
||||
with scope(organizer=webhook.organizer), transaction.atomic():
|
||||
for whcr in webhook.retries.select_for_update(
|
||||
skip_locked=connection.features.has_select_for_update_skip_locked,
|
||||
**LOCK_SELF_NO_KEY
|
||||
of=OF_SELF
|
||||
):
|
||||
send_webhook.apply_async(
|
||||
args=(whcr.logentry_id, whcr.action_type, whcr.webhook_id, whcr.retry_count),
|
||||
@@ -692,7 +692,7 @@ def schedule_webhook_retries_on_celery(sender, **kwargs):
|
||||
with transaction.atomic():
|
||||
for whcr in WebHookCallRetry.objects.select_for_update(
|
||||
skip_locked=connection.features.has_select_for_update_skip_locked,
|
||||
**LOCK_SELF_NO_KEY
|
||||
of=OF_SELF
|
||||
).filter(retry_not_before__lt=now()):
|
||||
send_webhook.apply_async(
|
||||
args=(whcr.logentry_id, whcr.action_type, whcr.webhook_id, whcr.retry_count),
|
||||
|
||||
@@ -40,7 +40,7 @@ from pretix.base.i18n import language
|
||||
from pretix.base.logentrytype_registry import make_link
|
||||
from pretix.base.models.datasync import OrderSyncQueue, OrderSyncResult
|
||||
from pretix.base.signals import PluginAwareRegistry
|
||||
from pretix.helpers import LOCK_SELF_NO_KEY
|
||||
from pretix.helpers import OF_SELF
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -199,7 +199,7 @@ class OutboundSyncProvider:
|
||||
try:
|
||||
sq = (
|
||||
OrderSyncQueue.objects
|
||||
.select_for_update(**LOCK_SELF_NO_KEY, nowait=True)
|
||||
.select_for_update(of=OF_SELF, nowait=True)
|
||||
.select_related("order")
|
||||
.get(pk=queue_item.pk)
|
||||
)
|
||||
|
||||
@@ -93,7 +93,7 @@ class Gate(LoggedModel):
|
||||
if instance:
|
||||
qs = qs.exclude(pk=instance.pk)
|
||||
if qs.exists():
|
||||
raise ValidationError(_('This identifier is already used for a different gate.'))
|
||||
raise ValidationError(_('This identifier is already used for a different question.'))
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if not self.identifier:
|
||||
|
||||
@@ -1343,8 +1343,6 @@ class ItemVariation(models.Model):
|
||||
quotacounter[q] += b.count
|
||||
|
||||
for q, n in quotacounter.items():
|
||||
if n == 0:
|
||||
continue
|
||||
a = q.availability(count_waitinglist=count_waitinglist, _cache=_cache)
|
||||
if a[1] is None:
|
||||
continue
|
||||
@@ -1488,8 +1486,8 @@ class ItemAddOn(models.Model):
|
||||
|
||||
@staticmethod
|
||||
def clean_max_count(max_count):
|
||||
if max_count < 1:
|
||||
raise ValidationError(_('The maximum count needs to be greater than zero.'))
|
||||
if max_count < 0:
|
||||
raise ValidationError(_('The maximum count needs to be equal to or greater than zero.'))
|
||||
|
||||
@staticmethod
|
||||
def clean_max_min_count(max_count, min_count):
|
||||
@@ -1570,8 +1568,8 @@ class ItemBundle(models.Model):
|
||||
|
||||
@staticmethod
|
||||
def clean_count(count):
|
||||
if count < 1:
|
||||
raise ValidationError(_('The count needs to be greater than zero.'))
|
||||
if count < 0:
|
||||
raise ValidationError(_('The count needs to be equal to or greater than zero.'))
|
||||
|
||||
|
||||
class Question(LoggedModel):
|
||||
|
||||
@@ -85,7 +85,7 @@ from pretix.base.settings import PERSON_NAME_SCHEMES, ROUNDING_MODES
|
||||
from pretix.base.signals import allow_ticket_download, order_gracefully_delete
|
||||
from pretix.base.timemachine import time_machine_now
|
||||
|
||||
from ...helpers import LOCK_SELF_NO_KEY
|
||||
from ...helpers import OF_SELF
|
||||
from ...helpers.countries import CachedCountries, FastCountryField
|
||||
from ...helpers.models import NormalizedDecimalField
|
||||
from ...helpers.names import build_name
|
||||
@@ -1859,7 +1859,7 @@ class OrderPayment(models.Model):
|
||||
:param send_mail: Whether an email should be sent to the user about this event (default: ``True``).
|
||||
"""
|
||||
with transaction.atomic():
|
||||
locked_instance = OrderPayment.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=self.pk)
|
||||
locked_instance = OrderPayment.objects.select_for_update(of=OF_SELF).get(pk=self.pk)
|
||||
if locked_instance.state in (
|
||||
OrderPayment.PAYMENT_STATE_CONFIRMED,
|
||||
OrderPayment.PAYMENT_STATE_FAILED,
|
||||
@@ -1928,7 +1928,7 @@ class OrderPayment(models.Model):
|
||||
:raises Quota.QuotaExceededException: if the quota is exceeded and ``force`` is ``False``
|
||||
"""
|
||||
with transaction.atomic():
|
||||
locked_instance = OrderPayment.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=self.pk)
|
||||
locked_instance = OrderPayment.objects.select_for_update(of=OF_SELF).get(pk=self.pk)
|
||||
if locked_instance.state == self.PAYMENT_STATE_CONFIRMED:
|
||||
# Race condition detected, this payment is already confirmed
|
||||
logger.info('Confirmed payment {} but ignored due to likely race condition.'.format(
|
||||
|
||||
@@ -35,7 +35,7 @@ from pretix.base.email import get_email_context
|
||||
from pretix.base.i18n import language
|
||||
from pretix.base.models import User, Voucher
|
||||
from pretix.base.services.mail import mail
|
||||
from pretix.helpers import LOCK_SELF_NO_KEY
|
||||
from pretix.helpers import OF_SELF
|
||||
|
||||
from ...helpers.names import build_name
|
||||
from .base import LoggedModel
|
||||
@@ -191,7 +191,7 @@ class WaitingListEntry(LoggedModel):
|
||||
raise WaitingListException(_('This entry is anonymized and can no longer be used.'))
|
||||
|
||||
with transaction.atomic():
|
||||
locked_wle = WaitingListEntry.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=self.pk)
|
||||
locked_wle = WaitingListEntry.objects.select_for_update(of=OF_SELF).get(pk=self.pk)
|
||||
locked_wle.event = event
|
||||
if locked_wle.voucher:
|
||||
raise WaitingListException(_('A voucher has already been sent to this person.'))
|
||||
|
||||
@@ -67,7 +67,7 @@ from pretix.base.signals import register_payment_providers
|
||||
from pretix.base.templatetags.money import money_filter
|
||||
from pretix.base.templatetags.rich_text import rich_text
|
||||
from pretix.base.timemachine import time_machine_now
|
||||
from pretix.helpers import LOCK_SELF_NO_KEY
|
||||
from pretix.helpers import OF_SELF
|
||||
from pretix.helpers.countries import CachedCountries
|
||||
from pretix.helpers.format import format_map
|
||||
from pretix.helpers.money import DecimalTextInput
|
||||
@@ -1645,7 +1645,7 @@ class GiftCardPayment(BasePaymentProvider):
|
||||
try:
|
||||
with transaction.atomic():
|
||||
try:
|
||||
gc = GiftCard.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=gcpk)
|
||||
gc = GiftCard.objects.select_for_update(of=OF_SELF).get(pk=gcpk)
|
||||
except GiftCard.DoesNotExist:
|
||||
raise PaymentException(_("This gift card does not support this currency."))
|
||||
if gc.currency != self.event.currency: # noqa - just a safeguard
|
||||
|
||||
@@ -45,7 +45,7 @@ from pretix.base.services.tasks import ProfiledEventTask
|
||||
from pretix.base.services.tax import split_fee_for_taxes
|
||||
from pretix.base.templatetags.money import money_filter
|
||||
from pretix.celery_app import app
|
||||
from pretix.helpers import LOCK_SELF_NO_KEY
|
||||
from pretix.helpers import OF_SELF
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -286,7 +286,7 @@ def cancel_event(self, event: Event, subevent: int, auto_refund: bool,
|
||||
if dry_run:
|
||||
o = event.orders.get(pk=o)
|
||||
else:
|
||||
o = event.orders.select_for_update(**LOCK_SELF_NO_KEY).get(pk=o)
|
||||
o = event.orders.select_for_update(of=OF_SELF).get(pk=o)
|
||||
total = Decimal('0.00')
|
||||
fee = Decimal('0.00')
|
||||
positions = []
|
||||
|
||||
@@ -58,7 +58,7 @@ from pretix.base.models import (
|
||||
OrderPosition, QuestionOption,
|
||||
)
|
||||
from pretix.base.signals import checkin_created, periodic_task
|
||||
from pretix.helpers import LOCK_SELF_NO_KEY
|
||||
from pretix.helpers import OF_SELF
|
||||
from pretix.helpers.database import conditional_atomic
|
||||
from pretix.helpers.jsonlogic import Logic
|
||||
from pretix.helpers.jsonlogic_boolalg import convert_to_dnf
|
||||
@@ -1049,7 +1049,7 @@ def perform_checkin(op: OrderPosition, clist: CheckinList, given_answers: dict,
|
||||
# Lock order positions, if it is an entry. We don't need it for exits, as a race condition wouldn't be problematic
|
||||
opqs = OrderPosition.all.select_related("order", "item")
|
||||
if type != Checkin.TYPE_EXIT and not simulate:
|
||||
opqs = opqs.select_for_update(**LOCK_SELF_NO_KEY)
|
||||
opqs = opqs.select_for_update(of=OF_SELF)
|
||||
op = opqs.get(pk=op.pk)
|
||||
|
||||
if not clist.all_products and op.item_id not in [i.pk for i in clist.limit_products.all()]:
|
||||
|
||||
@@ -50,7 +50,7 @@ from pretix.base.signals import (
|
||||
periodic_task, register_data_exporters, register_multievent_data_exporters,
|
||||
)
|
||||
from pretix.celery_app import app
|
||||
from pretix.helpers import LOCK_SELF_NO_KEY, repeatable_reads_transaction
|
||||
from pretix.helpers import OF_SELF, repeatable_reads_transaction
|
||||
from pretix.helpers.urls import mainreverse_absolute
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -501,7 +501,7 @@ def run_scheduled_exports(sender, **kwargs):
|
||||
qs = ScheduledEventExport.objects.filter(
|
||||
schedule_next_run__lt=now(),
|
||||
error_counter__lt=5,
|
||||
).select_for_update(skip_locked=connection.features.has_select_for_update_skip_locked, **LOCK_SELF_NO_KEY).select_related('event')
|
||||
).select_for_update(skip_locked=connection.features.has_select_for_update_skip_locked, of=OF_SELF).select_related('event')
|
||||
for s in qs:
|
||||
scheduled_event_export.apply_async(kwargs={
|
||||
'event': s.event_id,
|
||||
@@ -512,7 +512,7 @@ def run_scheduled_exports(sender, **kwargs):
|
||||
qs = ScheduledOrganizerExport.objects.filter(
|
||||
schedule_next_run__lt=now(),
|
||||
error_counter__lt=5,
|
||||
).select_for_update(skip_locked=connection.features.has_select_for_update_skip_locked, **LOCK_SELF_NO_KEY).select_related('organizer')
|
||||
).select_for_update(skip_locked=connection.features.has_select_for_update_skip_locked, of=OF_SELF).select_related('organizer')
|
||||
for s in qs:
|
||||
scheduled_organizer_export.apply_async(kwargs={
|
||||
'organizer': s.organizer_id,
|
||||
|
||||
@@ -67,7 +67,7 @@ from pretix.base.signals import (
|
||||
build_invoice_data, invoice_line_text, periodic_task,
|
||||
)
|
||||
from pretix.celery_app import app
|
||||
from pretix.helpers.database import LOCK_SELF_NO_KEY, rolledback_transaction
|
||||
from pretix.helpers.database import OF_SELF, rolledback_transaction
|
||||
from pretix.helpers.models import modelcopy
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -688,7 +688,7 @@ def send_invoices_to_organizer(sender, **kwargs):
|
||||
with transaction.atomic():
|
||||
qs = Invoice.objects.filter(
|
||||
sent_to_organizer__isnull=True
|
||||
).prefetch_related('event', 'order').select_for_update(**LOCK_SELF_NO_KEY, skip_locked=connection.features.has_select_for_update_skip_locked)
|
||||
).prefetch_related('event', 'order').select_for_update(of=OF_SELF, skip_locked=connection.features.has_select_for_update_skip_locked)
|
||||
for i in qs[:batch_size]:
|
||||
if i.event.settings.invoice_email_organizer:
|
||||
with language(i.event.settings.locale):
|
||||
@@ -724,7 +724,7 @@ def retry_stuck_invoices(sender, **kwargs):
|
||||
transmission_status=Invoice.TRANSMISSION_STATUS_INFLIGHT,
|
||||
transmission_date__lte=now() - timedelta(hours=48),
|
||||
).select_for_update(
|
||||
**LOCK_SELF_NO_KEY, skip_locked=connection.features.has_select_for_update_skip_locked
|
||||
of=OF_SELF, skip_locked=connection.features.has_select_for_update_skip_locked
|
||||
)
|
||||
batch_size = 5000
|
||||
for invoice in qs[:batch_size]:
|
||||
@@ -749,7 +749,7 @@ def send_pending_invoices(sender, **kwargs):
|
||||
transmission_status=Invoice.TRANSMISSION_STATUS_PENDING,
|
||||
created__lte=now() - timedelta(minutes=15),
|
||||
).select_for_update(
|
||||
**LOCK_SELF_NO_KEY, skip_locked=connection.features.has_select_for_update_skip_locked
|
||||
of=OF_SELF, skip_locked=connection.features.has_select_for_update_skip_locked
|
||||
)
|
||||
batch_size = 5000
|
||||
for invoice in qs[:batch_size]:
|
||||
@@ -760,7 +760,7 @@ def send_pending_invoices(sender, **kwargs):
|
||||
def transmit_invoice(sender, invoice_id, allow_retransmission=True, **kwargs):
|
||||
with transaction.atomic(durable='tests.testdummy' not in settings.INSTALLED_APPS):
|
||||
# We need durable=True for transactional correctness, but can't have it during tests
|
||||
invoice = Invoice.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=invoice_id)
|
||||
invoice = Invoice.objects.select_for_update(of=OF_SELF).get(pk=invoice_id)
|
||||
|
||||
if invoice.transmission_status == Invoice.TRANSMISSION_STATUS_INFLIGHT:
|
||||
logger.info(f"Did not transmit invoice {invoice.pk} due to being in inflight state.")
|
||||
|
||||
@@ -80,7 +80,7 @@ from pretix.base.signals import (
|
||||
email_filter, global_email_filter, periodic_task,
|
||||
)
|
||||
from pretix.celery_app import app
|
||||
from pretix.helpers import LOCK_SELF_NO_KEY
|
||||
from pretix.helpers import OF_SELF
|
||||
from pretix.helpers.format import (
|
||||
FormattedString, PlainHtmlAlternativeString, SafeFormatter, format_map,
|
||||
)
|
||||
@@ -412,7 +412,7 @@ def mail_send_task(self, **kwargs) -> bool:
|
||||
|
||||
with transaction.atomic():
|
||||
try:
|
||||
outgoing_mail = OutgoingMail.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=outgoing_mail)
|
||||
outgoing_mail = OutgoingMail.objects.select_for_update(of=OF_SELF).get(pk=outgoing_mail)
|
||||
except OutgoingMail.DoesNotExist:
|
||||
logger.info(f"Ignoring job for non existing email {outgoing_mail}")
|
||||
return False
|
||||
@@ -1107,7 +1107,7 @@ def retry_stuck_inflight_mails(sender, **kwargs):
|
||||
for m in OutgoingMail.objects.filter(
|
||||
status=OutgoingMail.STATUS_INFLIGHT,
|
||||
inflight_since__lt=now() - timedelta(hours=1),
|
||||
).select_for_update(**LOCK_SELF_NO_KEY, skip_locked=connection.features.has_select_for_update_skip_locked):
|
||||
).select_for_update(of=OF_SELF, skip_locked=connection.features.has_select_for_update_skip_locked):
|
||||
m.status = OutgoingMail.STATUS_QUEUED
|
||||
m.save()
|
||||
mail_send_task.apply_async(kwargs={"outgoing_mail": m.pk})
|
||||
|
||||
@@ -33,7 +33,7 @@ from pretix.base.models import (
|
||||
OrderPosition, SubEvent,
|
||||
)
|
||||
from pretix.base.timemachine import time_machine_now
|
||||
from pretix.helpers import LOCK_SELF_NO_KEY
|
||||
from pretix.helpers import OF_SELF
|
||||
|
||||
|
||||
def membership_validity(item: Item, subevent: Optional[SubEvent], event: Event):
|
||||
@@ -125,7 +125,7 @@ def validate_memberships_in_order(customer: Customer, positions: List[AbstractPo
|
||||
base_qs = Membership.objects.with_usages(ignored_order=ignored_order)
|
||||
|
||||
if lock:
|
||||
base_qs = base_qs.select_for_update(**LOCK_SELF_NO_KEY)
|
||||
base_qs = base_qs.select_for_update(of=OF_SELF)
|
||||
|
||||
membership_cache = base_qs\
|
||||
.select_related('membership_type')\
|
||||
|
||||
@@ -107,7 +107,7 @@ from pretix.base.signals import (
|
||||
)
|
||||
from pretix.base.timemachine import time_machine_now, time_machine_now_assigned
|
||||
from pretix.celery_app import app
|
||||
from pretix.helpers import LOCK_SELF_NO_KEY
|
||||
from pretix.helpers import OF_SELF
|
||||
from pretix.helpers.models import modelcopy
|
||||
from pretix.helpers.periodic import minimum_interval
|
||||
from pretix.presale.productlist import prepare_item_list_for_shop
|
||||
@@ -246,7 +246,7 @@ def reactivate_order(order: Order, force: bool=False, user: User=None, auth=None
|
||||
Voucher.objects.filter(pk=position.voucher.pk).update(redeemed=Greatest(0, F('redeemed') + 1))
|
||||
|
||||
for gc in position.issued_gift_cards.all():
|
||||
gc = GiftCard.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=gc.pk)
|
||||
gc = GiftCard.objects.select_for_update(of=OF_SELF).get(pk=gc.pk)
|
||||
gc.transactions.create(value=position.price, order=order, acceptor=order.event.organizer)
|
||||
gc.log_action(
|
||||
action='pretix.giftcards.transaction.manual',
|
||||
@@ -524,7 +524,7 @@ def _cancel_order(order, user=None, send_mail: bool=True, api_token=None, device
|
||||
# If new actions are added to this function, make sure to add the reverse operation to reactivate_order()
|
||||
with transaction.atomic():
|
||||
if isinstance(order, int):
|
||||
order = Order.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=order)
|
||||
order = Order.objects.select_for_update(of=OF_SELF).get(pk=order)
|
||||
if isinstance(user, int):
|
||||
user = User.objects.get(pk=user)
|
||||
if isinstance(api_token, int):
|
||||
@@ -550,7 +550,7 @@ def _cancel_order(order, user=None, send_mail: bool=True, api_token=None, device
|
||||
|
||||
for position in order.positions.all():
|
||||
for gc in position.issued_gift_cards.all():
|
||||
gc = GiftCard.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=gc.pk)
|
||||
gc = GiftCard.objects.select_for_update(of=OF_SELF).get(pk=gc.pk)
|
||||
if gc.value < position.price:
|
||||
raise OrderError(
|
||||
_('This order can not be canceled since the gift card {card} purchased in '
|
||||
@@ -1489,7 +1489,7 @@ def send_expiry_warnings(sender, **kwargs):
|
||||
|
||||
if days and (o.expires - today).days <= days:
|
||||
with transaction.atomic():
|
||||
o = Order.objects.select_related('event').select_for_update(**LOCK_SELF_NO_KEY).get(pk=o.pk)
|
||||
o = Order.objects.select_related('event').select_for_update(of=OF_SELF).get(pk=o.pk)
|
||||
if o.status != Order.STATUS_PENDING or o.expiry_reminder_sent:
|
||||
# Race condition
|
||||
continue
|
||||
@@ -1574,7 +1574,7 @@ def send_download_reminders(sender, **kwargs):
|
||||
continue
|
||||
|
||||
with transaction.atomic():
|
||||
o = Order.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=o.pk)
|
||||
o = Order.objects.select_for_update(of=OF_SELF).get(pk=o.pk)
|
||||
if o.download_reminder_sent:
|
||||
# Race condition
|
||||
continue
|
||||
@@ -2560,7 +2560,7 @@ class OrderChangeManager:
|
||||
elif isinstance(op, self.CancelOperation):
|
||||
position = position_cache.setdefault(op.position.pk, op.position)
|
||||
for gc in position.issued_gift_cards.all():
|
||||
gc = GiftCard.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=gc.pk)
|
||||
gc = GiftCard.objects.select_for_update(of=OF_SELF).get(pk=gc.pk)
|
||||
if gc.value < position.price:
|
||||
raise OrderError(_(
|
||||
'A position can not be canceled since the gift card {card} purchased in this order has '
|
||||
@@ -2587,7 +2587,7 @@ class OrderChangeManager:
|
||||
for opa in position.addons.all():
|
||||
opa = position_cache.setdefault(opa.pk, opa)
|
||||
for gc in opa.issued_gift_cards.all():
|
||||
gc = GiftCard.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=gc.pk)
|
||||
gc = GiftCard.objects.select_for_update(of=OF_SELF).get(pk=gc.pk)
|
||||
if gc.value < opa.position.price:
|
||||
raise OrderError(_(
|
||||
'A position can not be canceled since the gift card {card} purchased in this order has '
|
||||
@@ -3162,7 +3162,7 @@ class OrderChangeManager:
|
||||
self._check_order_size()
|
||||
|
||||
with transaction.atomic():
|
||||
locked_instance = Order.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=self.order.pk)
|
||||
locked_instance = Order.objects.select_for_update(of=OF_SELF).get(pk=self.order.pk)
|
||||
if locked_instance.last_modified != self.order.last_modified:
|
||||
raise OrderError(error_messages['race_condition'])
|
||||
|
||||
@@ -3466,9 +3466,9 @@ def change_payment_provider(order: Order, payment_provider, amount=None, new_pay
|
||||
|
||||
open_payment = None
|
||||
if new_payment:
|
||||
lp = order.payments.select_for_update(**LOCK_SELF_NO_KEY).exclude(pk=new_payment.pk).last()
|
||||
lp = order.payments.select_for_update(of=OF_SELF).exclude(pk=new_payment.pk).last()
|
||||
else:
|
||||
lp = order.payments.select_for_update(**LOCK_SELF_NO_KEY).last()
|
||||
lp = order.payments.select_for_update(of=OF_SELF).last()
|
||||
|
||||
if lp and lp.state in (OrderPayment.PAYMENT_STATE_PENDING, OrderPayment.PAYMENT_STATE_CREATED):
|
||||
open_payment = lp
|
||||
@@ -3515,7 +3515,7 @@ def change_payment_provider(order: Order, payment_provider, amount=None, new_pay
|
||||
new_invoice = None
|
||||
if recreate_invoices:
|
||||
# Lock to prevent duplicate invoice creation
|
||||
order = Order.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=order.pk)
|
||||
order = Order.objects.select_for_update(of=OF_SELF).get(pk=order.pk)
|
||||
|
||||
i = order.invoices.filter(is_cancellation=False).last()
|
||||
has_active_invoice = i and not i.canceled
|
||||
|
||||
@@ -340,14 +340,7 @@ class LinkifyAndCleanExtension(Extension):
|
||||
)
|
||||
|
||||
|
||||
class SnippetExtension(markdown.extensions.Extension):
|
||||
def extendMarkdown(self, md, *args, **kwargs):
|
||||
md.parser.blockprocessors.deregister('olist')
|
||||
md.parser.blockprocessors.deregister('ulist')
|
||||
md.parser.blockprocessors.deregister('quote')
|
||||
|
||||
|
||||
def _get_email_markdown(allowed_tags=None, allowed_attributes=ALLOWED_ATTRIBUTES, snippet=False, context=None):
|
||||
def markdown_compile_email(source, allowed_tags=None, allowed_attributes=ALLOWED_ATTRIBUTES, snippet=False, context=None):
|
||||
if allowed_tags is None:
|
||||
allowed_tags = ALLOWED_TAGS_SNIPPET if snippet else ALLOWED_TAGS
|
||||
|
||||
@@ -388,16 +381,20 @@ def _get_email_markdown(allowed_tags=None, allowed_attributes=ALLOWED_ATTRIBUTES
|
||||
]
|
||||
if snippet:
|
||||
exts.append(SnippetExtension())
|
||||
|
||||
return markdown.Markdown(extensions=exts)
|
||||
return markdown.markdown(
|
||||
source,
|
||||
extensions=exts
|
||||
)
|
||||
|
||||
|
||||
def markdown_compile_email(source, allowed_tags=None, allowed_attributes=ALLOWED_ATTRIBUTES, snippet=False, context=None):
|
||||
md = _get_email_markdown(allowed_tags, allowed_attributes, snippet, context)
|
||||
return md.convert(source)
|
||||
class SnippetExtension(markdown.extensions.Extension):
|
||||
def extendMarkdown(self, md, *args, **kwargs):
|
||||
md.parser.blockprocessors.deregister('olist')
|
||||
md.parser.blockprocessors.deregister('ulist')
|
||||
md.parser.blockprocessors.deregister('quote')
|
||||
|
||||
|
||||
def _get_markdown(linker, snippet=False):
|
||||
def markdown_compile(source, linker, snippet=False):
|
||||
tags = ALLOWED_TAGS_SNIPPET if snippet else ALLOWED_TAGS
|
||||
exts = [
|
||||
'markdown.extensions.sane_lists',
|
||||
@@ -412,13 +409,10 @@ def _get_markdown(linker, snippet=False):
|
||||
]
|
||||
if snippet:
|
||||
exts.append(SnippetExtension())
|
||||
|
||||
return markdown.Markdown(extensions=exts)
|
||||
|
||||
|
||||
def markdown_compile(source, linker, snippet=False):
|
||||
md = _get_markdown(linker, snippet)
|
||||
return md.convert(source)
|
||||
return markdown.markdown(
|
||||
source,
|
||||
extensions=exts
|
||||
)
|
||||
|
||||
|
||||
@register.filter
|
||||
@@ -451,25 +445,3 @@ def rich_text_snippet(text: str, **kwargs):
|
||||
)
|
||||
body_md = markdown_compile(text, linker, snippet=True)
|
||||
return mark_safe(body_md)
|
||||
|
||||
|
||||
def _md_escape(md: markdown.Markdown, plain: str):
|
||||
escaped_chars = md.ESCAPED_CHARS
|
||||
translation_map = {ord(x): f"\\{x}" for x in escaped_chars}
|
||||
return plain.translate(translation_map)
|
||||
|
||||
|
||||
def markdown_escape(plain: str) -> str:
|
||||
"""
|
||||
Escape formatting characters in markdown with backslash using the default markdown renderer config.
|
||||
"""
|
||||
md = _get_markdown(bleach.Linker())
|
||||
return _md_escape(md, plain)
|
||||
|
||||
|
||||
def markdown_email_escape(plain: str) -> str:
|
||||
"""
|
||||
Escape formatting characters in markdown with backslash using the default email markdown renderer config.
|
||||
"""
|
||||
md = _get_email_markdown(None, False)
|
||||
return _md_escape(md, plain)
|
||||
@@ -1207,11 +1207,6 @@ class ItemAddOnForm(I18nModelForm):
|
||||
}
|
||||
)
|
||||
self.fields['addon_category'].widget.choices = self.fields['addon_category'].choices
|
||||
self.fields['max_count'] = forms.IntegerField(
|
||||
min_value=1,
|
||||
label=self.fields['max_count'].label,
|
||||
widget=forms.NumberInput(attrs={'placeholder': '1'}),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = ItemAddOn
|
||||
@@ -1324,12 +1319,6 @@ class ItemBundleForm(I18nModelForm):
|
||||
self.fields['itemvar'].choices = choices
|
||||
change_decimal_field(self.fields['designated_price'], self.event.currency)
|
||||
|
||||
self.fields['count'] = forms.IntegerField(
|
||||
min_value=1,
|
||||
label=self.fields['count'].label,
|
||||
widget=forms.NumberInput(attrs={'placeholder': '1'}),
|
||||
)
|
||||
|
||||
def clean(self):
|
||||
d = super().clean()
|
||||
if not self.cleaned_data.get('designated_price'):
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
<link rel="manifest" href="{% url "site.webmanifest" %}">
|
||||
<link rel="mask-icon" href="{% static "pretixbase/img/icons/safari-pinned-tab.svg" %}" color="#3b1c4a">
|
||||
<meta name="theme-color" content="#3b1c4a">
|
||||
<script type="text/javascript" src="{% static "pretixbase/js/csrfcookieretry.js" %}"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
{% endblocktrans %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if not request.event.has_subevents and object.hidden_if_item_available and object.hidden_if_item_available.check_quotas.0 == 100 and object.hidden_if_item_available.is_available %}
|
||||
{% if not request.event.has_subevents and object.hidden_if_item_available and object.hidden_if_item_available.check_quotas.0 == 100 %}
|
||||
<div class="alert alert-warning">
|
||||
{% blocktrans trimmed %}
|
||||
This product is currently not being shown since you configured below that it should only be visible
|
||||
|
||||
@@ -66,7 +66,7 @@ from pretix.base.forms.auth import (
|
||||
)
|
||||
from pretix.base.metrics import pretix_failed_logins, pretix_successful_logins
|
||||
from pretix.base.models import TeamInvite, U2FDevice, User, WebAuthnDevice
|
||||
from pretix.helpers import LOCK_SELF_NO_KEY
|
||||
from pretix.helpers import OF_SELF
|
||||
from pretix.helpers.http import get_client_ip, redirect_to_url
|
||||
from pretix.helpers.ratelimit import rate_limit, rate_limit_reset
|
||||
from pretix.helpers.security import handle_login_source, session_login
|
||||
@@ -401,7 +401,7 @@ class Recover(TemplateView):
|
||||
with transaction.atomic():
|
||||
# Check token in transaction to prevent race condition
|
||||
try:
|
||||
user = User.objects.select_for_update(**LOCK_SELF_NO_KEY).get(id=self.request.GET.get('id'), auth_backend='native')
|
||||
user = User.objects.select_for_update(of=OF_SELF).get(id=self.request.GET.get('id'), auth_backend='native')
|
||||
except User.DoesNotExist:
|
||||
return self.invalid('unknownuser')
|
||||
if not default_token_generator.check_token(user, self.request.GET.get('token')):
|
||||
|
||||
@@ -43,7 +43,7 @@ from pretix.control.permissions import (
|
||||
)
|
||||
from pretix.control.signals import order_info
|
||||
from pretix.control.views.orders import OrderView
|
||||
from pretix.helpers import LOCK_SELF_NO_KEY
|
||||
from pretix.helpers import OF_SELF
|
||||
|
||||
|
||||
@receiver(order_info, dispatch_uid="datasync_control_order_info")
|
||||
@@ -83,7 +83,7 @@ class ControlSyncJob(OrderView):
|
||||
elif self.request.POST.get("cancel_job"):
|
||||
with transaction.atomic():
|
||||
try:
|
||||
job = self.order.queued_sync_jobs.select_for_update(**LOCK_SELF_NO_KEY).get(
|
||||
job = self.order.queued_sync_jobs.select_for_update(of=OF_SELF).get(
|
||||
pk=self.request.POST.get("cancel_job")
|
||||
)
|
||||
except OrderSyncQueue.DoesNotExist:
|
||||
@@ -97,7 +97,7 @@ class ControlSyncJob(OrderView):
|
||||
elif self.request.POST.get("run_job_now"):
|
||||
with transaction.atomic():
|
||||
try:
|
||||
job = self.order.queued_sync_jobs.select_for_update(**LOCK_SELF_NO_KEY).get(
|
||||
job = self.order.queued_sync_jobs.select_for_update(of=OF_SELF).get(
|
||||
pk=self.request.POST.get("run_job_now")
|
||||
)
|
||||
except OrderSyncQueue.DoesNotExist:
|
||||
|
||||
@@ -135,7 +135,7 @@ from pretix.control.permissions import (
|
||||
)
|
||||
from pretix.control.signals import order_search_forms
|
||||
from pretix.control.views import PaginationMixin
|
||||
from pretix.helpers import LOCK_SELF_NO_KEY
|
||||
from pretix.helpers import OF_SELF
|
||||
from pretix.helpers.compat import CompatDeleteView
|
||||
from pretix.helpers.format import SafeFormatter, format_map
|
||||
from pretix.helpers.hierarkey import clean_filename
|
||||
@@ -1161,7 +1161,7 @@ class OrderRefundView(OrderView):
|
||||
|
||||
@transaction.atomic()
|
||||
def perform_refund(self, comment, full_refund, payments):
|
||||
order = Order.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=self.order.pk)
|
||||
order = Order.objects.select_for_update(of=OF_SELF).get(pk=self.order.pk)
|
||||
|
||||
if self.request.POST.get("last_known_refund_id", "0") != str(self.order.refunds.aggregate(m=Max("id"))["m"] or 0):
|
||||
messages.error(self.request, _('The refund was prevented due to a refund already being processed at the '
|
||||
@@ -1477,7 +1477,7 @@ class OrderTransition(OrderView):
|
||||
@transaction.atomic()
|
||||
def post(self, request, *args, **kwargs):
|
||||
to = self.request.POST.get('status', '')
|
||||
self.order = Order.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=self.order.pk)
|
||||
self.order = Order.objects.select_for_update(of=OF_SELF).get(pk=self.order.pk)
|
||||
|
||||
if self.order.status in (Order.STATUS_PENDING, Order.STATUS_EXPIRED) and to == 'p' and self.mark_paid_form.is_valid():
|
||||
ps = self.mark_paid_form.cleaned_data['amount']
|
||||
@@ -1618,7 +1618,7 @@ class OrderInvoiceCreate(OrderView):
|
||||
|
||||
def post(self, *args, **kwargs):
|
||||
with transaction.atomic():
|
||||
order = Order.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=self.order.pk)
|
||||
order = Order.objects.select_for_update(of=OF_SELF).get(pk=self.order.pk)
|
||||
has_inv = order.invoices.exists() and not (
|
||||
order.status in (Order.STATUS_PAID, Order.STATUS_PENDING)
|
||||
and order.invoices.filter(is_cancellation=True).count() >= order.invoices.filter(is_cancellation=False).count()
|
||||
@@ -1727,7 +1727,7 @@ class OrderInvoiceRetransmit(OrderView):
|
||||
def post(self, *args, **kwargs):
|
||||
with transaction.atomic(durable=True):
|
||||
try:
|
||||
invoice = self.order.invoices.select_for_update(**LOCK_SELF_NO_KEY).get(pk=kwargs.get("id"))
|
||||
invoice = self.order.invoices.select_for_update(of=OF_SELF).get(pk=kwargs.get("id"))
|
||||
except Invoice.DoesNotExist:
|
||||
messages.error(self.request, _('Unknown invoice.'))
|
||||
return redirect(self.get_order_url())
|
||||
@@ -1757,7 +1757,7 @@ class OrderInvoiceReissue(OrderView):
|
||||
|
||||
def post(self, *args, **kwargs):
|
||||
with transaction.atomic():
|
||||
order = Order.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=self.order.pk)
|
||||
order = Order.objects.select_for_update(of=OF_SELF).get(pk=self.order.pk)
|
||||
try:
|
||||
inv = order.invoices.get(pk=kwargs.get('id'))
|
||||
except Invoice.DoesNotExist:
|
||||
|
||||
@@ -139,7 +139,7 @@ from pretix.control.permissions import (
|
||||
from pretix.control.signals import nav_organizer
|
||||
from pretix.control.views import LargeResultSetPaginator, PaginationMixin
|
||||
from pretix.control.views.mailsetup import MailSettingsSetupView
|
||||
from pretix.helpers import LOCK_SELF_NO_KEY, GroupConcat
|
||||
from pretix.helpers import OF_SELF, GroupConcat
|
||||
from pretix.helpers.compat import CompatDeleteView
|
||||
from pretix.helpers.dicts import merge_dicts
|
||||
from pretix.helpers.format import SafeFormatter, format_map
|
||||
@@ -1795,7 +1795,7 @@ class GiftCardDetailView(OrganizerDetailViewMixin, OrganizerPermissionRequiredMi
|
||||
def post(self, request, *args, **kwargs):
|
||||
if not request.user.has_organizer_permission(request.organizer, "organizer.giftcards:write", request=request):
|
||||
raise PermissionDenied()
|
||||
self.object = GiftCard.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=self.get_object().pk)
|
||||
self.object = GiftCard.objects.select_for_update(of=OF_SELF).get(pk=self.get_object().pk)
|
||||
if 'revert' in request.POST:
|
||||
t = get_object_or_404(self.object.transactions.all(), pk=request.POST.get('revert'), order__isnull=False)
|
||||
if self.object.value - t.value < Decimal('0.00'):
|
||||
@@ -2124,7 +2124,7 @@ class ExportView(OrganizerPermissionRequiredMixin, ExportMixin, ListView):
|
||||
@transaction.atomic()
|
||||
def post(self, request, *args, **kwargs):
|
||||
if request.POST.get("schedule") == "save":
|
||||
if self.scheduled and self.scheduled.pk and not self.has_permission_to_edit_scheduled(self.scheduled.export_form_data):
|
||||
if self.scheduled and self.scheduled.pk and not self.has_permission_to_edit_scheduled():
|
||||
messages.error(
|
||||
self.request,
|
||||
_(
|
||||
@@ -2143,16 +2143,6 @@ class ExportView(OrganizerPermissionRequiredMixin, ExportMixin, ListView):
|
||||
)
|
||||
return super().get(request, *args, **kwargs)
|
||||
elif self.exporter.form.is_valid() and self.rrule_form.is_valid() and self.schedule_form.is_valid():
|
||||
if self.scheduled and self.scheduled.pk and not self.has_permission_to_edit_scheduled(self.exporter.form.cleaned_data):
|
||||
messages.error(
|
||||
self.request,
|
||||
_(
|
||||
"This report runs with the permissions of a different user and you do not have access to all "
|
||||
"events, therefore you cannot change it to cover additional events."
|
||||
)
|
||||
)
|
||||
return super().get(request, *args, **kwargs)
|
||||
|
||||
self.schedule_form.instance.export_identifier = self.exporter.identifier
|
||||
self.schedule_form.instance.export_form_data = self.exporter.form.cleaned_data
|
||||
self.schedule_form.instance.schedule_rrule = str(self.rrule_form.to_rrule())
|
||||
@@ -2234,7 +2224,7 @@ class ExportView(OrganizerPermissionRequiredMixin, ExportMixin, ListView):
|
||||
def get_queryset(self):
|
||||
return self.get_scheduled_queryset()
|
||||
|
||||
def has_permission_to_edit_scheduled(self, export_form_data):
|
||||
def has_permission_to_edit_scheduled(self):
|
||||
# Exports can be edited by
|
||||
# - their owner
|
||||
# - any staff session user
|
||||
@@ -2259,7 +2249,7 @@ class ExportView(OrganizerPermissionRequiredMixin, ExportMixin, ListView):
|
||||
self.request.organizer, self.exporter.get_required_organizer_permission(), request=self.request
|
||||
)
|
||||
else:
|
||||
if export_form_data.get("all_events", False):
|
||||
if self.scheduled.export_form_data.get("all_events", False):
|
||||
# Test scenario 1/2 in test_organizer_edit_restrictions
|
||||
return self.request.user.teams.filter(
|
||||
TeamQuerySet.event_permission_q(self.exporter.get_required_event_permission()),
|
||||
@@ -2267,7 +2257,7 @@ class ExportView(OrganizerPermissionRequiredMixin, ExportMixin, ListView):
|
||||
).exists()
|
||||
else:
|
||||
# Test scenario 3/4 in test_organizer_edit_restrictions
|
||||
events_selected = export_form_data.get("events", [])
|
||||
events_selected = self.scheduled.export_form_data.get("events", [])
|
||||
events_permission = set(self.request.user.get_events_with_permission(
|
||||
self.exporter.get_required_event_permission(), request=self.request,
|
||||
).values_list("pk", flat=True))
|
||||
@@ -2295,7 +2285,7 @@ class ExportView(OrganizerPermissionRequiredMixin, ExportMixin, ListView):
|
||||
ctx['rrule_form'] = self.rrule_form
|
||||
ctx['scheduled_copy_from'] = self.scheduled_copy_from
|
||||
|
||||
if self.scheduled and self.scheduled.pk and not self.has_permission_to_edit_scheduled(self.scheduled.export_form_data) and self.exporter:
|
||||
if self.scheduled and self.scheduled.pk and not self.has_permission_to_edit_scheduled() and self.exporter:
|
||||
ctx['no_save'] = True
|
||||
for f in self.exporter.form.fields.values():
|
||||
f.disabled = True
|
||||
|
||||
@@ -29,6 +29,7 @@ from django.db.models import (
|
||||
Aggregate, Expression, F, Field, Func, IntegerField, JSONField, Lookup,
|
||||
OrderBy, Value,
|
||||
)
|
||||
from django.utils.functional import lazy
|
||||
|
||||
|
||||
class DummyRollbackException(Exception):
|
||||
@@ -212,12 +213,9 @@ class PostgresWindowFrame(Expression):
|
||||
}
|
||||
|
||||
|
||||
# OF_SELF is kept for backwards-compatibility. Since we do not need MySQL any more, you can just use `of=("self",)`
|
||||
# SQLite will not fail, but just ignore it
|
||||
OF_SELF = ("self",)
|
||||
# Provided as a constant for convenience because `("self",)` is annoying to type and this way we can more easily update
|
||||
# things across the codebase if required
|
||||
LOCK_SELF_NO_KEY = {"of": OF_SELF, "no_key": True}
|
||||
# This is a short-hand for .select_for_update(of=("self,")), that falls back gracefully on databases that don't support
|
||||
# the SELECT FOR UPDATE OF ... query.
|
||||
OF_SELF = lazy(lambda: ("self",) if connection.features.has_select_for_update_of else (), tuple)()
|
||||
|
||||
|
||||
def get_deterministic_ordering(model, ordering):
|
||||
|
||||
@@ -5,7 +5,7 @@ msgstr ""
|
||||
"Project-Id-Version: 1\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2026-10-28 10:48+0000\n"
|
||||
"PO-Revision-Date: 2026-11-06 22:00+0000\n"
|
||||
"PO-Revision-Date: 2026-10-28 11:13+0000\n"
|
||||
"Last-Translator: Raphael Michel <michel@rami.io>\n"
|
||||
"Language-Team: German <https://translate.pretix.eu/projects/pretix/pretix/"
|
||||
"de/>\n"
|
||||
@@ -14,7 +14,7 @@ msgstr ""
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Generator: Weblate 2026.11.1\n"
|
||||
"X-Generator: Weblate 2026.10.1\n"
|
||||
"X-Poedit-Bookmarks: -1,-1,904,-1,-1,-1,-1,-1,-1,-1\n"
|
||||
|
||||
#: pretix/_base_settings.py
|
||||
@@ -12572,16 +12572,17 @@ msgid ""
|
||||
msgstr ""
|
||||
"Hallo {name},\n"
|
||||
"\n"
|
||||
"Sie haben angefragt, Ihre E-Mail-Adresse für Ihr Kundenkonto bei {organizer} "
|
||||
"zu ändern.\n"
|
||||
"vielen Dank für Ihre Anmeldung für ein Kundenkonto bei {organizer}!\n"
|
||||
"\n"
|
||||
"Um dies zu bestätigen, klicken Sie bitte hier:\n"
|
||||
"Um Ihr Kundenkonto zu aktivieren und ein Passwort zu wählen, klicken Sie "
|
||||
"bitte hier:\n"
|
||||
"\n"
|
||||
"{url}\n"
|
||||
"\n"
|
||||
"Dieser Link ist gültig für einen Tag.\n"
|
||||
"\n"
|
||||
"Wenn Sie dies nicht angefragt haben, können Sie diese E-Mail ignorieren.\n"
|
||||
"Wenn Sie sich nicht selbst angemeldet haben, können Sie diese E-Mail "
|
||||
"ignorieren.\n"
|
||||
"\n"
|
||||
"Viele Grüße\n"
|
||||
"\n"
|
||||
|
||||
@@ -8,7 +8,7 @@ msgstr ""
|
||||
"Project-Id-Version: 1\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2026-10-28 10:48+0000\n"
|
||||
"PO-Revision-Date: 2026-11-06 22:00+0000\n"
|
||||
"PO-Revision-Date: 2026-10-28 11:13+0000\n"
|
||||
"Last-Translator: Raphael Michel <michel@rami.io>\n"
|
||||
"Language-Team: German (informal) <https://translate.pretix.eu/projects/"
|
||||
"pretix/pretix/de_Informal/>\n"
|
||||
@@ -17,7 +17,7 @@ msgstr ""
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Generator: Weblate 2026.11.1\n"
|
||||
"X-Generator: Weblate 2026.10.1\n"
|
||||
|
||||
#: pretix/_base_settings.py
|
||||
msgid "English"
|
||||
@@ -12552,16 +12552,17 @@ msgid ""
|
||||
msgstr ""
|
||||
"Hallo {name},\n"
|
||||
"\n"
|
||||
"du hast angefragt, die E-Mail-Adresse für dein Kundenkonto bei {organizer} "
|
||||
"zu ändern.\n"
|
||||
"vielen Dank für deine Anmeldung für ein Kundenkonto bei {organizer}!\n"
|
||||
"\n"
|
||||
"Um die Änderung zu bestätigen, klicke bitte hier:\n"
|
||||
"Um dein Kundenkonto zu aktivieren und ein Passwort zu wählen, klicke bitte "
|
||||
"hier:\n"
|
||||
"\n"
|
||||
"{url}\n"
|
||||
"\n"
|
||||
"Dieser Link ist gültig für einen Tag.\n"
|
||||
"\n"
|
||||
"Wenn du dies nicht angefordert hast, kannst du diese E-Mail ignorieren.\n"
|
||||
"Wenn du dich nicht selbst angemeldet hast, kannst du diese E-Mail "
|
||||
"ignorieren.\n"
|
||||
"\n"
|
||||
"Viele Grüße\n"
|
||||
"\n"
|
||||
|
||||
@@ -8,8 +8,8 @@ msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2026-10-28 10:48+0000\n"
|
||||
"PO-Revision-Date: 2026-11-15 23:00+0000\n"
|
||||
"Last-Translator: Ikuisuus <kkujala@paivola.fi>\n"
|
||||
"PO-Revision-Date: 2025-10-04 10:10+0000\n"
|
||||
"Last-Translator: Sebastian Bożek <sebastian@log-mar.pl>\n"
|
||||
"Language-Team: Finnish <https://translate.pretix.eu/projects/pretix/pretix/"
|
||||
"fi/>\n"
|
||||
"Language: fi\n"
|
||||
@@ -17,7 +17,7 @@ msgstr ""
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Generator: Weblate 2026.11.2\n"
|
||||
"X-Generator: Weblate 5.13.3\n"
|
||||
|
||||
#: pretix/_base_settings.py
|
||||
msgid "English"
|
||||
@@ -57,7 +57,7 @@ msgstr "tšekki"
|
||||
|
||||
#: pretix/_base_settings.py
|
||||
msgid "Croatian"
|
||||
msgstr "kroatia"
|
||||
msgstr "Kroatia"
|
||||
|
||||
#: pretix/_base_settings.py
|
||||
msgid "Danish"
|
||||
@@ -89,11 +89,11 @@ msgstr "kreikka"
|
||||
|
||||
#: pretix/_base_settings.py
|
||||
msgid "Hebrew"
|
||||
msgstr "Heprea"
|
||||
msgstr ""
|
||||
|
||||
#: pretix/_base_settings.py
|
||||
msgid "Hungarian"
|
||||
msgstr "Unkari"
|
||||
msgstr ""
|
||||
|
||||
#: pretix/_base_settings.py
|
||||
msgid "Indonesian"
|
||||
@@ -149,11 +149,11 @@ msgstr "espanja"
|
||||
|
||||
#: pretix/_base_settings.py
|
||||
msgid "Spanish (Latin America)"
|
||||
msgstr "Espanja (Etelä-Afrikka)"
|
||||
msgstr ""
|
||||
|
||||
#: pretix/_base_settings.py
|
||||
msgid "Thai"
|
||||
msgstr "Thai"
|
||||
msgstr ""
|
||||
|
||||
#: pretix/_base_settings.py
|
||||
msgid "Turkish"
|
||||
@@ -297,16 +297,22 @@ msgid "The bundled item must not have bundles on its own."
|
||||
msgstr "Niputettavalla tuotteella ei saa olla nippuja."
|
||||
|
||||
#: pretix/api/serializers/item.py
|
||||
#, fuzzy
|
||||
#| msgid "The payment is too late to be accepted."
|
||||
msgid "The program start must not be empty."
|
||||
msgstr "Ohjelman alku ei voi olla tyhjä."
|
||||
msgstr "Maksu on liian myöhässä hyväksyttäväksi."
|
||||
|
||||
#: pretix/api/serializers/item.py
|
||||
#, fuzzy
|
||||
#| msgid "The payment is too late to be accepted."
|
||||
msgid "The program end must not be empty."
|
||||
msgstr "Ohjelman loppu ei saa olla tyhjä."
|
||||
msgstr "Maksu on liian myöhässä hyväksyttäväksi."
|
||||
|
||||
#: pretix/api/serializers/item.py pretix/base/models/items.py
|
||||
#, fuzzy
|
||||
#| msgid "The maximum count needs to be greater than the minimum count."
|
||||
msgid "The program end must not be before the program start."
|
||||
msgstr "Ohjelma ei voi päättyä ennen kuin se alkaa."
|
||||
msgstr "Enimmäismäärän on oltava suurempi kuin vähimmäismäärä."
|
||||
|
||||
#: pretix/api/serializers/item.py pretix/base/models/items.py
|
||||
#, fuzzy
|
||||
@@ -614,8 +620,6 @@ msgid ""
|
||||
"This includes related events like creation, deletion, opening or closing of "
|
||||
"quotas. No webhook is sent for changes to the resulting availability."
|
||||
msgstr ""
|
||||
"Tämä sisältää toiminnot kuten luonti, poisto, kiintiöiden avaamiset tai "
|
||||
"sulkemiset. Aiheutuneista muutoksista ei lähetetä Webhook pyyntöä."
|
||||
|
||||
#: pretix/api/webhooks.py
|
||||
msgid "Shop taken live"
|
||||
@@ -666,8 +670,6 @@ msgid ""
|
||||
"Only includes explicit changes to the voucher, not e.g. an increase of the "
|
||||
"number of redemptions."
|
||||
msgstr ""
|
||||
"Sisältää vain varsinaiset muutokset kuponkiin, ei esimerkiksi lisäyksiä "
|
||||
"lunastuskertoihin."
|
||||
|
||||
#: pretix/api/webhooks.py
|
||||
#, fuzzy
|
||||
@@ -848,7 +850,6 @@ msgid ""
|
||||
"Field \"{field_name}\" does not exist. Please check your {provider_name} "
|
||||
"settings."
|
||||
msgstr ""
|
||||
"Kenttä {field_name} ei ole olemassa. Tarkista {provider_name} asetukset."
|
||||
|
||||
#: pretix/base/datasync/datasync.py
|
||||
#, python-brace-format
|
||||
@@ -856,8 +857,6 @@ msgid ""
|
||||
"Field \"{field_name}\" requires {required_input}, but only got "
|
||||
"{available_inputs}. Please check your {provider_name} settings."
|
||||
msgstr ""
|
||||
"Kenttä {field_name} vaatii {required_input}, mutta sai vain "
|
||||
"{available_inputs}. Tarkista {provider_name} asetukset."
|
||||
|
||||
#: pretix/base/datasync/datasync.py
|
||||
#, python-brace-format
|
||||
@@ -865,8 +864,6 @@ msgid ""
|
||||
"Please update value mapping for field \"{field_name}\" - option \"{val}\" "
|
||||
"not assigned"
|
||||
msgstr ""
|
||||
"Päivitä arvot kenttään {field_name} - vaihtoehdon {val} arvoa ei ole "
|
||||
"määritetty"
|
||||
|
||||
#: pretix/base/datasync/sourcefields.py
|
||||
#, fuzzy
|
||||
@@ -897,7 +894,7 @@ msgstr "Tuotetiedot"
|
||||
#: pretix/control/templates/pretixcontrol/order/index.html
|
||||
#: pretix/presale/templates/pretixpresale/event/order.html
|
||||
msgid "Order details"
|
||||
msgstr "Tilauksen yksityiskohdat"
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/datasync/sourcefields.py pretix/base/modelimport_orders.py
|
||||
#: pretix/control/forms/filter.py
|
||||
@@ -1307,7 +1304,7 @@ msgstr "Asiakkaat"
|
||||
#: pretix/presale/templates/pretixpresale/organizers/customer_memberships.html
|
||||
#: pretix/presale/views/customer.py
|
||||
msgid "Memberships"
|
||||
msgstr "Jäsenyydet"
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/exporters/customers.py pretix/base/models/customers.py
|
||||
#: pretix/control/templates/pretixcontrol/organizers/customer.html
|
||||
@@ -2228,10 +2225,6 @@ msgid ""
|
||||
"contain at least one position of this product. The order totals etc. still "
|
||||
"include all products contained in the order."
|
||||
msgstr ""
|
||||
"Mikäli mitään ei valita, kaikki tuotteet sisällytetään. Tilaukset "
|
||||
"sisältyvät, mikäli niissä on edes yksi valittu tuote. Tilauksen kokonaisarvo "
|
||||
"ja muut vastaavat. yhä sisältävät kaikki tuotteet, jotka sisältyivät tähän "
|
||||
"tilaukseen."
|
||||
|
||||
#: pretix/base/exporters/orderlist.py pretix/base/exporters/waitinglist.py
|
||||
#: pretix/control/forms/event.py pretix/control/forms/organizer.py
|
||||
@@ -3103,7 +3096,7 @@ msgstr "Sähköpostiosoite"
|
||||
#: pretix/base/forms/auth.py pretix/control/forms/orders.py
|
||||
#: pretix/control/templates/pretixcontrol/shredder/download.html
|
||||
msgid "Confirmation code"
|
||||
msgstr "Varmistuskoodi"
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/forms/questions.py
|
||||
#, fuzzy
|
||||
@@ -3123,12 +3116,11 @@ msgid ""
|
||||
"The field \"%(label)s\" may not contain special characters such as "
|
||||
"\"%(chars)s\"."
|
||||
msgstr ""
|
||||
"Kenttä \"%(label)s\" ei saisi sisältää erikoismerkkejä kuten \"%(chars)s\"."
|
||||
|
||||
#: pretix/base/forms/questions.py
|
||||
#, python-format
|
||||
msgid "The field \"%(label)s\" may not contain an URL (%(url)s)."
|
||||
msgstr "Kenttä \"%(label)s\" ei saisi sisältää URL-osoitetta %(url)s."
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/forms/questions.py
|
||||
msgctxt "phonenumber"
|
||||
@@ -3194,7 +3186,7 @@ msgstr "Syötä lyhyempi nimi."
|
||||
#: pretix/base/forms/questions.py
|
||||
#, python-brace-format
|
||||
msgid "Please enter a date and time between {min} and {max}."
|
||||
msgstr "Syötä päivämäärä ja aika väliltä {min} ja {max}."
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/forms/questions.py
|
||||
#, fuzzy, python-brace-format
|
||||
@@ -3417,7 +3409,7 @@ msgstr "Sähköpostiosoite vahvistettu"
|
||||
|
||||
#: pretix/base/invoicing/email.py
|
||||
msgid "PDF via email"
|
||||
msgstr "PDF sähköpostilla"
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/invoicing/national.py
|
||||
msgctxt "italian_invoice"
|
||||
@@ -3859,7 +3851,7 @@ msgstr "Löytyi useita vastaavia päivämääriä."
|
||||
|
||||
#: pretix/base/modelimport_orders.py
|
||||
msgid "Grouping"
|
||||
msgstr "Ryhmittely"
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/modelimport_orders.py
|
||||
msgid ""
|
||||
@@ -3878,9 +3870,6 @@ msgid ""
|
||||
"The date can be specified through its full name, full date and time, or "
|
||||
"internal ID, provided only one date in the system matches the input."
|
||||
msgstr ""
|
||||
"Päivään voi viitata sen koko nimellä, täydellä päivämääräällä ja ajalla tai "
|
||||
"sisäisellä ID:llä, kunhan vain yksi päivämäärä järjestelmässä vastaa "
|
||||
"syötteeseen."
|
||||
|
||||
#: pretix/base/modelimport_orders.py pretix/presale/views/waiting.py
|
||||
msgctxt "subevent"
|
||||
@@ -3891,8 +3880,6 @@ msgstr "Sinun täytyy valita päivämäärä."
|
||||
msgid ""
|
||||
"The product can be specified by its internal ID, full name or internal name."
|
||||
msgstr ""
|
||||
"Tuotteen voi tunnistaa sen sisäisellä ID:llä, koko nimellä tai sisäisellä "
|
||||
"nimellä."
|
||||
|
||||
#: pretix/base/modelimport_orders.py pretix/base/modelimport_vouchers.py
|
||||
msgid "No matching product was found."
|
||||
@@ -3910,7 +3897,7 @@ msgstr "Tuotevariaatio"
|
||||
|
||||
#: pretix/base/modelimport_orders.py
|
||||
msgid "The variation can be specified by its internal ID or full name."
|
||||
msgstr "Variaatioon voi viitata sen sisäisellä ID:llä tai koko nimellä."
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/modelimport_orders.py pretix/base/modelimport_vouchers.py
|
||||
msgid "No matching variation was found."
|
||||
@@ -3936,7 +3923,7 @@ msgstr "Syötä kelvollinen maatunnus."
|
||||
|
||||
#: pretix/base/modelimport_orders.py
|
||||
msgid "The state can be specified by its short form or full name."
|
||||
msgstr "Tilaan voi viitata sen lyhyellä muodolla tai koko nimellä."
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/modelimport_orders.py
|
||||
msgid "States are not supported for this country."
|
||||
@@ -3982,7 +3969,7 @@ msgstr "Syötä kelvollinen kielikoodi."
|
||||
msgid ""
|
||||
"The sales channel can be specified by it's internal identifier or its full "
|
||||
"name."
|
||||
msgstr "Myyntikanavaan voi viitata sen sisäisellä ID:llä tai koko nimellä."
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/modelimport_orders.py
|
||||
msgid "Please enter a valid sales channel."
|
||||
@@ -3990,7 +3977,7 @@ msgstr "Syötä kelvollinen myyntikanava."
|
||||
|
||||
#: pretix/base/modelimport_orders.py
|
||||
msgid "The seat needs to be specified by its internal ID."
|
||||
msgstr "Paikkaan täytyy viitata sen sisäisellä ID:llä."
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/modelimport_orders.py pretix/base/modelimport_vouchers.py
|
||||
msgid "Multiple matching seats were found."
|
||||
@@ -4494,7 +4481,6 @@ msgstr "Erota useat arvot välilyönneillä"
|
||||
#: pretix/base/models/datasync.py
|
||||
msgid "Temporary error, auto-retry limit exceeded"
|
||||
msgstr ""
|
||||
"Väliaikainen virhe, automattisten uudelleen yritysten limiitti on ylitetty"
|
||||
|
||||
#: pretix/base/models/datasync.py
|
||||
#, fuzzy
|
||||
@@ -4508,7 +4494,7 @@ msgstr ""
|
||||
|
||||
#: pretix/base/models/datasync.py
|
||||
msgid "System error, needs manual intervention"
|
||||
msgstr "Systeemivirhe, vattii manuaalista korjaamista"
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/models/devices.py pretix/base/models/items.py
|
||||
msgid "Internal identifier"
|
||||
@@ -4773,15 +4759,13 @@ msgstr "Valinnainen. Tuotteita ei myydä ennen tätä."
|
||||
|
||||
#: pretix/base/models/event.py
|
||||
msgid "This event is remote or partially remote."
|
||||
msgstr "Tämä tapahtuma järjestetään joko osittain tai kokonaan etänä."
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/models/event.py
|
||||
msgid ""
|
||||
"This will be used to let users know if the event is in a different timezone, "
|
||||
"and to let us calculate the local time of a user."
|
||||
msgstr ""
|
||||
"Tätä käytetään kertoakseen käyttäjille jos tapahtuma on eri aikavyöhykkeellä "
|
||||
"ja mahdollistetaan käyttäjän paikallisen ajankohdan laskeminen."
|
||||
|
||||
#: pretix/base/models/event.py pretix/base/models/organizer.py
|
||||
#: pretix/control/navigation.py
|
||||
@@ -5077,7 +5061,7 @@ msgstr "Puuttuva summa"
|
||||
|
||||
#: pretix/base/models/invoices.py
|
||||
msgid "currently being transmitted"
|
||||
msgstr "Siirretään parasta aikaa"
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/models/invoices.py
|
||||
#, fuzzy
|
||||
@@ -5100,7 +5084,7 @@ msgstr "tuntematon"
|
||||
|
||||
#: pretix/base/models/invoices.py
|
||||
msgid "not transmitted due to test mode"
|
||||
msgstr "ei välitetty testimoodin vuoksi"
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/models/invoices.py
|
||||
#, python-format
|
||||
@@ -8356,8 +8340,6 @@ msgid ""
|
||||
"Includes the ability to give someone (including oneself) additional "
|
||||
"permissions."
|
||||
msgstr ""
|
||||
"Sisältää mahdollisuuden antaa jollekulle (itsesi mukaanlukien) lisää "
|
||||
"oikeuksia."
|
||||
|
||||
#: pretix/base/permissions.py pretix/control/navigation.py
|
||||
msgid "Devices"
|
||||
@@ -8368,8 +8350,6 @@ msgid ""
|
||||
"Includes the ability to give access to events and data oneself does not have "
|
||||
"access to."
|
||||
msgstr ""
|
||||
"Sisältää mahdollisuuden antaa oikeuksia tapahtumiin ja dataan henkilöllä ei "
|
||||
"ole vielä oikeuksia."
|
||||
|
||||
#: pretix/base/permissions.py
|
||||
#, fuzzy
|
||||
@@ -8380,7 +8360,7 @@ msgstr "Istumajärjestys"
|
||||
#: pretix/base/permissions.py pretix/control/navigation.py
|
||||
#: pretix/control/templates/pretixcontrol/organizers/outgoing_mails.html
|
||||
msgid "Outgoing emails"
|
||||
msgstr "Lähtevät viestit"
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/plugins.py
|
||||
#: pretix/control/templates/pretixcontrol/event/quick_setup.html
|
||||
@@ -8389,19 +8369,19 @@ msgstr "Ominaisuudet"
|
||||
|
||||
#: pretix/base/plugins.py
|
||||
msgid "Integrations"
|
||||
msgstr "Integraatiot"
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/plugins.py
|
||||
msgid "Customizations"
|
||||
msgstr "Kustomoinnit"
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/plugins.py
|
||||
msgid "Output and export formats"
|
||||
msgstr "Ulostulon ja vientien formaatit"
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/plugins.py
|
||||
msgid "API features"
|
||||
msgstr "API ominaisuudet"
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/reldate.py
|
||||
msgid "Event start"
|
||||
@@ -8463,7 +8443,6 @@ msgstr "Ei asetettu"
|
||||
#, python-brace-format
|
||||
msgid "A relative date cannot be expressed as \"before\" for \"{}\""
|
||||
msgstr ""
|
||||
"Suhteellista päivämäärää ei voida ilmaista muodossa \"Ennen\" \"{}\" varten"
|
||||
|
||||
#: pretix/base/reldate.py
|
||||
#, python-brace-format
|
||||
@@ -8499,7 +8478,7 @@ msgstr "Tapahtuma peruttu"
|
||||
|
||||
#: pretix/base/services/cancelevent.py
|
||||
msgid "Confirm event cancellation and bulk refund"
|
||||
msgstr "Vahvista tapahtuman peruminen ja rahojen palauttaminen massana"
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/services/cart.py pretix/base/services/modelimport.py
|
||||
#: pretix/base/services/orders.py
|
||||
@@ -8533,8 +8512,6 @@ msgid ""
|
||||
"Some products can no longer be purchased and have been removed from your "
|
||||
"cart for the following reason: %s"
|
||||
msgstr ""
|
||||
"Joitain tuotteista ei voida enää ostaa ja ne on poistettu ostoskoristasi "
|
||||
"seuraavasta syystä: %s"
|
||||
|
||||
#: pretix/base/services/cart.py
|
||||
msgid ""
|
||||
@@ -9415,7 +9392,7 @@ msgstr "Kuponkia ei voi luoda ilman koodia."
|
||||
#, python-brace-format
|
||||
msgid ""
|
||||
"Voucher codes must be unique. Code \"{code}\" already exists in this import."
|
||||
msgstr "Kuponkikoodien täytyy olla uniikkeja. Koodi \"{code}\" on jo olemassa."
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/services/modelimport.py
|
||||
#, python-brace-format
|
||||
@@ -9424,19 +9401,13 @@ msgid ""
|
||||
msgid_plural ""
|
||||
"Voucher codes must be unique. Import contains existing voucher codes {code}."
|
||||
msgstr[0] ""
|
||||
"Kuponkikoodien tulee olla uniikkeja. Tuoduissa tiedoissa on mukana olemassa "
|
||||
"oleva kuponkikoodi {code}."
|
||||
msgstr[1] ""
|
||||
"Kuponkikoodien tulee olla uniikkeja. Tuoduissa tiedoissa on mukana olemassa "
|
||||
"olevia kuponkikoodeja {code}."
|
||||
|
||||
#: pretix/base/services/modelimport.py
|
||||
msgid ""
|
||||
"Vouchers could not be imported, probably due to a voucher code already being "
|
||||
"in use."
|
||||
msgstr ""
|
||||
"Kuponkeja ei voitu tuoda, todennäköisesti koska kupongin koodi on jo "
|
||||
"käytössä."
|
||||
|
||||
#: pretix/base/services/orders.py
|
||||
msgid ""
|
||||
@@ -9915,19 +9886,17 @@ msgstr "Kuponki on lähetetty {recipient}."
|
||||
|
||||
#: pretix/base/settings.py
|
||||
msgid "Compute taxes for every line individually"
|
||||
msgstr "Laske verot jokaiselle riville yksittäin"
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/settings.py
|
||||
msgid "Compute taxes based on net total"
|
||||
msgstr "Laske verot kokonaissumman perusteella"
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/settings.py
|
||||
msgid ""
|
||||
"For business customers, compute taxes based on net total. For individuals, "
|
||||
"use line-based rounding"
|
||||
msgstr ""
|
||||
"Lasket verot nettosumman pohjalta yritysasiakkaille. Käytä rivipohjaista "
|
||||
"pyöristystä yksityishenkilöille"
|
||||
|
||||
#: pretix/base/settings.py
|
||||
msgid "Compute taxes based on net total with stable gross prices"
|
||||
@@ -9963,7 +9932,7 @@ msgstr ""
|
||||
|
||||
#: pretix/base/settings.py
|
||||
msgid "Require login to access order confirmation pages"
|
||||
msgstr "Vaadi kirjautumista tilausvahvistus sivuille pääsyyn"
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/settings.py
|
||||
msgid ""
|
||||
@@ -9972,10 +9941,6 @@ msgid ""
|
||||
"placing an order, the restriction only becomes active after the customer "
|
||||
"account is activated."
|
||||
msgstr ""
|
||||
"Jos tämä on päällä, käyttäjien, jotka olivat kirjautuneena ostoksen aikana, "
|
||||
"täytyy kirjautua sisään myös päästäkseen käsiksi tilausvahvistukseensa. Jos "
|
||||
"käyttäjätili on luotu tilauksen yhteydessä, rajoite astuu voimaan vasta kun "
|
||||
"käyttäjätili on aktivoitu."
|
||||
|
||||
#: pretix/base/settings.py
|
||||
msgid "Match orders based on email address"
|
||||
@@ -10177,7 +10142,7 @@ msgstr "Vaaditaan puhelinnumero tilausta kohden"
|
||||
|
||||
#: pretix/base/settings.py
|
||||
msgid "Rounding of taxes"
|
||||
msgstr "Verojen pyöristys"
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/settings.py
|
||||
msgid ""
|
||||
@@ -10185,10 +10150,6 @@ msgid ""
|
||||
"for tax reporting, you need to make sure to account for possible rounding "
|
||||
"differences if your external system rounds differently than pretix."
|
||||
msgstr ""
|
||||
"Huomaa, että jos siirrät myyntidataa Pretixistä ulkoiseen järjestelmään "
|
||||
"verojen ilmoittamista varten, on hyvä varmistaa mahdollisten pyöristys "
|
||||
"erojen käsittely mikäli ulkoinen järjestelmäsi pyöristää eri tavalla kuin "
|
||||
"Pretix."
|
||||
|
||||
#: pretix/base/settings.py
|
||||
msgid "Ask for invoice address"
|
||||
@@ -10332,9 +10293,6 @@ msgid ""
|
||||
"ID in all countries. VAT ID will be required for all business addresses in "
|
||||
"the selected countries."
|
||||
msgstr ""
|
||||
"Veronumero on vapaaehtoinen oletusarvoisesti, koska kaikkilla yrityksillä ei "
|
||||
"ole veronumeroa kaikissa maissa. Veronumero vaaditaan kaikilta yritys "
|
||||
"osoitteilta valituissa maissa."
|
||||
|
||||
#: pretix/base/settings.py
|
||||
msgid "Invoice address explanation"
|
||||
@@ -10490,12 +10448,12 @@ msgstr ""
|
||||
|
||||
#: pretix/base/settings.py
|
||||
msgid "No dates match your criteria."
|
||||
msgstr "Yksikään päivämäärä ei vastaa kriteereitäsi."
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/settings.py
|
||||
msgctxt "subevents"
|
||||
msgid "Text for empty date results"
|
||||
msgstr "Teksti tyhjille päivämäärätuloksille"
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/settings.py
|
||||
msgctxt "subevents"
|
||||
@@ -10506,11 +10464,6 @@ msgid ""
|
||||
"touch with you to arrange further dates. We do not recommend more than one "
|
||||
"or two sentences."
|
||||
msgstr ""
|
||||
"Tämä teksti näytetään jos kalenteri tai päivämäärälista on tyhjä. "
|
||||
"Esimerkiksi jos kuukausi ei vastaa päivämäärää tai käyttäjän valitsema "
|
||||
"filtteriin vastaamia tuloksia ei löydy. Voit käyttää tätä mainostamaan "
|
||||
"tapoja ottaa yhteyttä teihin tulevien päivämäärien sopimiseksi. Emme "
|
||||
"suosittele enempää kuin yhtä tai kahta lausetta."
|
||||
|
||||
#: pretix/base/settings.py
|
||||
msgid "Guidance text"
|
||||
@@ -10695,9 +10648,6 @@ msgid ""
|
||||
"their order without selecting a payment method. This is useful whenever "
|
||||
"orders are not created by the same person who is making the payment."
|
||||
msgstr ""
|
||||
"Jos maksun viivästäminen on sallittu myyntikanavassa, asiakkaat voivat "
|
||||
"asettaa tilauksen valitsematta maksutapaa. Tämä on kätevää kun tilaukset "
|
||||
"eivät ole saman henkilön tekemiä, joka maksaa tilauksen."
|
||||
|
||||
#: pretix/base/settings.py
|
||||
msgid "Show start date"
|
||||
@@ -10781,13 +10731,10 @@ msgid ""
|
||||
"Automatic based on ticket-specific validity, membership validity, event "
|
||||
"series date, or event date"
|
||||
msgstr ""
|
||||
"Automaattinen perustuen lippukohtaiseen voimassaoloon, jäsenyyden voimassa "
|
||||
"oloon, tapahtumasarjan päivämäärään tai tapahtuman päivämäärään"
|
||||
|
||||
#: pretix/base/settings.py
|
||||
msgid "Automatic, but prefer invoice date over event date"
|
||||
msgstr ""
|
||||
"Automaattinen, mutta suosi laskun päivämäärää tapahtuman päivämäärän sijaan"
|
||||
|
||||
#: pretix/base/settings.py
|
||||
#, fuzzy
|
||||
@@ -10808,8 +10755,6 @@ msgid ""
|
||||
"This controls what dates are shown on the invoice, but is especially "
|
||||
"important for electronic invoicing."
|
||||
msgstr ""
|
||||
"Tämä kontrolloi mitkä päivämäärät näytetään laskulla ja on erityisen tärkeä "
|
||||
"sähköisessä laskutuksessa."
|
||||
|
||||
#: pretix/base/settings.py
|
||||
msgid "Automatically cancel and reissue invoice on address changes"
|
||||
@@ -10988,12 +10933,6 @@ msgid ""
|
||||
"page. Note that pretix still is a system built around events and the date "
|
||||
"may still show up in other places."
|
||||
msgstr ""
|
||||
"Jätä tämä laatikko valitsematta vain jos myyt jotain millä ei ole erillistä "
|
||||
"päivää, kuten lahjakortti tai lippu, jonka voi käyttää koska tahansa. "
|
||||
"Järjestelmä lakkaa näyttämästä tapahtuma päivää joissain paikoissa kuten "
|
||||
"tapahtuman aloitussivulla. Huomaathan että Pretix on silti järjestelmä, joka "
|
||||
"on rakennettu tapahtumien ympärille ja päivämäärä saatetaan silti näyttää "
|
||||
"muissa paikoissa."
|
||||
|
||||
#: pretix/base/settings.py
|
||||
msgid "Show event end date"
|
||||
@@ -13289,7 +13228,7 @@ msgstr "Sinun on vaadittava laskuosoitteet yritysten nimille."
|
||||
#: pretix/base/settings.py
|
||||
#, python-brace-format
|
||||
msgid "VAT-ID is not supported for \"{}\"."
|
||||
msgstr "Veronumeroa ei tueta \"{}\" varten."
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/settings.py
|
||||
msgid "The last payment date cannot be before the end of presale."
|
||||
@@ -13548,7 +13487,7 @@ msgstr ""
|
||||
|
||||
#: pretix/base/templates/pretixbase/email/cancel_confirm.txt
|
||||
msgid "You requested to cancel an event that involves a large bulk refund:"
|
||||
msgstr "Pyyntösi perua tapahtuma, joka sisältää suuren massapalautuksen:"
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/templates/pretixbase/email/cancel_confirm.txt
|
||||
#, fuzzy
|
||||
@@ -13558,7 +13497,7 @@ msgstr "Hyvitettävä summa"
|
||||
|
||||
#: pretix/base/templates/pretixbase/email/cancel_confirm.txt
|
||||
msgid "To confirm, paste the following code into the cancellation form:"
|
||||
msgstr "Vahvistaaksesi kopioi seuraava koodi peruutus lomakkeelle:"
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/templates/pretixbase/email/cancel_confirm.txt
|
||||
#, python-format
|
||||
@@ -13566,7 +13505,6 @@ msgid ""
|
||||
"Don't share this code with anyone. The %(instance)s team will never ask you "
|
||||
"for it."
|
||||
msgstr ""
|
||||
"Älä jaa tätä koodia kenellekää. %(instance)s tiimi ei koskaan kysy sitä."
|
||||
|
||||
#: pretix/base/templates/pretixbase/email/cancel_confirm.txt
|
||||
#: pretix/base/templates/pretixbase/email/export_failed.txt
|
||||
@@ -13575,8 +13513,6 @@ msgid ""
|
||||
"Thanks, \n"
|
||||
"The %(instance)s Team"
|
||||
msgstr ""
|
||||
"Kiitos, \n"
|
||||
"%(instance)s tiimi"
|
||||
|
||||
#: pretix/base/templates/pretixbase/email/email_footer.html
|
||||
#, python-format
|
||||
@@ -13622,8 +13558,10 @@ msgstr "Vaihda asetuksia"
|
||||
|
||||
#: pretix/base/templates/pretixbase/email/notification.html
|
||||
#: pretix/base/templates/pretixbase/email/notification.txt
|
||||
#, fuzzy
|
||||
#| msgid "Click here disable all notifications immediately."
|
||||
msgid "Disable all notifications"
|
||||
msgstr "Poista kaikki ilmoitukset käytöstä"
|
||||
msgstr "Klikkaa tästä poista kaikki ilmoitukset käytöstä välittömästi."
|
||||
|
||||
#: pretix/base/templates/pretixbase/email/order_details.html
|
||||
msgid ""
|
||||
@@ -13673,7 +13611,7 @@ msgstr "Saat tämän sähköpostiviestin, koska olet tehnyt {event}tilauksen."
|
||||
#: pretix/presale/templates/pretixpresale/organizers/customer_memberships.html
|
||||
#: pretix/presale/templates/pretixpresale/organizers/customer_orders.html
|
||||
msgid "Details"
|
||||
msgstr "Yksityiskohdat"
|
||||
msgstr ""
|
||||
|
||||
#: pretix/base/templates/pretixbase/email/order_details.html
|
||||
#: pretix/presale/templates/pretixpresale/event/base.html
|
||||
|
||||
@@ -51,7 +51,6 @@ from pretix.base.forms import I18nMarkdownTextarea
|
||||
from pretix.base.models import InvoiceAddress, Order, OrderPayment, OrderRefund
|
||||
from pretix.base.payment import BasePaymentProvider
|
||||
from pretix.base.templatetags.money import money_filter
|
||||
from pretix.base.templatetags.rich_text import markdown_email_escape
|
||||
from pretix.helpers.payment import generate_payment_qr_codes
|
||||
from pretix.plugins.banktransfer.templatetags.ibanformat import ibanformat
|
||||
from pretix.presale.views.cart import cart_session
|
||||
@@ -309,7 +308,7 @@ class BankTransfer(BasePaymentProvider):
|
||||
(_("Reference"), self._code(order, force=True)),
|
||||
(_("Amount"), money_filter(payment.amount, self.event.currency)),
|
||||
)
|
||||
t += md_nl2br.join([f"**{markdown_email_escape(k)}:** {markdown_email_escape(v)}" for k, v in bankdetails])
|
||||
t += md_nl2br.join([f"**{k}:** {v}" for k, v in bankdetails])
|
||||
if self.settings.get('bank_details', as_type=LazyI18nString):
|
||||
t += md_nl2br
|
||||
t += str(self.settings.get('bank_details', as_type=LazyI18nString))
|
||||
|
||||
@@ -56,7 +56,7 @@ from pretix.base.forms.questions import guess_country
|
||||
from pretix.base.models import Event, Order, OrderPayment, OrderRefund, Quota
|
||||
from pretix.base.payment import BasePaymentProvider, PaymentException
|
||||
from pretix.base.settings import SettingsSandbox
|
||||
from pretix.helpers import LOCK_SELF_NO_KEY
|
||||
from pretix.helpers import OF_SELF
|
||||
from pretix.helpers.urls import mainreverse_absolute
|
||||
from pretix.multidomain.urlreverse import eventreverse, eventreverse_absolute
|
||||
from pretix.plugins.paypal2.client.core.environment import (
|
||||
@@ -675,7 +675,7 @@ class PaypalMethod(BasePaymentProvider):
|
||||
return False
|
||||
|
||||
def _execute_payment(self, request: HttpRequest, payment: OrderPayment):
|
||||
payment = OrderPayment.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=payment.pk)
|
||||
payment = OrderPayment.objects.select_for_update(of=OF_SELF).get(pk=payment.pk)
|
||||
if payment.state == OrderPayment.PAYMENT_STATE_CONFIRMED:
|
||||
# payment is already confirmed; possible return-view/webhook race-condition
|
||||
return
|
||||
@@ -1002,7 +1002,7 @@ class PaypalMethod(BasePaymentProvider):
|
||||
self.init_api()
|
||||
with transaction.atomic():
|
||||
# Lock payment that we are creating refund for to prevent race condition with incoming webhook
|
||||
OrderPayment.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=refund.payment_id)
|
||||
OrderPayment.objects.select_for_update(of=OF_SELF).get(pk=refund.payment_id)
|
||||
try:
|
||||
pp_payment = None
|
||||
payment_info_data = None
|
||||
|
||||
@@ -61,7 +61,7 @@ from pretix.base.payment import PaymentException
|
||||
from pretix.base.services.cart import add_payment_to_cart, get_fees
|
||||
from pretix.base.settings import GlobalSettingsObject
|
||||
from pretix.control.permissions import event_permission_required
|
||||
from pretix.helpers import LOCK_SELF_NO_KEY
|
||||
from pretix.helpers import OF_SELF
|
||||
from pretix.helpers.http import redirect_to_url
|
||||
from pretix.multidomain.urlreverse import eventreverse
|
||||
from pretix.plugins.paypal2.client.customer.partners_merchantintegrations_get_request import (
|
||||
@@ -460,7 +460,7 @@ def webhook(request, *args, **kwargs):
|
||||
|
||||
with transaction.atomic():
|
||||
# Lock payment in case a refund is currently still running
|
||||
payment = OrderPayment.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=payment.pk)
|
||||
payment = OrderPayment.objects.select_for_update(of=OF_SELF).get(pk=payment.pk)
|
||||
known_refunds = {r.info_data.get('id'): r for r in payment.refunds.all()}
|
||||
if refund['id'] not in known_refunds:
|
||||
payment.create_external_refund(
|
||||
|
||||
@@ -27,7 +27,6 @@ from decimal import Decimal
|
||||
|
||||
from django import forms
|
||||
from django.db.models import F, Sum
|
||||
from django.db.models.aggregates import Min
|
||||
from django.db.models.functions import Coalesce
|
||||
from django.utils.formats import date_format
|
||||
from django.utils.html import escape
|
||||
@@ -42,8 +41,7 @@ from reportlab.platypus import (
|
||||
|
||||
from pretix.base.exporter import BaseExporter
|
||||
from pretix.base.models import (
|
||||
GiftCardTransaction, Order, OrderFee, OrderPayment, OrderRefund,
|
||||
Transaction,
|
||||
GiftCardTransaction, OrderFee, OrderPayment, OrderRefund, Transaction,
|
||||
)
|
||||
from pretix.base.templatetags.money import money_filter, tax_rate_format
|
||||
from pretix.base.timeframes import (
|
||||
@@ -118,34 +116,25 @@ class ReportExporter(ReportlabExportMixin, BaseExporter):
|
||||
dt_start, df_end = resolve_timeframe_to_datetime_start_inclusive_end_exclusive(
|
||||
now(), form_data["date_range"], self.timezone
|
||||
)
|
||||
else:
|
||||
dt_start = Order.objects.filter(
|
||||
event__in=self.events,
|
||||
).aggregate(min_datetime=Min('datetime'))['min_datetime']
|
||||
df_end = now()
|
||||
|
||||
if dt_start:
|
||||
filters.append(
|
||||
"{label}: {value}{hint}".format(
|
||||
label=_("Begin"),
|
||||
value=date_format(
|
||||
if dt_start:
|
||||
filters.append(
|
||||
_("Begin")
|
||||
+ ": "
|
||||
+ date_format(
|
||||
dt_start.astimezone(self.timezone), "SHORT_DATETIME_FORMAT"
|
||||
),
|
||||
hint="" if form_data["date_range"] else " ({})".format(_("first order received"))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if df_end:
|
||||
filters.append(
|
||||
_("End")
|
||||
+ ": "
|
||||
+ date_format(
|
||||
(df_end - datetime.timedelta.resolution).astimezone(
|
||||
self.timezone
|
||||
),
|
||||
"SHORT_DATETIME_FORMAT",
|
||||
if df_end:
|
||||
filters.append(
|
||||
_("End")
|
||||
+ ": "
|
||||
+ date_format(
|
||||
(df_end - datetime.timedelta.resolution).astimezone(
|
||||
self.timezone
|
||||
),
|
||||
"SHORT_DATETIME_FORMAT",
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if not form_data["no_testmode"]:
|
||||
filters.append(_("Report includes test orders which may be deleted later!"))
|
||||
|
||||
@@ -55,7 +55,7 @@ from pretix.base.signals import (
|
||||
EventPluginSignal, event_copy_data, periodic_task,
|
||||
)
|
||||
from pretix.control.signals import nav_event
|
||||
from pretix.helpers import LOCK_SELF_NO_KEY
|
||||
from pretix.helpers import OF_SELF
|
||||
from pretix.plugins.sendmail.models import Rule, ScheduledMail
|
||||
from pretix.plugins.sendmail.views import OrderSendView, WaitinglistSendView
|
||||
|
||||
@@ -206,7 +206,7 @@ def sendmail_run_rules(sender, **kwargs):
|
||||
|
||||
with transaction.atomic(durable=True):
|
||||
m = ScheduledMail.objects.select_for_update(
|
||||
**LOCK_SELF_NO_KEY,
|
||||
of=OF_SELF,
|
||||
skip_locked=connection.features.has_select_for_update_skip_locked
|
||||
).filter(pk=m_id).first()
|
||||
if not m or m.state not in (ScheduledMail.STATE_SCHEDULED, ScheduledMail.STATE_FAILED):
|
||||
|
||||
@@ -72,7 +72,7 @@ from pretix.base.payment import (
|
||||
from pretix.base.plugins import get_all_plugins
|
||||
from pretix.base.settings import SettingsSandbox
|
||||
from pretix.base.views.redirect import safelink
|
||||
from pretix.helpers import LOCK_SELF_NO_KEY
|
||||
from pretix.helpers import OF_SELF
|
||||
from pretix.helpers.countries import CachedCountries
|
||||
from pretix.helpers.http import get_client_ip
|
||||
from pretix.helpers.urls import mainreverse_absolute
|
||||
@@ -753,7 +753,7 @@ class StripeMethod(BasePaymentProvider):
|
||||
self._init_api()
|
||||
|
||||
payment_info = refund.payment.info_data
|
||||
OrderPayment.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=refund.payment.pk)
|
||||
OrderPayment.objects.select_for_update(of=OF_SELF).get(pk=refund.payment.pk)
|
||||
|
||||
if not payment_info:
|
||||
raise PaymentException(_('No payment information found.'))
|
||||
|
||||
@@ -24,13 +24,14 @@ from django.urls import include, re_path
|
||||
from pretix.multidomain import event_url
|
||||
|
||||
from .views import (
|
||||
OrganizerSettingsFormView, ScaReturnView, ScaView, oauth_disconnect,
|
||||
oauth_return, webhook,
|
||||
OrganizerSettingsFormView, ReturnView, ScaReturnView, ScaView,
|
||||
oauth_disconnect, oauth_return, webhook,
|
||||
)
|
||||
|
||||
event_patterns = [
|
||||
re_path(r'^stripe/', include([
|
||||
event_url(r'^webhook/$', webhook, name='webhook', require_live=False),
|
||||
re_path(r'^return/(?P<order>[^/]+)/(?P<hash>[^/]+)/(?P<payment>[0-9]+)/$', ReturnView.as_view(), name='return'),
|
||||
re_path(r'^sca/(?P<order>[^/]+)/(?P<hash>[^/]+)/(?P<payment>[0-9]+)/$', ScaView.as_view(), name='sca'),
|
||||
re_path(r'^sca/(?P<order>[^/]+)/(?P<hash>[^/]+)/(?P<payment>[0-9]+)/return/$',
|
||||
ScaReturnView.as_view(), name='sca.return'),
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# This file is part of pretix (Community Edition).
|
||||
#
|
||||
# Copyright (C) 2014-2020 Raphael Michel and contributors
|
||||
# Copyright (C) 2020-today pretix GmbH and contributors
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
|
||||
# Public License as published by the Free Software Foundation in version 3 of the License.
|
||||
#
|
||||
# ADDITIONAL TERMS APPLY: Pursuant to Section 7 of the GNU Affero General Public License, additional terms are
|
||||
# applicable granting you additional permissions and placing additional restrictions on your usage of this software.
|
||||
# Please refer to the pretix LICENSE file to obtain the full terms applicable to this work. If you did not receive
|
||||
# this file, see <https://pretix.eu/about/en/license>.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
# details.
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
@@ -60,7 +60,7 @@ from pretix.control.permissions import (
|
||||
)
|
||||
from pretix.control.views.event import DecoupleMixin
|
||||
from pretix.control.views.organizer import OrganizerDetailViewMixin
|
||||
from pretix.helpers import LOCK_SELF_NO_KEY
|
||||
from pretix.helpers import OF_SELF
|
||||
from pretix.helpers.http import redirect_to_url
|
||||
from pretix.multidomain.urlreverse import eventreverse
|
||||
from pretix.plugins.stripe.forms import OrganizerStripeSettingsForm
|
||||
@@ -193,6 +193,10 @@ def webhook(request, *args, **kwargs):
|
||||
func = charge_webhook
|
||||
objid = event_json['data']['object']['charge']
|
||||
lookup_ids = [objid]
|
||||
elif event_json['data']['object']['object'] == "source":
|
||||
func = source_webhook
|
||||
objid = event_json['data']['object']['id']
|
||||
lookup_ids = [objid]
|
||||
elif event_json['data']['object']['object'] == "payment_intent":
|
||||
func = paymentintent_webhook
|
||||
objid = event_json['data']['object']['id']
|
||||
@@ -279,13 +283,13 @@ def charge_webhook(event, event_json, charge_id, rso):
|
||||
|
||||
with transaction.atomic():
|
||||
if payment:
|
||||
payment = OrderPayment.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=payment.pk)
|
||||
payment = OrderPayment.objects.select_for_update(of=OF_SELF).get(pk=payment.pk)
|
||||
else:
|
||||
payment = order.payments.filter(
|
||||
info__icontains=charge['id'],
|
||||
provider__startswith='stripe',
|
||||
amount=prov._amount_to_decimal(charge['amount']),
|
||||
).select_for_update(**LOCK_SELF_NO_KEY).last()
|
||||
).select_for_update(of=OF_SELF).last()
|
||||
if not payment:
|
||||
payment = order.payments.create(
|
||||
state=OrderPayment.PAYMENT_STATE_CREATED,
|
||||
@@ -346,6 +350,79 @@ def charge_webhook(event, event_json, charge_id, rso):
|
||||
return HttpResponse(status=200)
|
||||
|
||||
|
||||
def source_webhook(event, event_json, source_id, rso):
|
||||
import stripe
|
||||
|
||||
from pretix.plugins.stripe.payment import StripeCC
|
||||
|
||||
prov = StripeCC(event)
|
||||
prov._init_api()
|
||||
try:
|
||||
src = stripe.Source.retrieve(source_id, **prov.api_kwargs)
|
||||
except stripe.error.StripeError:
|
||||
logger.exception('Stripe error on webhook. Event data: %s' % str(event_json))
|
||||
return HttpResponse('Charge not found', status=500)
|
||||
|
||||
metadata = src['metadata']
|
||||
if 'event' not in metadata:
|
||||
return HttpResponse('Event not given in charge metadata', status=200)
|
||||
|
||||
if int(metadata['event']) != event.pk:
|
||||
return HttpResponse('Not interested in this event', status=200)
|
||||
|
||||
with transaction.atomic():
|
||||
if rso and rso.payment:
|
||||
order = rso.payment.order
|
||||
payment = rso.payment
|
||||
elif rso:
|
||||
order = rso.order
|
||||
payment = None
|
||||
else:
|
||||
try:
|
||||
order = event.orders.get(id=metadata['order'])
|
||||
except Order.DoesNotExist:
|
||||
return HttpResponse('Order not found', status=200)
|
||||
payment = None
|
||||
|
||||
if payment:
|
||||
payment = OrderPayment.objects.select_for_update(of=OF_SELF).get(pk=payment.pk)
|
||||
else:
|
||||
payment = order.payments.filter(
|
||||
info__icontains=src['id'],
|
||||
provider__startswith='stripe',
|
||||
amount=prov._amount_to_decimal(src['amount']) if src['amount'] is not None else order.total,
|
||||
).select_for_update(of=OF_SELF).last()
|
||||
if not payment:
|
||||
payment = order.payments.create(
|
||||
state=OrderPayment.PAYMENT_STATE_CREATED,
|
||||
provider=SOURCE_TYPES.get(src['type'], 'stripe'),
|
||||
amount=prov._amount_to_decimal(src['amount']) if src['amount'] is not None else order.total,
|
||||
info=str(src),
|
||||
)
|
||||
|
||||
if payment.provider != prov.identifier:
|
||||
prov = payment.payment_provider
|
||||
prov._init_api()
|
||||
|
||||
order.log_action('pretix.plugins.stripe.event', data=event_json)
|
||||
go = (event_json['type'] == 'source.chargeable' and
|
||||
payment.state in (OrderPayment.PAYMENT_STATE_PENDING, OrderPayment.PAYMENT_STATE_CREATED) and
|
||||
src.status == 'chargeable')
|
||||
if go:
|
||||
try:
|
||||
prov._charge_source(None, source_id, payment)
|
||||
except PaymentException:
|
||||
logger.exception('Webhook error')
|
||||
elif src.status == 'failed':
|
||||
payment.fail(info=str(src))
|
||||
elif src.status == 'canceled' and payment.state in (OrderPayment.PAYMENT_STATE_PENDING, OrderPayment.PAYMENT_STATE_CREATED):
|
||||
payment.info = str(src)
|
||||
payment.state = OrderPayment.PAYMENT_STATE_CANCELED
|
||||
payment.save()
|
||||
|
||||
return HttpResponse(status=200)
|
||||
|
||||
|
||||
def paymentintent_webhook(event, event_json, paymentintent_id, rso):
|
||||
import stripe
|
||||
|
||||
@@ -419,6 +496,59 @@ class StripeOrderView:
|
||||
}) + ('?paid=yes' if self.order.status == Order.STATUS_PAID else ''))
|
||||
|
||||
|
||||
@method_decorator(xframe_options_exempt, 'dispatch')
|
||||
class ReturnView(StripeOrderView, View):
|
||||
def get(self, request, *args, **kwargs):
|
||||
import stripe
|
||||
|
||||
prov = self.pprov
|
||||
prov._init_api()
|
||||
try:
|
||||
src = stripe.Source.retrieve(request.GET.get('source'), **prov.api_kwargs)
|
||||
except stripe.error.InvalidRequestError:
|
||||
logger.exception('Could not retrieve source')
|
||||
messages.error(self.request, _('Sorry, there was an error in the payment process. Please check the link '
|
||||
'in your emails to continue.'))
|
||||
return redirect_to_url(eventreverse(self.request.event, 'presale:event.index'))
|
||||
|
||||
if src.client_secret != request.GET.get('client_secret'):
|
||||
messages.error(self.request, _('Sorry, there was an error in the payment process. Please check the link '
|
||||
'in your emails to continue.'))
|
||||
return redirect_to_url(eventreverse(self.request.event, 'presale:event.index'))
|
||||
|
||||
with transaction.atomic():
|
||||
self.order.refresh_from_db()
|
||||
self.payment = OrderPayment.objects.select_for_update(of=OF_SELF).get(pk=self.payment.pk)
|
||||
if self.payment.state == OrderPayment.PAYMENT_STATE_CONFIRMED:
|
||||
if 'payment_stripe_token' in request.session:
|
||||
del request.session['payment_stripe_token']
|
||||
return self._redirect_to_order()
|
||||
|
||||
if src.status == 'chargeable':
|
||||
try:
|
||||
prov._charge_source(request, src.id, self.payment)
|
||||
except PaymentException as e:
|
||||
messages.error(request, str(e))
|
||||
return self._redirect_to_order()
|
||||
finally:
|
||||
if 'payment_stripe_token' in request.session:
|
||||
del request.session['payment_stripe_token']
|
||||
elif src.status == 'consumed':
|
||||
# Webhook was faster, wow! ;)
|
||||
if 'payment_stripe_token' in request.session:
|
||||
del request.session['payment_stripe_token']
|
||||
return self._redirect_to_order()
|
||||
elif src.status == 'pending':
|
||||
self.payment.state = OrderPayment.PAYMENT_STATE_PENDING
|
||||
self.payment.info = str(src)
|
||||
self.payment.save()
|
||||
else: # failed or canceled
|
||||
self.payment.fail(info=str(src))
|
||||
messages.error(self.request, _('We had trouble authorizing your card payment. Please try again and '
|
||||
'get in touch with us if this problem persists.'))
|
||||
return self._redirect_to_order()
|
||||
|
||||
|
||||
@method_decorator(xframe_options_exempt, 'dispatch')
|
||||
class ScaView(StripeOrderView, View):
|
||||
|
||||
|
||||
@@ -267,7 +267,7 @@ class CustomerStep(CartMixin, TemplateFlowStep):
|
||||
else None
|
||||
),
|
||||
prefix='login',
|
||||
request=self.request,
|
||||
request=self.request.event,
|
||||
)
|
||||
for field in f.fields.values():
|
||||
field._show_required = field.required
|
||||
|
||||
@@ -75,7 +75,6 @@ class AuthenticationForm(forms.Form):
|
||||
'unverified': _("You have not yet activated your account and set a password. Please click the link in the "
|
||||
"email we sent you. In case you cannot find it, click \"Forgot your password?\" to receive "
|
||||
"a new email."),
|
||||
'rate_limit': _("For security reasons, please wait 5 minutes before you try again."),
|
||||
}
|
||||
|
||||
def __init__(self, request=None, *args, **kwargs):
|
||||
@@ -94,12 +93,6 @@ class AuthenticationForm(forms.Form):
|
||||
email = self.cleaned_data.get('email')
|
||||
password = self.cleaned_data.get('password')
|
||||
|
||||
if rate_limit("customer_login", include_ip_from_request=self.request, max_num=10, expire_time=300):
|
||||
raise forms.ValidationError(
|
||||
self.error_messages['rate_limit'],
|
||||
code='rate_limit',
|
||||
)
|
||||
|
||||
if email is not None and password:
|
||||
try:
|
||||
u = self.request.organizer.customers.get(email=email.lower(), provider__isnull=True)
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
{% else %}
|
||||
<meta property="og:url" content="{% abseventurl request.event "presale:event.index" %}" />
|
||||
{% endif %}
|
||||
<script type="text/javascript" src="{% static "pretixpresale/js/csrfcookieretry.js" %}"></script>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
|
||||
@@ -23,6 +23,10 @@
|
||||
{% endif %}
|
||||
{% trans "Order details" %}
|
||||
{% endblock %}
|
||||
{% block custom_header %}
|
||||
{{ block.super }}
|
||||
<script type="text/javascript" src="{% static "pretixpresale/js/csrfcookieretry.js" %}"></script>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
{% if "thanks" in request.GET or "paid" in request.GET %}
|
||||
<div class="thank-you">
|
||||
|
||||
@@ -23,5 +23,4 @@
|
||||
<script type="text/javascript" src="{% static "pretixbase/js/addressform.js" %}"></script>
|
||||
<script type="text/javascript" src="{% static "pretixbase/js/deanonymize_email.js" %}"></script>
|
||||
<script type="text/javascript" src="{% static "pretixbase/js/errors.js" %}"></script>
|
||||
<script type="text/javascript" src="{% static "pretixbase/js/csrfcookieretry.js" %}"></script>
|
||||
{% endcompress %}
|
||||
@@ -83,7 +83,7 @@ class CheckoutView(View):
|
||||
return self.redirect(previous_step.get_step_url(request) if previous_step else self.get_index_url(request))
|
||||
|
||||
if 'step' not in kwargs:
|
||||
utm_params = {k: v for k, v in request.GET.items() if k.startswith("utm_") or k == "gclid" or k == "_gl"}
|
||||
utm_params = {k: v for k, v in request.GET.items() if k.startswith("utm_")}
|
||||
return self.redirect(step.get_step_url(request) + '?' + urlencode(utm_params))
|
||||
is_selected = (step.identifier == kwargs.get('step', ''))
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ from pretix.base.models import Customer, InvoiceAddress, Order, OrderPosition
|
||||
from pretix.base.services.mail import mail
|
||||
from pretix.base.settings import PERSON_NAME_SCHEMES
|
||||
from pretix.base.signals import customer_created, customer_signed_in
|
||||
from pretix.helpers import LOCK_SELF_NO_KEY
|
||||
from pretix.helpers import OF_SELF
|
||||
from pretix.helpers.compat import CompatDeleteView
|
||||
from pretix.helpers.http import redirect_to_url
|
||||
from pretix.multidomain.models import KnownDomain
|
||||
@@ -280,7 +280,7 @@ class SetPasswordView(FormView):
|
||||
def form_valid(self, form):
|
||||
with transaction.atomic():
|
||||
# Re-check token in transaction to prevent race condition
|
||||
self.customer = Customer.objects.select_for_update(**LOCK_SELF_NO_KEY).get(pk=self.customer.pk)
|
||||
self.customer = Customer.objects.select_for_update(of=OF_SELF).get(pk=self.customer.pk)
|
||||
if not TokenGenerator().check_token(self.customer, self.request.GET.get('token', '')):
|
||||
return HttpResponseRedirect(self.get_success_url())
|
||||
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const COOKIE_NAME = window.location.protocol === 'https:' ? '__Host-pretix_csrftoken' : 'pretix_csrftoken'
|
||||
const RELOAD_FLAG = 'csrfReloadPerformed'
|
||||
const REASON_PARAM = 'csrf_reload'
|
||||
const CHARS = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
|
||||
|
||||
// reimplementation of CSRFMiddlewares _unmask_cipher_token()
|
||||
const unmask = (token) => {
|
||||
if (!token || token.length !== 64) return token || null
|
||||
let secret = ''
|
||||
for (let i = 0; i < 32; i++) {
|
||||
const m = CHARS.indexOf(token[i])
|
||||
const c = CHARS.indexOf(token[32 + i])
|
||||
if (m < 0 || c < 0) return null
|
||||
secret += CHARS[(c - m + CHARS.length) % CHARS.length]
|
||||
}
|
||||
return secret
|
||||
}
|
||||
|
||||
const url = new URL(location.href)
|
||||
// remove reason after reload to avoid re-reports
|
||||
if (url.searchParams.has(REASON_PARAM)) {
|
||||
url.searchParams.delete(REASON_PARAM)
|
||||
history.replaceState(history.state, '', url)
|
||||
}
|
||||
|
||||
const readCookieSecrets = () => document.cookie
|
||||
.split('; ')
|
||||
.filter((c) => c.startsWith(COOKIE_NAME + '='))
|
||||
.map((c) => unmask(c.slice(COOKIE_NAME.length + 1)))
|
||||
|
||||
// a deletion only hits the variant whose attributes it matches
|
||||
const EXPIRE = `${COOKIE_NAME}=; Path=/; Secure; Max-Age=0`
|
||||
const deleteUnpartitioned = () => {
|
||||
document.cookie = EXPIRE
|
||||
}
|
||||
const deletePartitioned = () => {
|
||||
document.cookie = `${EXPIRE}; Partitioned`
|
||||
}
|
||||
|
||||
const field = document.querySelector('input[name="csrfmiddlewaretoken"]')
|
||||
const pageSecret = field ? unmask(field.value) : null
|
||||
// bail if there is no pageSecret
|
||||
if (!pageSecret) return
|
||||
|
||||
const check = (secrets) => {
|
||||
if (secrets.length === 0) return 'no_cookie'
|
||||
if (secrets.length > 1) return 'duplicate_cookie'
|
||||
if (!secrets[0]) return 'invalid_cookie'
|
||||
if (pageSecret !== null && pageSecret !== secrets[0]) return 'mismatch'
|
||||
return null
|
||||
}
|
||||
|
||||
let cookieSecrets = readCookieSecrets()
|
||||
let reason = check(cookieSecrets)
|
||||
if (reason === 'duplicate_cookie') {
|
||||
// drop the unpartitioned cookie, keep the partitioned one, maybe this fixes all issues
|
||||
deleteUnpartitioned()
|
||||
cookieSecrets = readCookieSecrets()
|
||||
if (check(cookieSecrets)) {
|
||||
reason = 'duplicate_cookie'
|
||||
} else {
|
||||
reason = null
|
||||
}
|
||||
}
|
||||
|
||||
if (reason && !sessionStorage.getItem(RELOAD_FLAG)) {
|
||||
sessionStorage.setItem(RELOAD_FLAG, '1')
|
||||
deleteUnpartitioned()
|
||||
deletePartitioned()
|
||||
url.searchParams.set(REASON_PARAM, reason)
|
||||
location.href = url.href
|
||||
} else if (!reason && sessionStorage.getItem(RELOAD_FLAG)) {
|
||||
sessionStorage.removeItem(RELOAD_FLAG)
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,15 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const COOKIE_NAME = '__Host-pretix_csrftoken'
|
||||
const RELOAD_FLAG = 'csrfReloadPerformed'
|
||||
|
||||
const hasCookie = document.cookie
|
||||
.split('; ')
|
||||
.some((c) => c.startsWith(COOKIE_NAME + '='))
|
||||
|
||||
if (!hasCookie && !sessionStorage.getItem(RELOAD_FLAG)) {
|
||||
sessionStorage.setItem(RELOAD_FLAG, '1')
|
||||
location.reload()
|
||||
} else if (hasCookie && sessionStorage.getItem(RELOAD_FLAG)) {
|
||||
sessionStorage.removeItem(RELOAD_FLAG)
|
||||
}
|
||||
})
|
||||
@@ -152,9 +152,12 @@ export function createWidgetStore (config: {
|
||||
return ''
|
||||
},
|
||||
additionalURLParams (): string {
|
||||
if (!window.location.search.includes('utm_')) {
|
||||
return ''
|
||||
}
|
||||
const params = new URLSearchParams(window.location.search)
|
||||
for (const [key] of params.entries()) {
|
||||
if (!key.startsWith('utm_') || key !== 'gclid' || key !== '_gl') {
|
||||
if (!key.startsWith('utm_')) {
|
||||
params.delete(key)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -469,22 +469,6 @@ def test_event_scheduled_export_update_token(token_client, organizer, event, use
|
||||
assert created.export_form_data == {"_format": "xlsx", "date_range": "month_this", "items": []}
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_event_scheduled_export_update_identifier_readonly(token_client, organizer, event, user, event_scheduled_export):
|
||||
resp = token_client.patch(
|
||||
'/api/v1/organizers/{}/events/{}/scheduled_exports/{}/'.format(
|
||||
organizer.slug, event.slug, event_scheduled_export.pk,
|
||||
),
|
||||
data={
|
||||
"export_identifier": "transactions",
|
||||
"export_form_data": {"_format": "xlsx", "date_range": "month_this"},
|
||||
},
|
||||
format='json'
|
||||
)
|
||||
assert resp.status_code == 400
|
||||
assert resp.data == {"export_identifier": ["export_identifier cannot be changed for existing exports."]}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def org_scheduled_export(organizer, user):
|
||||
e = organizer.scheduled_exports.create(
|
||||
@@ -653,23 +637,6 @@ def test_org_scheduled_export_update_token(token_client, organizer, user, org_sc
|
||||
assert created.timezone == "America/New_York"
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_org_scheduled_export_update_identifier_readonly(token_client, organizer, user, org_scheduled_export):
|
||||
resp = token_client.patch(
|
||||
'/api/v1/organizers/{}/scheduled_exports/{}/'.format(
|
||||
organizer.slug, org_scheduled_export.pk,
|
||||
),
|
||||
data={
|
||||
"export_identifier": "transactions",
|
||||
"export_form_data": {"_format": "xlsx", "date_range": "month_this"},
|
||||
"timezone": "America/New_York"
|
||||
},
|
||||
format='json'
|
||||
)
|
||||
assert resp.status_code == 400
|
||||
assert resp.data == {"export_identifier": ["export_identifier cannot be changed for existing exports."]}
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_org_scheduled_export_validate_identifier(user_client, organizer, user):
|
||||
resp = user_client.post(
|
||||
@@ -1045,87 +1012,6 @@ def _get_and_patch_event_export(client, scheduled, can_see=True, can_edit=True):
|
||||
return True
|
||||
|
||||
|
||||
@pytest.mark.django_db(transaction=True)
|
||||
def test_organizer_edit_restrictions_event_expansion(client, event, organizer, user, team):
|
||||
# This tests the prevention of a possible privilege escalation where user A creates a scheduled export and
|
||||
# user B has settings permission (= they can see the export configuration), and enough permission
|
||||
# to run the export themselves, but not enough permission to add events. Without this check, user B could
|
||||
# modify the export and add themselves as a recipient. Thereby, user B would gain access to data they can't have.
|
||||
user1_client = APIClient()
|
||||
user1_client.force_authenticate(user=user)
|
||||
user2 = User.objects.create_user("dummy2@dummy.dummy", "dummy")
|
||||
user2_client = APIClient()
|
||||
user2_client.force_authenticate(user=user2)
|
||||
|
||||
event1 = event
|
||||
event2 = Event.objects.create(
|
||||
organizer=organizer, name="Dummy", slug="dummy2",
|
||||
date_from=now(), plugins="pretix.plugins.banktransfer,pretix.plugins.stripe,tests.testdummy"
|
||||
)
|
||||
|
||||
# Team 1 has access only to one event
|
||||
team1 = team
|
||||
team1.all_organizer_permissions = False
|
||||
team1.all_event_permissions = False
|
||||
team1.all_events = False
|
||||
team1.limit_organizer_permissions = {"organizer.settings.general:write": True}
|
||||
team1.limit_event_permissions = {"event.orders:read": True, "event.settings.general:write": True}
|
||||
team1.save()
|
||||
team1.limit_events.add(event1)
|
||||
team1.members.add(user)
|
||||
|
||||
# Team 2 has full admin access
|
||||
team2 = organizer.teams.create(
|
||||
all_organizer_permissions=True, all_event_permissions=True, all_events=True,
|
||||
)
|
||||
team2.members.add(user2)
|
||||
|
||||
s1 = ScheduledOrganizerExport.objects.create(
|
||||
organizer=organizer,
|
||||
owner=user2,
|
||||
export_identifier="dummy_orders",
|
||||
export_form_data={"all_events": False, "events": [event1.pk]},
|
||||
mail_subject="Test",
|
||||
mail_template="Test",
|
||||
locale="en",
|
||||
schedule_rrule="DTSTART:20230118T000000\nRRULE:FREQ=DAILY;INTERVAL=1;WKST=MO",
|
||||
schedule_rrule_time=time(2, 30, 0)
|
||||
)
|
||||
# User 1 can change …
|
||||
response = user1_client.patch(
|
||||
'/api/v1/organizers/{}/scheduled_exports/{}/'.format("dummy", s1.pk),
|
||||
data={"mail_subject": "Hello"},
|
||||
format='json',
|
||||
)
|
||||
assert response.status_code == 200
|
||||
# … but not expand scope
|
||||
response = user1_client.patch(
|
||||
'/api/v1/organizers/{}/scheduled_exports/{}/'.format("dummy", s1.pk),
|
||||
data={"export_form_data": {"all_events": False, "events": [event1.slug, event2.slug], "_format": "xlsx", "date_range": "year_this", "items": []}},
|
||||
format='json',
|
||||
)
|
||||
assert response.status_code == 400
|
||||
response = user1_client.patch(
|
||||
'/api/v1/organizers/{}/scheduled_exports/{}/'.format("dummy", s1.pk),
|
||||
data={"export_form_data": {"all_events": True, "events": [], "_format": "xlsx", "date_range": "year_this", "items": []}},
|
||||
format='json',
|
||||
)
|
||||
assert response.status_code == 403
|
||||
# User 2 can expand
|
||||
response = user2_client.patch(
|
||||
'/api/v1/organizers/{}/scheduled_exports/{}/'.format("dummy", s1.pk),
|
||||
data={"export_form_data": {"all_events": True, "events": [], "_format": "xlsx", "date_range": "year_this", "items": []}},
|
||||
format='json',
|
||||
)
|
||||
assert response.status_code == 200
|
||||
response = user2_client.patch(
|
||||
'/api/v1/organizers/{}/scheduled_exports/{}/'.format("dummy", s1.pk),
|
||||
data={"export_form_data": {"all_events": False, "events": [event1.slug, event2.slug], "_format": "xlsx", "date_range": "year_this", "items": []}},
|
||||
format='json',
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
||||
|
||||
@pytest.mark.django_db(transaction=True)
|
||||
def test_event_edit_restrictions(client, event, organizer, user, team):
|
||||
# This tests the prevention of a possible privilege escalation where user A creates a scheduled export and
|
||||
|
||||
@@ -872,51 +872,6 @@ def test_item_create_with_addon(token_client, organizer, event, item, category,
|
||||
with scopes_disabled():
|
||||
assert 2 == Item.objects.all().count()
|
||||
|
||||
resp = token_client.post(
|
||||
'/api/v1/organizers/{}/events/{}/items/'.format(organizer.slug, event.slug),
|
||||
{
|
||||
"category": category.pk,
|
||||
"name": {
|
||||
"en": "Ticket"
|
||||
},
|
||||
"active": True,
|
||||
"description": None,
|
||||
"default_price": "23.00",
|
||||
"free_price": False,
|
||||
"tax_rate": "19.00",
|
||||
"tax_rule": taxrule.pk,
|
||||
"admission": True,
|
||||
"issue_giftcard": False,
|
||||
"position": 0,
|
||||
"picture": None,
|
||||
"available_from": None,
|
||||
"available_until": None,
|
||||
"require_voucher": False,
|
||||
"hide_without_voucher": False,
|
||||
"allow_cancel": True,
|
||||
"min_per_order": None,
|
||||
"max_per_order": None,
|
||||
"checkin_attention": False,
|
||||
"checkin_text": None,
|
||||
"has_variations": True,
|
||||
"addons": [
|
||||
{
|
||||
"addon_category": category.pk,
|
||||
"min_count": 0,
|
||||
"max_count": 0,
|
||||
"position": 0,
|
||||
"multi_allowed": False,
|
||||
"price_included": True
|
||||
}
|
||||
]
|
||||
},
|
||||
format='json'
|
||||
)
|
||||
assert resp.status_code == 400
|
||||
assert resp.content.decode() == '{"addons":["The maximum count needs to be greater than zero."]}'
|
||||
with scopes_disabled():
|
||||
assert 2 == Item.objects.all().count()
|
||||
|
||||
resp = token_client.post(
|
||||
'/api/v1/organizers/{}/events/{}/items/'.format(organizer.slug, event.slug),
|
||||
{
|
||||
@@ -1143,48 +1098,6 @@ def test_item_create_with_bundle(token_client, organizer, event, item, category,
|
||||
)
|
||||
assert resp.status_code == 400
|
||||
assert resp.content.decode() == '{"bundles":["The chosen variation does not belong to this item."]}'
|
||||
with scopes_disabled():
|
||||
v = item2.variations.create(value="foo")
|
||||
|
||||
resp = token_client.post(
|
||||
'/api/v1/organizers/{}/events/{}/items/'.format(organizer.slug, event.slug),
|
||||
{
|
||||
"category": category.pk,
|
||||
"name": {
|
||||
"en": "Ticket"
|
||||
},
|
||||
"active": True,
|
||||
"description": None,
|
||||
"default_price": "23.00",
|
||||
"free_price": False,
|
||||
"tax_rate": "19.00",
|
||||
"tax_rule": taxrule.pk,
|
||||
"admission": True,
|
||||
"position": 0,
|
||||
"picture": None,
|
||||
"available_from": None,
|
||||
"available_until": None,
|
||||
"require_voucher": False,
|
||||
"hide_without_voucher": False,
|
||||
"allow_cancel": True,
|
||||
"min_per_order": None,
|
||||
"max_per_order": None,
|
||||
"checkin_attention": False,
|
||||
"checkin_text": None,
|
||||
"has_variations": True,
|
||||
"bundles": [
|
||||
{
|
||||
"bundled_item": item.pk,
|
||||
"bundled_variation": None,
|
||||
"count": 0,
|
||||
"designated_price": "3.00",
|
||||
}
|
||||
]
|
||||
},
|
||||
format='json'
|
||||
)
|
||||
assert resp.status_code == 400
|
||||
assert resp.content.decode() == '{"bundles":["The count needs to be greater than zero."]}'
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
|
||||
@@ -696,7 +696,7 @@ def test_medium_autocreate_giftcard(token_client, organizer, team):
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_medium_lookup_cross_organizer(token_client, organizer, customer, organizer2, org2_event, medium2, giftcard2):
|
||||
def test_medium_lookup_cross_organizer(token_client, organizer, organizer2, org2_event, medium2, giftcard2):
|
||||
with scopes_disabled():
|
||||
o = Order.objects.create(
|
||||
code='FOO', event=org2_event, email='dummy@dummy.test',
|
||||
@@ -708,12 +708,7 @@ def test_medium_lookup_cross_organizer(token_client, organizer, customer, organi
|
||||
personalized=True)
|
||||
op = o.positions.create(item=ticket, price=Decimal("14"))
|
||||
medium2.linked_orderpositions.add(op)
|
||||
medium2.customer = customer
|
||||
medium2.linked_giftcard = giftcard2
|
||||
medium2.claim_token = "1234"
|
||||
medium2.info = {"foo": "bar"}
|
||||
medium2.notes = "Internal notes"
|
||||
medium2.label = "Max Muster"
|
||||
medium2.save()
|
||||
|
||||
resp = token_client.post(
|
||||
@@ -760,9 +755,3 @@ def test_medium_lookup_cross_organizer(token_client, organizer, customer, organi
|
||||
assert resp.data["result"]["organizer"] == "partner"
|
||||
assert resp.data["result"]["linked_giftcard"] is not None
|
||||
assert resp.data["result"]["linked_orderposition"] is None
|
||||
assert resp.data["result"]["linked_orderpositions"] == []
|
||||
assert resp.data["result"]["customer"] is None
|
||||
assert resp.data["result"]["info"] == {}
|
||||
assert resp.data["result"]["notes"] is None
|
||||
assert resp.data["result"]["claim_token"] is None
|
||||
assert resp.data["result"]["label"] is None
|
||||
@@ -506,99 +506,6 @@ def test_organizer_edit_restrictions(client, env):
|
||||
assert _can_see_but_not_edit_org_export(client, user1, s2)
|
||||
|
||||
|
||||
def _patch_org_export(client, user, scheduled, data):
|
||||
client.login(email=user.email, password="dummy")
|
||||
|
||||
response = client.get("/control/organizer/dummy/export/")
|
||||
assert f"export/{scheduled.pk}/delete".encode() in response.content
|
||||
response = client.get(f"/control/organizer/dummy/export/?identifier={scheduled.export_identifier}&scheduled={scheduled.pk}")
|
||||
if response.status_code == 404:
|
||||
return False
|
||||
|
||||
assert response.status_code == 200
|
||||
doc = BeautifulSoup(response.content, "lxml")
|
||||
form_data = extract_form_fields(doc.select("form[data-asynctask]")[0])
|
||||
form_data["schedule"] = "save"
|
||||
for k, v in data.items():
|
||||
if v is None:
|
||||
form_data.pop(k, None)
|
||||
else:
|
||||
form_data[k] = v
|
||||
|
||||
response = client.post(f"/control/organizer/dummy/export/?identifier={scheduled.export_identifier}&scheduled={scheduled.pk}",
|
||||
data=form_data, follow=True)
|
||||
assert response.status_code == 200
|
||||
|
||||
return b"alert-success" in response.content and b"therefore you cannot" not in response.content
|
||||
|
||||
|
||||
@pytest.mark.django_db(transaction=True)
|
||||
def test_organizer_edit_restrictions_event_expansion(client, env):
|
||||
# This tests the prevention of a possible privilege escalation where user A creates a scheduled export and
|
||||
# user B has settings permission (= they can see the export configuration), and enough permission
|
||||
# to run the export themselves, but not enough permission to add events. Without this check, user B could
|
||||
# modify the export and add themselves as a recipient. Thereby, user B would gain access to data they can't have.
|
||||
user = env[1]
|
||||
user2 = User.objects.create_user("dummy2@dummy.dummy", "dummy")
|
||||
event1 = env[0]
|
||||
event2 = Event.objects.create(
|
||||
organizer=env[0].organizer, name="Dummy", slug="dummy2",
|
||||
date_from=now(), plugins="pretix.plugins.banktransfer,pretix.plugins.stripe,tests.testdummy"
|
||||
)
|
||||
|
||||
# Team 1 has access only to one event
|
||||
team1 = env[2]
|
||||
team1.all_organizer_permissions = False
|
||||
team1.all_event_permissions = False
|
||||
team1.all_events = False
|
||||
team1.limit_organizer_permissions = {"organizer.settings.general:write": True}
|
||||
team1.limit_event_permissions = {"event.orders:read": True, "event.settings.general:write": True}
|
||||
team1.save()
|
||||
team1.limit_events.add(event1)
|
||||
team1.members.add(user)
|
||||
|
||||
# Team 2 has full admin access
|
||||
team2 = env[0].organizer.teams.create(
|
||||
all_organizer_permissions=True, all_event_permissions=True, all_events=True,
|
||||
)
|
||||
team2.members.add(user2)
|
||||
|
||||
s1 = ScheduledOrganizerExport.objects.create(
|
||||
organizer=env[0].organizer,
|
||||
owner=user2,
|
||||
export_identifier="dummy_orders",
|
||||
export_form_data={"all_events": False, "events": [event1.pk]},
|
||||
mail_subject="Test",
|
||||
mail_template="Test",
|
||||
locale="en",
|
||||
schedule_rrule="DTSTART:20230118T000000\nRRULE:FREQ=DAILY;INTERVAL=1;WKST=MO",
|
||||
schedule_rrule_time=datetime.time(2, 30, 0)
|
||||
)
|
||||
# User 1 can change …
|
||||
assert _patch_org_export(
|
||||
client, user, s1,
|
||||
{"schedule-mail_subject": "Hello"},
|
||||
)
|
||||
# … but not expand scope
|
||||
assert not _patch_org_export(
|
||||
client, user, s1,
|
||||
{"dummy_orders-events": [event1.pk, event2.pk]},
|
||||
)
|
||||
assert not _patch_org_export(
|
||||
client, user, s1,
|
||||
{"dummy_orders-all_events": "on", "dummy_orders-events": None},
|
||||
)
|
||||
# User 2 can expand
|
||||
assert _patch_org_export(
|
||||
client, user2, s1,
|
||||
{"dummy_orders-all_events": "on", "dummy_orders-events": None},
|
||||
)
|
||||
assert _patch_org_export(
|
||||
client, user2, s1,
|
||||
{"dummy_orders-events": [event1.pk, event2.pk]},
|
||||
)
|
||||
|
||||
|
||||
def _can_see_but_not_edit_event_export(client, user, scheduled):
|
||||
client.login(email=user.email, password="dummy")
|
||||
|
||||
|
||||
Reference in new issue
Block a user