Allow to exclude items from ticket generation explicitly

This commit is contained in:
Raphael Michel
2019-02-01 16:48:14 +01:00
parent f77b551aa6
commit 2aa246b3d5
16 changed files with 119 additions and 78 deletions

View File

@@ -56,20 +56,18 @@
{% endif %}
</div>
{% if download and line.item.admission|default:event.settings.ticket_download_nonadm %}
{% if download and line.generate_ticket %}
<div class="download-desktop">
{% if not line.addon_to or event.settings.ticket_download_addons %}
{% for b in download_buttons %}
<form action="{% eventurl event "presale:event.order.download" secret=order.secret order=order.code output=b.identifier position=line.id %}"
method="post" data-asynctask data-asynctask-download class="download-btn-form">
{% csrf_token %}
<button type="submit"
class="btn btn-sm {% if b.identifier == "pdf" %}btn-primary{% else %}btn-default{% endif %}">
<span class="fa {{ b.icon }}"></span> {{ b.text }}
</button>
</form>
{% endfor %}
{% endif %}
{% for b in download_buttons %}
<form action="{% eventurl event "presale:event.order.download" secret=order.secret order=order.code output=b.identifier position=line.id %}"
method="post" data-asynctask data-asynctask-download class="download-btn-form">
{% csrf_token %}
<button type="submit"
class="btn btn-sm {% if b.identifier == "pdf" %}btn-primary{% else %}btn-default{% endif %}">
<span class="fa {{ b.icon }}"></span> {{ b.text }}
</button>
</form>
{% endfor %}
</div>
{% elif line.addon_to %}
<div class="count">&nbsp;</div>
@@ -149,20 +147,18 @@
{% endif %}
{% endif %}
</div>
{% if download and line.item.admission|default:event.settings.ticket_download_nonadm %}
{% if download and line.generate_ticket %}
<div class="download-mobile">
{% if not line.addon_to or event.settings.ticket_download_addons %}
{% for b in download_buttons %}
<form action="{% eventurl event "presale:event.order.download" secret=order.secret order=order.code output=b.identifier position=line.id %}"
method="post" data-asynctask data-asynctask-download class="download-btn-form">
{% csrf_token %}
<button type="submit"
class="btn btn-sm {% if b.identifier == "pdf" %}btn-primary{% else %}btn-default{% endif %}">
<span class="fa {{ b.icon }}"></span> {{ b.text }}
</button>
</form>
{% endfor %}
{% endif %}
{% for b in download_buttons %}
<form action="{% eventurl event "presale:event.order.download" secret=order.secret order=order.code output=b.identifier position=line.id %}"
method="post" data-asynctask data-asynctask-download class="download-btn-form">
{% csrf_token %}
<button type="submit"
class="btn btn-sm {% if b.identifier == "pdf" %}btn-primary{% else %}btn-default{% endif %}">
<span class="fa {{ b.icon }}"></span> {{ b.text }}
</button>
</form>
{% endfor %}
</div>
{% endif %}
<div class="clearfix"></div>

View File

@@ -102,8 +102,7 @@ class OrderDetails(EventViewMixin, OrderDetailMixin, CartMixin, TemplateView):
order=self.order
)
ctx['can_download_multi'] = any([b['multi'] for b in self.download_buttons]) and (
self.request.event.settings.ticket_download_nonadm or
[p.item.admission for p in ctx['cart']['positions']].count(True) > 1
[p.generate_ticket for p in ctx['cart']['positions']].count(True) > 1
)
ctx['invoices'] = list(self.order.invoices.all())
can_generate_invoice = (
@@ -685,10 +684,8 @@ class OrderDownload(EventViewMixin, OrderDetailMixin, AsyncAction, View):
raise Http404(_('Unknown order code or not authorized to access this order.'))
if not self.order.ticket_download_available:
return self.error(_('Ticket download is not (yet) enabled for this order.'))
if 'position' in kwargs and (self.order_position.addon_to and not self.request.event.settings.ticket_download_addons):
return self.error(_('Ticket download is not enabled for add-on products.'))
if 'position' in kwargs and (not self.order_position.item.admission and not self.request.event.settings.ticket_download_nonadm):
return self.error(_('Ticket download is not enabled for non-admission products.'))
if 'position' in kwargs and not self.order_position.generate_ticket:
return self.error(_('Ticket download is not enabled for this product.'))
ct = self.get_last_ct()
if ct: