Fix #499 -- Refactor paymentinfo to payment_info (#501)

* Refactor paymentinfo to payment_info, resolve #499

* Fix calling of object attribute on tuple

* Minor update to setup documentation

* Do not use short words for typochecks

* Text clarification

* Refactor paymentinfo to payment_info, resolve #499

* Include data migration for existing event settings, resolve #499
This commit is contained in:
Heok Hong Low
2017-05-22 20:06:19 +08:00
committed by Raphael Michel
parent fb716eb498
commit 48b3621f1e
8 changed files with 44 additions and 19 deletions

View File

@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-05-21 09:42
from __future__ import unicode_literals
from django.db import migrations
def rename_placeholder(app, schema_editor):
EventSettingsStore = app.get_model('pretixbase', 'Event_SettingsStore')
for setting in EventSettingsStore.objects.all():
if setting.key == 'mail_text_order_placed':
new_value = setting.value.replace('{paymentinfo}', '{payment_info}')
setting.value = new_value
setting.save()
class Migration(migrations.Migration):
dependencies = [
('pretixbase', '0060_auto_20170510_1027'),
]
operations = [
migrations.RunPython(rename_placeholder)
]

View File

@@ -414,7 +414,7 @@ def _perform_order(event: str, payment_provider: str, position_ids: List[str],
'order': order.code,
'secret': order.secret
}),
'paymentinfo': str(pprov.order_pending_mail_render(order)),
'payment_info': str(pprov.order_pending_mail_render(order)),
'invoice_name': invoice_name,
'invoice_company': invoice_company,
},

View File

