mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Bank transfer: Hide email form if email was already sent (Z#23128941) (#3570)
Co-authored-by: Mira <weller@rami.io>
This commit is contained in:
@@ -530,6 +530,7 @@ class BankTransfer(BasePaymentProvider):
|
||||
'code': self._code(payment.order),
|
||||
'order': payment.order,
|
||||
'amount': payment.amount,
|
||||
'payment_info': payment.info_data,
|
||||
'settings': self.settings,
|
||||
'swiss_qrbill': self.swiss_qrbill(payment),
|
||||
'eu_barcodes': self.event.currency == 'EUR',
|
||||
|
||||
@@ -106,7 +106,20 @@ SCT
|
||||
{% endif %}
|
||||
|
||||
{% if invoice_email_enabled and has_invoices %}
|
||||
<form method="post" action="{% eventurl event "plugins:banktransfer:mail_invoice" order=order.code secret=order.secret %}">
|
||||
{% if payment_info.send_invoice_to %}
|
||||
<p>
|
||||
{% blocktrans trimmed with recipient=payment_info.send_invoice_to %}
|
||||
At your request, we sent the invoice directly to {{ recipient }}.
|
||||
{% endblocktrans %}
|
||||
<a data-toggle="collapse" data-target="#payment_banktransfer_send_invoice_to" class="btn btn-default btn-xs">
|
||||
<span class="fa fa-envelope-o"></span>
|
||||
{% trans "Send again or somewhere else" %}
|
||||
</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
<form id="payment_banktransfer_send_invoice_to" method="post"
|
||||
action="{% eventurl event "plugins:banktransfer:mail_invoice" order=order.code secret=order.secret %}"
|
||||
{% if payment_info.send_invoice_to %}class="collapse"{% endif %}>
|
||||
{% csrf_token %}
|
||||
<p>
|
||||
{% blocktrans trimmed %}
|
||||
|
||||
@@ -923,5 +923,11 @@ class SendInvoiceMailView(EventViewMixin, OrderDetailMixin, View):
|
||||
provider = last_payment.payment_provider
|
||||
provider.send_invoice_to_alternate_email(self.order, last_invoice, request.POST['email'])
|
||||
|
||||
last_payment.info_data = {
|
||||
**last_payment.info_data,
|
||||
'send_invoice_to': request.POST['email'],
|
||||
}
|
||||
last_payment.save(update_fields=['info'])
|
||||
|
||||
messages.success(request, _('Sending the latest invoice via e-mail to {email}.').format(email=request.POST['email']))
|
||||
return redirect(self.get_order_url())
|
||||
|
||||
Reference in New Issue
Block a user