diff --git a/src/pretix/base/settings.py b/src/pretix/base/settings.py index f54ec52bc6..3e6b0c5082 100644 --- a/src/pretix/base/settings.py +++ b/src/pretix/base/settings.py @@ -163,6 +163,10 @@ DEFAULTS = { 'default': 'False', 'type': bool }, + 'ticket_download_nonadm': { + 'default': 'True', + 'type': bool + }, 'last_order_modification_date': { 'default': None, 'type': datetime diff --git a/src/pretix/base/ticketoutput.py b/src/pretix/base/ticketoutput.py index b16ed5aeea..eca309f239 100644 --- a/src/pretix/base/ticketoutput.py +++ b/src/pretix/base/ticketoutput.py @@ -54,12 +54,15 @@ class BaseTicketOutput: If you override this method, make sure that positions that are addons (i.e. ``addon_to`` is set) are only outputted if the event setting ``ticket_download_addons`` is active. + Do the same for positions that are non-admission without ``ticket_download_nonadm`` active. """ with tempfile.TemporaryDirectory() as d: with ZipFile(os.path.join(d, 'tmp.zip'), 'w') as zipf: for pos in order.positions.all(): if pos.addon_to_id and not self.event.settings.ticket_download_addons: continue + if not pos.item.admission and not self.event.settings.ticket_download_nonadm: + continue fname, __, content = self.generate(pos) zipf.writestr('{}-{}{}'.format( order.code, pos.positionid, os.path.splitext(fname)[1] diff --git a/src/pretix/control/forms/event.py b/src/pretix/control/forms/event.py index e46bd0b902..fac21e94aa 100644 --- a/src/pretix/control/forms/event.py +++ b/src/pretix/control/forms/event.py @@ -631,6 +631,11 @@ class TicketSettingsForm(SettingsForm): required=False, widget=forms.CheckboxInput(attrs={'data-display-dependency': '#id_ticket_download'}), ) + ticket_download_nonadm = forms.BooleanField( + label=_("Generate tickets for non-admission products"), + required=False, + widget=forms.CheckboxInput(attrs={'data-display-dependency': '#id_ticket_download'}), + ) def prepare_fields(self): # See clean() diff --git a/src/pretix/control/templates/pretixcontrol/event/tickets.html b/src/pretix/control/templates/pretixcontrol/event/tickets.html index 206e6d6db3..2c794f1010 100644 --- a/src/pretix/control/templates/pretixcontrol/event/tickets.html +++ b/src/pretix/control/templates/pretixcontrol/event/tickets.html @@ -10,6 +10,7 @@ {% bootstrap_field form.ticket_download layout="horizontal" %} {% bootstrap_field form.ticket_download_date layout="horizontal" %} {% bootstrap_field form.ticket_download_addons layout="horizontal" %} + {% bootstrap_field form.ticket_download_nonadm layout="horizontal" %} {% for provider in providers %}