@@ -240,7 +240,7 @@ Your {event} team"""))
we successfully received your order for {event} with a total value
of {total} {currency}. Please complete your payment before {date}.
{paymentinfo}
{payment_info}
You can change your order details and view the status of your order at
{url}

View File

@@ -492,9 +492,9 @@ class MailSettingsForm(SettingsForm):
label=_("Text"),
required=False,
widget=I18nTextarea,
help_text=_("Available placeholders: {event}, {total}, {currency}, {date}, {paymentinfo}, {url}, "
help_text=_("Available placeholders: {event}, {total}, {currency}, {date}, {payment_info}, {url}, "
"{invoice_name}, {invoice_company}"),
validators=[PlaceholderValidator(['{event}', '{total}', '{currency}', '{date}', '{paymentinfo}',
validators=[PlaceholderValidator(['{event}', '{total}', '{currency}', '{date}', '{payment_info}',
'{url}', '{invoice_name}', '{invoice_company}'])]
)
mail_text_order_paid = I18nFormField(

View File

@@ -437,7 +437,7 @@ class MailSettingsPreview(EventPermissionRequiredMixin, View):
def items(self):
return {
'mail_text_order_placed': ['total', 'currency', 'date', 'invoice_company',
'event', 'paymentinfo', 'url', 'invoice_name'],
'event', 'payment_info', 'url', 'invoice_name'],
'mail_text_order_paid': ['event', 'url', 'invoice_name', 'invoice_company', 'payment_info'],
'mail_text_order_free': ['event', 'url', 'invoice_name', 'invoice_company'],
'mail_text_resend_link': ['event', 'url', 'invoice_name', 'invoice_company'],
@@ -468,7 +468,7 @@ class MailSettingsPreview(EventPermissionRequiredMixin, View):
'code': '68CYU2H6ZTP3WLK5',
'invoice_name': _('John Doe'),
'invoice_company': _('Sample Corporation'),
'paymentinfo': _('Please transfer money to this bank account: 9999-9999-9999-9999')
'payment_info': _('Please transfer money to this bank account: 9999-9999-9999-9999')
}
def generate_order_url(self, code, secret):

View File

@@ -2012,7 +2012,7 @@ msgid ""
"we successfully received your order for {event} with a total value\n"
"of {total} {currency}. Please complete your payment before {date}.\n"
"\n"
"{paymentinfo}\n"
"{payment_info}\n"
"\n"
"You can change your order details and view the status of your order at\n"
"{url}\n"
@@ -2025,7 +2025,7 @@ msgstr ""
"wir haben Ihre Bestellung für {event} mit einem Gesamtbetrag von\n"
"{total} {currency} erhalten. Bitte schließen Sie die Bezahlung bis {date} "
"ab.\n"
"{paymentinfo}\n"
"{payment_info}\n"
"\n"
"Sie können Ihre Bestellung unter folgender Adresse einsehen und ändern:\n"
"{url}\n"
@@ -2862,10 +2862,10 @@ msgstr "Text"
#: pretix/control/forms/event.py:493
#, python-brace-format
msgid ""
"Available placeholders: {event}, {total}, {currency}, {date}, {paymentinfo}, "
"Available placeholders: {event}, {total}, {currency}, {date}, {payment_info}, "
"{url}, {invoice_name}, {invoice_company}"
msgstr ""
"Verfügbare Platzhalter: {event}, {total}, {currency}, {date}, {paymentinfo}, "
"Verfügbare Platzhalter: {event}, {total}, {currency}, {date}, {payment_info}, "
"{url}, {invoice_name}, {invoice_company}"
#: pretix/control/forms/event.py:502
@@ -9320,7 +9320,7 @@ msgstr "Deutsch (Du)"
#~ "\n"
#~ "we successfully received your order for %(event)s with a total value\n"
#~ "of %(total)s %(currency)s. Please complete your payment before %(date)s.\n"
#~ "%(paymentinfo)s\n"
#~ "%(payment_info)s\n"
#~ "\n"
#~ "You can change your order details and view the status of your order at\n"
#~ "\n"
@@ -9334,7 +9334,7 @@ msgstr "Deutsch (Du)"
#~ "wir haben Ihre Bestellung für %(event)s mit einem Gesamtbetrag von\n"
#~ "%(total)s %(currency)s erhalten. Bitte schließen Sie die Bezahlung bis "
#~ "%(date)s ab.\n"
#~ "%(paymentinfo)s\n"
#~ "%(payment_info)s\n"
#~ "\n"
#~ "Sie können Ihrer Bestellung unter folgender Adresse einsehen und ändern:\n"
#~ "%(url)s\n"

View File

@@ -2012,7 +2012,7 @@ msgid ""
"we successfully received your order for {event} with a total value\n"
"of {total} {currency}. Please complete your payment before {date}.\n"
"\n"
"{paymentinfo}\n"
"{payment_info}\n"
"\n"
"You can change your order details and view the status of your order at\n"
"{url}\n"
@@ -2024,7 +2024,7 @@ msgstr ""
"\n"
"wir haben deine Bestellung für {event} mit einem Gesamtbetrag von\n"
"{total} {currency} erhalten. Bitte schließe die Bezahlung bis {date} ab.\n"
"{paymentinfo}\n"
"{payment_info}\n"
"\n"
"Du kannst deine Bestellung unter folgender Adresse einsehen und ändern:\n"
"{url}\n"
@@ -2859,10 +2859,10 @@ msgstr "Text"
#: pretix/control/forms/event.py:493
#, python-brace-format
msgid ""
"Available placeholders: {event}, {total}, {currency}, {date}, {paymentinfo}, "
"Available placeholders: {event}, {total}, {currency}, {date}, {payment_info}, "
"{url}, {invoice_name}, {invoice_company}"
msgstr ""
"Verfügbare Platzhalter: {event}, {total}, {currency}, {date}, {paymentinfo}, "
"Verfügbare Platzhalter: {event}, {total}, {currency}, {date}, {payment_info}, "
"{url}, {invoice_name}, {invoice_company}"
#: pretix/control/forms/event.py:502
@@ -9300,7 +9300,7 @@ msgstr "Deutsch (Du)"
#~ "\n"
#~ "we successfully received your order for %(event)s with a total value\n"
#~ "of %(total)s %(currency)s. Please complete your payment before %(date)s.\n"
#~ "%(paymentinfo)s\n"
#~ "%(payment_info)s\n"
#~ "\n"
#~ "You can change your order details and view the status of your order at\n"
#~ "\n"
@@ -9314,7 +9314,7 @@ msgstr "Deutsch (Du)"
#~ "wir haben IhredeineBestellung für %(event)s mit einem Gesamtbetrag von\n"
#~ "%(total)s %(currency)s erhalten. Bitte schließe die Bezahlung bis "
#~ "%(date)s ab.\n"
#~ "%(paymentinfo)s\n"
#~ "%(payment_info)s\n"
#~ "\n"
#~ "Du kannst deine Bestellung unter folgender Adresse einsehen und ändern:\n"
#~ "%(url)s\n"

View File

@@ -141,7 +141,7 @@ class MailSettingPreviewTest(SoupTest):
assert res['msgs']['en'] == self.locale_event.name['en']
def test_mail_text_order_placed(self):
text = '{event}{total}{currency}{date}{paymentinfo}{url}{invoice_name}{invoice_company}'
text = '{event}{total}{currency}{date}{payment_info}{url}{invoice_name}{invoice_company}'
response = self.client.post(self.target.format(
self.orga1.slug, self.event1.slug), {
'item': 'mail_text_order_placed',