From abda800953b087ef492f4de0e6613888a9ba005d Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Mon, 16 Oct 2023 12:35:20 +0200 Subject: [PATCH] Do not treat event as free if there are mandatory non-free addons (#3646) --- src/pretix/presale/views/cart.py | 5 +++-- src/pretix/presale/views/event.py | 5 +++-- src/pretix/static/pretixpresale/js/widget/widget.js | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/pretix/presale/views/cart.py b/src/pretix/presale/views/cart.py index d581f74c5..6a3fff475 100644 --- a/src/pretix/presale/views/cart.py +++ b/src/pretix/presale/views/cart.py @@ -571,12 +571,13 @@ class RedeemView(NoSearchIndexViewMixin, EventViewMixin, CartMixin, TemplateView for item in items]) context['allfree'] = all( - item.display_price.gross == Decimal('0.00') for item in items if not item.has_variations + item.display_price.gross == Decimal('0.00') and not item.mandatory_priced_addons + for item in items if not item.has_variations ) and all( all( var.display_price.gross == Decimal('0.00') for var in item.available_variations - ) + ) and not item.mandatory_priced_addons for item in items if item.has_variations ) diff --git a/src/pretix/presale/views/event.py b/src/pretix/presale/views/event.py index 72ee39952..3e45a3840 100644 --- a/src/pretix/presale/views/event.py +++ b/src/pretix/presale/views/event.py @@ -516,12 +516,13 @@ class EventIndex(EventViewMixin, EventListMixin, CartMixin, TemplateView): items = [i for i in items if not i.requires_seat] context['itemnum'] = len(items) context['allfree'] = all( - item.display_price.gross == Decimal('0.00') for item in items if not item.has_variations + item.display_price.gross == Decimal('0.00') and not item.mandatory_priced_addons + for item in items if not item.has_variations ) and all( all( var.display_price.gross == Decimal('0.00') for var in item.available_variations - ) + ) and not item.mandatory_priced_addons for item in items if item.has_variations ) diff --git a/src/pretix/static/pretixpresale/js/widget/widget.js b/src/pretix/static/pretixpresale/js/widget/widget.js index ae11c00d4..63f05d626 100644 --- a/src/pretix/static/pretixpresale/js/widget/widget.js +++ b/src/pretix/static/pretixpresale/js/widget/widget.js @@ -1020,7 +1020,7 @@ Vue.component('pretix-widget-event-form', { break; } } - if (item.variations.length === 0 && item.price.gross !== "0.00") { + if ((item.variations.length === 0 && item.price.gross !== "0.00") || item.mandatory_priced_addons) { all_free = false; break; }