Compare commits

...

3 commits

Author SHA1 Message Date
Benjamin Bach cfd0d735ac
Set FROM field on emails 2024-08-14 22:43:16 +02:00
Benjamin Bach f5feda3414 Fix invite text and add accounting context to translation messages (#53)
Reviewed-on: data.coop/membersystem#53
Co-authored-by: Benjamin Bach <benjamin@overtag.dk>
Co-committed-by: Benjamin Bach <benjamin@overtag.dk>
2024-08-14 19:52:09 +00:00
Benjamin Bach 3659cf40df Add more precision to the order email (#51)
Reviewed-on: data.coop/membersystem#51
Co-authored-by: Benjamin Bach <benjamin@overtag.dk>
Co-committed-by: Benjamin Bach <benjamin@overtag.dk>
2024-08-14 10:08:01 +00:00
4 changed files with 21 additions and 8 deletions

View file

@ -80,8 +80,8 @@ class Order(CreatedModifiedAbstract):
is_paid = models.BooleanField(default=False, verbose_name=_("is paid")) is_paid = models.BooleanField(default=False, verbose_name=_("is paid"))
class Meta: class Meta:
verbose_name = pgettext_lazy("accounting term", "Order") verbose_name = pgettext_lazy("accounting", "Order")
verbose_name_plural = pgettext_lazy("accounting term", "Orders") verbose_name_plural = pgettext_lazy("accounting", "Orders")
def __str__(self) -> str: def __str__(self) -> str:
return f"Order ID {self.display_id}" return f"Order ID {self.display_id}"

View file

@ -2,7 +2,7 @@
{% load i18n %} {% load i18n %}
{% block head_title %} {% block head_title %}
{% trans "Order" %} {% trans "Order" context "accounting" %}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
@ -11,14 +11,14 @@
<h2>Order: {{ order.id }}</h2> <h2>Order: {{ order.id }}</h2>
<p> <p>
{% trans "Ordered" %}: {{ order.created }}<br> {% trans "Ordered" context "accounting" %}: {{ order.created }}<br>
{% trans "Status" %}: {{ order.is_paid|yesno:_("paid,unpaid") }} {% trans "Status" context "accounting" %}: {{ order.is_paid|yesno:_("paid,unpaid") }}
</p> </p>
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th>{% trans "Item" %}</th> <th>{% trans "Item" context "accounting" %}</th>
<th>{% trans "Quantity" %}</th> <th>{% trans "Quantity" %}</th>
<th>{% trans "Price" %}</th> <th>{% trans "Price" %}</th>
<th>{% trans "VAT" %}</th> <th>{% trans "VAT" %}</th>

View file

@ -56,7 +56,7 @@ class BaseEmail(EmailMessage):
c["request"] = self.request c["request"] = self.request
c["domain"] = site.domain c["domain"] = site.domain
c["site_name"] = site.name c["site_name"] = site.name
c["protocol"] = "http" if self.request and not self.request.is_secure() else "https" c["protocol"] = "https" # if self.request and not self.request.is_secure() else "https"
return c return c
def get_body(self) -> str: def get_body(self) -> str:
@ -101,6 +101,7 @@ class InviteEmail(BaseEmail):
def __init__(self, membership: Membership, request: HttpRequest, *args, **kwargs) -> None: def __init__(self, membership: Membership, request: HttpRequest, *args, **kwargs) -> None:
self.membership = membership self.membership = membership
kwargs["user"] = membership.user kwargs["user"] = membership.user
kwargs["from_email"] = "kasserer@data.coop"
super().__init__(request, *args, **kwargs) super().__init__(request, *args, **kwargs)
def get_context_data(self) -> dict: def get_context_data(self) -> dict:
@ -118,6 +119,7 @@ class OrderEmail(BaseEmail):
def __init__(self, order: Order, request: HttpRequest, *args, **kwargs) -> None: def __init__(self, order: Order, request: HttpRequest, *args, **kwargs) -> None:
self.order = order self.order = order
kwargs["user"] = order.member kwargs["user"] = order.member
kwargs["from_email"] = "kasserer@data.coop"
super().__init__(request, *args, **kwargs) super().__init__(request, *args, **kwargs)
def get_context_data(self) -> dict: def get_context_data(self) -> dict:

View file

@ -1,6 +1,17 @@
{% extends "membership/emails/base.txt" %}{% load i18n %} {% extends "membership/emails/base.txt" %}{% load i18n %}
{% block content %}{% url 'order:detail' order_id=order.id as order_url %}{% blocktrans %}You have an order in our system, you can pay it here: {% block content %}{% url 'order:detail' order_id=order.id as order_url %}{% blocktrans %}You have an order in our system, which you can pay here:
{{ protocol }}://{{ domain }}{{ order_url }} {{ protocol }}://{{ domain }}{{ order_url }}
We used to handle membership stuff in a spreadsheet and via bank transfers. This is now all handled with our custom-made membership system. We hope you like it.
If you received this email and no longer want a membership, you can ignore it. But please let us know by writing board@data.coop, so we can erase any personal data we have about your previous membership.
Dansk:
Hej! Så kører medlemsystemet endeligt! Det er mega-fedt, fordi vi længe har haft besvær med manuelle procedurer. Nu har vi flyttet medlemsdata over på member.data.coop, og betalingen fungerer. Vi kan dermed fremover arbejde stille og roligt på at integrere systemet, så man kan styre sine services via medlemssystemet.
Hvis du ikke længere vil være medlem, kan du ignorere mailen her; men du må meget gerne informere os via board@data.coop, så vi kan slette evt. personlige data og services, du har kørende på dit tidligere medlemskab.
{% endblocktrans %}{% endblock %} {% endblocktrans %}{% endblock %}