diff --git a/doc/development/api/ticketoutput.rst b/doc/development/api/ticketoutput.rst index 73927fc17..a9cfdbe1a 100644 --- a/doc/development/api/ticketoutput.rst +++ b/doc/development/api/ticketoutput.rst @@ -58,6 +58,8 @@ The output class .. autoattribute:: is_enabled + .. autoattribute:: multi_download_enabled + .. autoattribute:: settings_form_fields .. automethod:: settings_content_render diff --git a/src/pretix/base/ticketoutput.py b/src/pretix/base/ticketoutput.py index eca309f23..daa0a4e15 100644 --- a/src/pretix/base/ticketoutput.py +++ b/src/pretix/base/ticketoutput.py @@ -32,6 +32,14 @@ class BaseTicketOutput: """ return self.settings.get('_enabled', as_type=bool) + @property + def multi_download_enabled(self) -> bool: + """ + Returns whether or not the ``generate_order`` method may be called. Returns + ``True`` by default. + """ + return True + def generate(self, position: OrderPosition) -> Tuple[str, str, str]: """ This method should generate the download file and return a tuple consisting of a diff --git a/src/pretix/presale/templates/pretixpresale/event/order.html b/src/pretix/presale/templates/pretixpresale/event/order.html index 05696d5f0..c401904da 100644 --- a/src/pretix/presale/templates/pretixpresale/event/order.html +++ b/src/pretix/presale/templates/pretixpresale/event/order.html @@ -73,14 +73,16 @@ You can download your tickets using the buttons below. Please have your ticket ready when entering the event. {% endblocktrans %} - {% if cart.positions|length > 1 %} + {% if cart.positions|length > 1 and can_download_multi %}

{% trans "Download all tickets at once:" %} {% for b in download_buttons %} - - {{ b.text }} - + {% if b.multi %} + + {{ b.text }} + + {% endif %} {% endfor %}

{% endif %} diff --git a/src/pretix/presale/views/order.py b/src/pretix/presale/views/order.py index 2002fd584..bac26cfc6 100644 --- a/src/pretix/presale/views/order.py +++ b/src/pretix/presale/views/order.py @@ -76,6 +76,7 @@ class OrderDetails(EventViewMixin, OrderDetailMixin, CartMixin, TemplateView): buttons.append({ 'text': provider.download_button_text or 'Download', 'identifier': provider.identifier, + 'multi': provider.multi_download_enabled }) return buttons @@ -93,6 +94,7 @@ class OrderDetails(EventViewMixin, OrderDetailMixin, CartMixin, TemplateView): ) and self.order.status == Order.STATUS_PAID ) ctx['download_buttons'] = self.download_buttons + ctx['can_download_multi'] = any([b['multi'] for b in self.download_buttons]) ctx['cart'] = self.get_cart( answers=True, downloads=ctx['can_download'], queryset=self.order.positions.all(),