mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-15 02:33:22 +00:00
Merge pull request #901 from ae-utbm/improve-warning-dump
Improve warning dump
This commit is contained in:
commit
23049a8ae2
@ -1,4 +1,5 @@
|
|||||||
import logging
|
import logging
|
||||||
|
import time
|
||||||
from smtplib import SMTPException
|
from smtplib import SMTPException
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
@ -25,9 +26,34 @@ class Command(BaseCommand):
|
|||||||
self.logger.setLevel(logging.INFO)
|
self.logger.setLevel(logging.INFO)
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
def add_arguments(self, parser):
|
||||||
|
parser.add_argument(
|
||||||
|
"--dry-run",
|
||||||
|
action="store_true",
|
||||||
|
help="Do not send the mails, just display the number of users concerned",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"-d",
|
||||||
|
"--delay",
|
||||||
|
type=float,
|
||||||
|
default=0,
|
||||||
|
help="Delay in seconds between each mail sent",
|
||||||
|
)
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
users = list(self._get_users())
|
users: list[User] = list(self._get_users())
|
||||||
self.stdout.write(f"{len(users)} users will be warned of their account dump")
|
self.stdout.write(f"{len(users)} users will be warned of their account dump")
|
||||||
|
if options["verbosity"] > 1:
|
||||||
|
self.stdout.write("Users concerned:\n")
|
||||||
|
self.stdout.write(
|
||||||
|
"\n".join(
|
||||||
|
f" - {user.get_display_name()} ({user.email}) : "
|
||||||
|
f"{user.customer.amount} €"
|
||||||
|
for user in users
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if options["dry_run"]:
|
||||||
|
return
|
||||||
dumps = []
|
dumps = []
|
||||||
for user in users:
|
for user in users:
|
||||||
is_success = self._send_mail(user)
|
is_success = self._send_mail(user)
|
||||||
@ -38,6 +64,10 @@ class Command(BaseCommand):
|
|||||||
warning_mail_error=not is_success,
|
warning_mail_error=not is_success,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
if options["delay"]:
|
||||||
|
# avoid spamming the mail server too much
|
||||||
|
time.sleep(options["delay"])
|
||||||
|
|
||||||
AccountDump.objects.bulk_create(dumps)
|
AccountDump.objects.bulk_create(dumps)
|
||||||
self.stdout.write("Finished !")
|
self.stdout.write("Finished !")
|
||||||
|
|
||||||
|
@ -1,43 +1,40 @@
|
|||||||
<p>
|
{% trans %}Hello{% endtrans %},
|
||||||
Bonjour,
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
{% trans trimmed date=last_subscription_date|date(DATETIME_FORMAT) -%}
|
||||||
{%- trans date=last_subscription_date|date(DATETIME_FORMAT) -%}
|
You received this email because your last subscription to the
|
||||||
You received this email because your last subscription to the
|
Students' association ended on {{ date }}.
|
||||||
Students' association ended on {{ date }}.
|
{%- endtrans %}
|
||||||
{%- endtrans -%}
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
{% trans trimmed date=dump_date|date(DATETIME_FORMAT), amount=balance -%}
|
||||||
{%- trans date=dump_date|date(DATETIME_FORMAT), amount=balance -%}
|
In accordance with the Internal Regulations, the balance of any
|
||||||
In accordance with the Internal Regulations, the balance of any
|
inactive AE account for more than 2 years automatically goes back
|
||||||
inactive AE account for more than 2 years automatically goes back
|
to the AE.
|
||||||
to the AE.
|
The money present on your account will therefore be recovered in full
|
||||||
The money present on your account will therefore be recovered in full
|
on {{ date }}, for a total of {{ amount }} €.
|
||||||
on {{ date }}, for a total of {{ amount }} €.
|
{%- endtrans %}
|
||||||
{%- endtrans -%}
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
{% trans trimmed -%}
|
||||||
{%- trans -%}However, if your subscription is renewed by this date,
|
However, if your subscription is renewed by this date,
|
||||||
your right to keep the money in your AE account will be renewed.{%- endtrans -%}
|
your right to keep the money in your AE account will be renewed.
|
||||||
</p>
|
{%- endtrans %}
|
||||||
|
|
||||||
{% if balance >= 10 %}
|
{% if balance >= 10 -%}
|
||||||
<p>
|
{% trans trimmed -%}
|
||||||
{%- trans -%}You can also request a refund by sending an email to
|
You can also request a refund by sending an email to ae@utbm.fr
|
||||||
<a href="mailto:ae@utbm.fr">ae@utbm.fr</a>
|
before the aforementioned date.
|
||||||
before the aforementioned date.{%- endtrans -%}
|
{%- endtrans %}
|
||||||
</p>
|
{%- endif %}
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<p>
|
{% trans trimmed -%}
|
||||||
{% trans %}Sincerely{% endtrans %},
|
Whatever you decide, you won't be expelled from the association,
|
||||||
</p>
|
and you won't lose your rights.
|
||||||
|
You will always be able to renew your subscription later.
|
||||||
|
If you don't renew your subscription, there will be no consequences
|
||||||
|
other than the loss of the money currently in your AE account.
|
||||||
|
{%- endtrans %}
|
||||||
|
|
||||||
<p>
|
{% trans %}Sincerely{% endtrans %},
|
||||||
L'association des étudiants de l'UTBM <br>
|
|
||||||
6, Boulevard Anatole France <br>
|
L'association des étudiants de l'UTBM
|
||||||
90000 Belfort
|
6, Boulevard Anatole France
|
||||||
</p>
|
90000 Belfort
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2024-10-16 01:51+0200\n"
|
"POT-Creation-Date: 2024-10-20 12:42+0200\n"
|
||||||
"PO-Revision-Date: 2016-07-18\n"
|
"PO-Revision-Date: 2016-07-18\n"
|
||||||
"Last-Translator: Maréchal <thomas.girod@utbm.fr\n"
|
"Last-Translator: Maréchal <thomas.girod@utbm.fr\n"
|
||||||
"Language-Team: AE info <ae.info@utbm.fr>\n"
|
"Language-Team: AE info <ae.info@utbm.fr>\n"
|
||||||
@ -3629,7 +3629,7 @@ msgstr "Produit parent"
|
|||||||
msgid "Buying groups"
|
msgid "Buying groups"
|
||||||
msgstr "Groupes d'achat"
|
msgstr "Groupes d'achat"
|
||||||
|
|
||||||
#: counter/management/commands/dump_warning_mail.py:82
|
#: counter/management/commands/dump_warning_mail.py:113
|
||||||
msgid "Clearing of your AE account"
|
msgid "Clearing of your AE account"
|
||||||
msgstr "Vidange de votre compte AE"
|
msgstr "Vidange de votre compte AE"
|
||||||
|
|
||||||
@ -3883,48 +3883,61 @@ msgstr "uid"
|
|||||||
msgid "student cards"
|
msgid "student cards"
|
||||||
msgstr "cartes étudiante"
|
msgstr "cartes étudiante"
|
||||||
|
|
||||||
#: counter/templates/counter/account_dump_warning_mail.jinja:6
|
#: counter/templates/counter/account_dump_warning_mail.jinja:1
|
||||||
|
msgid "Hello"
|
||||||
|
msgstr "Bonjour"
|
||||||
|
|
||||||
|
#: counter/templates/counter/account_dump_warning_mail.jinja:3
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid ""
|
msgid ""
|
||||||
"You received this email because your last subscription to the\n"
|
"You received this email because your last subscription to the Students' "
|
||||||
" Students' association ended on %(date)s."
|
"association ended on %(date)s."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Vous recevez ce mail car votre dernière cotisation à l'assocation des "
|
"Vous recevez ce mail car votre dernière cotisation à l'assocation des "
|
||||||
"étudiants de l'UTBM s'est achevée le %(date)s."
|
"étudiants de l'UTBM s'est achevée le %(date)s."
|
||||||
|
|
||||||
#: counter/templates/counter/account_dump_warning_mail.jinja:11
|
#: counter/templates/counter/account_dump_warning_mail.jinja:6
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid ""
|
msgid ""
|
||||||
"In accordance with the Internal Regulations, the balance of any\n"
|
"In accordance with the Internal Regulations, the balance of any inactive AE "
|
||||||
" inactive AE account for more than 2 years automatically goes back\n"
|
"account for more than 2 years automatically goes back to the AE. The money "
|
||||||
" to the AE.\n"
|
"present on your account will therefore be recovered in full on %(date)s, for "
|
||||||
" The money present on your account will therefore be recovered in full\n"
|
"a total of %(amount)s €."
|
||||||
" on %(date)s, for a total of %(amount)s €."
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Conformément au Règlement intérieur, le solde de tout compte AE inactif "
|
"Conformément au Règlement intérieur, le solde de tout compte AE inactif "
|
||||||
"depuis plus de 2 ans revient de droit à l'AE. L'argent présent sur votre "
|
"depuis plus de 2 ans revient de droit à l'AE. L'argent présent sur votre "
|
||||||
"compte sera donc récupéré en totalité le %(date)s, pour un total de "
|
"compte sera donc récupéré en totalité le %(date)s, pour un total de "
|
||||||
"%(amount)s €. "
|
"%(amount)s €. "
|
||||||
|
|
||||||
#: counter/templates/counter/account_dump_warning_mail.jinja:19
|
#: counter/templates/counter/account_dump_warning_mail.jinja:12
|
||||||
msgid ""
|
msgid ""
|
||||||
"However, if your subscription is renewed by this date,\n"
|
"However, if your subscription is renewed by this date, your right to keep "
|
||||||
" your right to keep the money in your AE account will be renewed."
|
"the money in your AE account will be renewed."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Cependant, si votre cotisation est renouvelée d'ici cette date, votre droit "
|
"Cependant, si votre cotisation est renouvelée d'ici cette date, votre droit "
|
||||||
"à conserver l'argent de votre compte AE sera renouvelé."
|
"à conserver l'argent de votre compte AE sera renouvelé."
|
||||||
|
|
||||||
#: counter/templates/counter/account_dump_warning_mail.jinja:25
|
#: counter/templates/counter/account_dump_warning_mail.jinja:16
|
||||||
msgid ""
|
msgid ""
|
||||||
"You can also request a refund by sending an email to\n"
|
"You can also request a refund by sending an email to ae@utbm.fr before the "
|
||||||
" <a href=\"mailto:ae@utbm.fr\">ae@utbm.fr</a>\n"
|
"aforementioned date."
|
||||||
" before the aforementioned date."
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Vous pouvez également effectuer une demande de remboursement par mail à "
|
"Vous pouvez également effectuer une demande de remboursement par mail à "
|
||||||
"l'adresse <a href=\"mailto:ae@utbm.fr\">ae@utbm.fr</a> avant la date "
|
"l'adresse ae@utbm.fr avant la date susmentionnée."
|
||||||
"susmentionnée."
|
|
||||||
|
|
||||||
#: counter/templates/counter/account_dump_warning_mail.jinja:32
|
#: counter/templates/counter/account_dump_warning_mail.jinja:20
|
||||||
|
msgid ""
|
||||||
|
"Whatever you decide, you won't be expelled from the association, and you "
|
||||||
|
"won't lose your rights. You will always be able to renew your subscription "
|
||||||
|
"later. If you don't renew your subscription, there will be no consequences "
|
||||||
|
"other than the loss of the money currently in your AE account."
|
||||||
|
msgstr ""
|
||||||
|
"Quel que soit votre décision, vous ne serez pas exclu.e de l'association "
|
||||||
|
"et vous ne perdrez pas vos droits. Vous serez toujours en mesure de renouveler "
|
||||||
|
"votre cotisation. Si vous ne renouvelez pas votre cotisation, il n'y aura "
|
||||||
|
"aucune conséquence autre que le retrait de l'argent de votre compte."
|
||||||
|
|
||||||
|
#: counter/templates/counter/account_dump_warning_mail.jinja:26
|
||||||
msgid "Sincerely"
|
msgid "Sincerely"
|
||||||
msgstr "Cordialement"
|
msgstr "Cordialement"
|
||||||
|
|
||||||
@ -3997,7 +4010,7 @@ msgstr "Ce n'est pas un UID de carte étudiante valide"
|
|||||||
#: counter/templates/counter/invoices_call.jinja:16
|
#: counter/templates/counter/invoices_call.jinja:16
|
||||||
#: launderette/templates/launderette/launderette_admin.jinja:35
|
#: launderette/templates/launderette/launderette_admin.jinja:35
|
||||||
#: launderette/templates/launderette/launderette_click.jinja:13
|
#: launderette/templates/launderette/launderette_click.jinja:13
|
||||||
#: sas/templates/sas/picture.jinja:167
|
#: sas/templates/sas/picture.jinja:166
|
||||||
#: subscription/templates/subscription/stats.jinja:20
|
#: subscription/templates/subscription/stats.jinja:20
|
||||||
msgid "Go"
|
msgid "Go"
|
||||||
msgstr "Valider"
|
msgstr "Valider"
|
||||||
@ -5384,7 +5397,7 @@ msgstr "Image précédente"
|
|||||||
msgid "People"
|
msgid "People"
|
||||||
msgstr "Personne(s)"
|
msgstr "Personne(s)"
|
||||||
|
|
||||||
#: sas/templates/sas/picture.jinja:165
|
#: sas/templates/sas/picture.jinja:164
|
||||||
msgid "Identify users on pictures"
|
msgid "Identify users on pictures"
|
||||||
msgstr "Identifiez les utilisateurs sur les photos"
|
msgstr "Identifiez les utilisateurs sur les photos"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user