diff --git a/src/pretix/base/services/invoices.py b/src/pretix/base/services/invoices.py index 07b0d89c6..877bf1f78 100644 --- a/src/pretix/base/services/invoices.py +++ b/src/pretix/base/services/invoices.py @@ -39,7 +39,10 @@ def build_invoice(invoice: Invoice) -> Invoice: introductory = invoice.event.settings.get('invoice_introductory_text', as_type=LazyI18nString) additional = invoice.event.settings.get('invoice_additional_text', as_type=LazyI18nString) footer = invoice.event.settings.get('invoice_footer_text', as_type=LazyI18nString) - payment = payment_provider.render_invoice_text(invoice.order) + if payment_provider: + payment = payment_provider.render_invoice_text(invoice.order) + else: + payment = "" invoice.introductory_text = str(introductory).replace('\n', '
') invoice.additional_text = str(additional).replace('\n', '
') diff --git a/src/pretix/control/forms/orders.py b/src/pretix/control/forms/orders.py index 9cb1c61e2..77d49e821 100644 --- a/src/pretix/control/forms/orders.py +++ b/src/pretix/control/forms/orders.py @@ -36,7 +36,9 @@ class ExtendForm(I18nModelForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - if self.instance.status == Order.STATUS_PENDING or self.instance._is_still_available(now(), count_waitinglist=False) is True: + if self.instance.status == Order.STATUS_PENDING or self.instance._is_still_available(now(), + count_waitinglist=False)\ + is True: del self.fields['quota_ignore'] def clean(self): @@ -47,8 +49,33 @@ class ExtendForm(I18nModelForm): return data -class ExporterForm(forms.Form): +class MarkPaidForm(forms.Form): + force = forms.BooleanField( + label=_('Overbook quota and ignore late payment'), + help_text=_('If you check this box, this operation will be performed even if it leads to an overbooked quota ' + 'and you having sold more tickets than you planned! The operation will also be performed ' + 'regardless of the settings for late payments.'), + required=False + ) + def __init__(self, *args, **kwargs): + self.instance = kwargs.pop("instance") + super().__init__(*args, **kwargs) + quota_fail = ( + self.instance.status == Order.STATUS_PENDING or + self.instance._is_still_available(now(), count_waitinglist=False) is True + ) + term_last = self.instance.payment_term_last + term_fail = ( + (not term_last or term_last >= now()) and + (self.instance.status == Order.STATUS_PENDING or self.instance.event.settings.get( + 'payment_term_accept_late')) + ) + if quota_fail or term_fail: + del self.fields['force'] + + +class ExporterForm(forms.Form): def clean(self): data = super().clean() diff --git a/src/pretix/control/templates/pretixcontrol/order/index.html b/src/pretix/control/templates/pretixcontrol/order/index.html index 04e45a3f2..174e5d1e9 100644 --- a/src/pretix/control/templates/pretixcontrol/order/index.html +++ b/src/pretix/control/templates/pretixcontrol/order/index.html @@ -25,7 +25,9 @@