mirror of
https://github.com/pretix/pretix.git
synced 2026-05-09 15:54:03 +00:00
Bank transfer: Do not use <pre> for bank details in emails (#3413)
This commit is contained in:
@@ -33,7 +33,6 @@
|
|||||||
# License for the specific language governing permissions and limitations under the License.
|
# License for the specific language governing permissions and limitations under the License.
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import textwrap
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
@@ -56,6 +55,7 @@ from pretix.base.i18n import language
|
|||||||
from pretix.base.models import InvoiceAddress, Order, OrderPayment, OrderRefund
|
from pretix.base.models import InvoiceAddress, Order, OrderPayment, OrderRefund
|
||||||
from pretix.base.payment import BasePaymentProvider
|
from pretix.base.payment import BasePaymentProvider
|
||||||
from pretix.base.services.mail import SendMailException, mail, render_mail
|
from pretix.base.services.mail import SendMailException, mail, render_mail
|
||||||
|
from pretix.base.templatetags.money import money_filter
|
||||||
from pretix.helpers.format import format_map
|
from pretix.helpers.format import format_map
|
||||||
from pretix.plugins.banktransfer.templatetags.ibanformat import ibanformat
|
from pretix.plugins.banktransfer.templatetags.ibanformat import ibanformat
|
||||||
from pretix.presale.views.cart import cart_session
|
from pretix.presale.views.cart import cart_session
|
||||||
@@ -454,26 +454,24 @@ class BankTransfer(BasePaymentProvider):
|
|||||||
return template.render(ctx)
|
return template.render(ctx)
|
||||||
|
|
||||||
def order_pending_mail_render(self, order, payment) -> str:
|
def order_pending_mail_render(self, order, payment) -> str:
|
||||||
template = get_template('pretixplugins/banktransfer/email/order_pending.txt')
|
t = gettext("Please transfer the full amount to the following bank account:")
|
||||||
bankdetails = []
|
t += "\n\n"
|
||||||
|
|
||||||
|
md_nl2br = " \n"
|
||||||
if self.settings.get('bank_details_type') == 'sepa':
|
if self.settings.get('bank_details_type') == 'sepa':
|
||||||
bankdetails += [
|
bankdetails = (
|
||||||
_("Account holder"), ": ", self.settings.get('bank_details_sepa_name'), "\n",
|
(_("Reference"), self._code(order)),
|
||||||
_("IBAN"), ": ", ibanformat(self.settings.get('bank_details_sepa_iban')), "\n",
|
(_("Amount"), money_filter(payment.amount, self.event.currency)),
|
||||||
_("BIC"), ": ", self.settings.get('bank_details_sepa_bic'), "\n",
|
(_("Account holder"), self.settings.get('bank_details_sepa_name')),
|
||||||
_("Bank"), ": ", self.settings.get('bank_details_sepa_bank'),
|
(_("IBAN"), ibanformat(self.settings.get('bank_details_sepa_iban'))),
|
||||||
]
|
(_("BIC"), self.settings.get('bank_details_sepa_bic')),
|
||||||
if bankdetails and self.settings.get('bank_details', as_type=LazyI18nString):
|
(_("Bank"), self.settings.get('bank_details_sepa_bank')),
|
||||||
bankdetails.append("\n")
|
)
|
||||||
bankdetails.append(self.settings.get('bank_details', as_type=LazyI18nString))
|
t += md_nl2br.join([f"**{k}:** {v}" for k, v in bankdetails])
|
||||||
ctx = {
|
if self.settings.get('bank_details', as_type=LazyI18nString):
|
||||||
'event': self.event,
|
t += md_nl2br
|
||||||
'order': order,
|
t += str(self.settings.get('bank_details', as_type=LazyI18nString))
|
||||||
'code': self._code(order),
|
return t
|
||||||
'amount': payment.amount,
|
|
||||||
'details': textwrap.indent(''.join(str(i) for i in bankdetails), ' '),
|
|
||||||
}
|
|
||||||
return template.render(ctx)
|
|
||||||
|
|
||||||
def swiss_qrbill(self, payment):
|
def swiss_qrbill(self, payment):
|
||||||
if not self.settings.get('bank_details_sepa_iban') or not self.settings.get('bank_details_sepa_iban')[:2] in ('CH', 'LI'):
|
if not self.settings.get('bank_details_sepa_iban') or not self.settings.get('bank_details_sepa_iban')[:2] in ('CH', 'LI'):
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
{% load i18n %}{% load l10n %}{% load money %}{% blocktrans with bank=details|safe total=amount|money:event.currency %}
|
|
||||||
Please transfer the full amount to the following bank account.
|
|
||||||
|
|
||||||
Reference: {{ code }}
|
|
||||||
Amount: {{ total }}
|
|
||||||
{{ bank }}
|
|
||||||
{% endblocktrans %}
|
|
||||||
Reference in New Issue
Block a user