forked from CGM_Public/pretix_original
Add invoice address fields to ticket PDF editor
This commit is contained in:
@@ -167,6 +167,8 @@ var editor = {
|
||||
"item_description": gettext("Sample product description"),
|
||||
"price": gettext("123.45 EUR"),
|
||||
"attendee_name": gettext("John Doe"),
|
||||
"invoice_name": gettext("John Doe"),
|
||||
"invoice_company": gettext("Sample company"),
|
||||
"event_name": gettext("Sample event name"),
|
||||
"event_date": gettext("May 31st, 2017"),
|
||||
"event_date_range": gettext("May 31st – June 4th, 2017"),
|
||||
|
||||
@@ -299,6 +299,8 @@
|
||||
<option value="event_admission">{% trans "Event admission date and time" %}</option>
|
||||
<option value="event_admission_time">{% trans "Event admission time" %}</option>
|
||||
<option value="event_location">{% trans "Event location" %}</option>
|
||||
<option value="invoice_name">{% trans "Invoice address: name" %}</option>
|
||||
<option value="invoice_company">{% trans "Invoice address: company" %}</option>
|
||||
<option value="addons">{% trans "List of Add-Ons" %}</option>
|
||||
<option value="organizer">{% trans "Organizer name" %}</option>
|
||||
<option value="organizer_info_text">{% trans "Organizer info text" %}</option>
|
||||
|
||||
@@ -109,6 +109,16 @@ class PdfTicketOutput(BaseTicketOutput):
|
||||
if ev.date_admission:
|
||||
tz = timezone(order.event.settings.timezone)
|
||||
return date_format(ev.date_admission.astimezone(tz), "TIME_FORMAT")
|
||||
elif o['content'] == 'invoice_name':
|
||||
try:
|
||||
return order.invoice_address.name
|
||||
except:
|
||||
return ""
|
||||
elif o['content'] == 'invoice_company':
|
||||
try:
|
||||
return order.invoice_address.company
|
||||
except:
|
||||
return ""
|
||||
elif o['content'] == 'addons':
|
||||
return "<br/>".join([
|
||||
'{} - {}'.format(p.item, p.variation) if p.variation else str(p.item)
|
||||
|
||||
@@ -16,7 +16,7 @@ from django.utils.translation import ugettext as _
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
from pretix.base.i18n import language
|
||||
from pretix.base.models import CachedFile
|
||||
from pretix.base.models import CachedFile, InvoiceAddress
|
||||
from pretix.control.permissions import EventPermissionRequiredMixin
|
||||
from pretix.control.views import ChartContainingView
|
||||
from pretix.helpers.database import rolledback_transaction
|
||||
@@ -98,6 +98,8 @@ class EditorView(EventPermissionRequiredMixin, ChartContainingView, TemplateView
|
||||
order.positions.create(item=item2, attendee_name=_("John Doe"), price=item.default_price, addon_to=p)
|
||||
order.positions.create(item=item2, attendee_name=_("John Doe"), price=item.default_price, addon_to=p)
|
||||
|
||||
InvoiceAddress.objects.create(order=order, name=_("John Doe"), company=_("Sample company"))
|
||||
|
||||
prov = PdfTicketOutput(request.event,
|
||||
override_layout=(json.loads(request.POST.get("data"))
|
||||
if request.POST.get("data") else None),
|
||||
|
||||
Reference in New Issue
Block a user