Nettoyage des restes de paiement par année scolaire
Ça fait plus d'un an qu'on est passés aux factures avec generalizedTimeFormat
This commit is contained in:
parent
af0e971764
commit
baf79bdda7
13 changed files with 498 additions and 220 deletions
60
archive/gestion/mail/carte_etudiant.py
Executable file
60
archive/gestion/mail/carte_etudiant.py
Executable file
|
@ -0,0 +1,60 @@
|
|||
#!/bin/bash /usr/scripts/python.sh
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
import datetime
|
||||
import pytz
|
||||
from gestion import config
|
||||
from gestion.affich_tools import cprint
|
||||
from gestion import mail as mail_module
|
||||
import lc_ldap.shortcuts
|
||||
|
||||
# Attention, si à True envoie effectivement les mails
|
||||
SEND=False
|
||||
# TODO ces deadlines devraient être dans config.py
|
||||
deadline=datetime.datetime(config.ann_scol, 11, 6)
|
||||
fin_conn = datetime.datetime(config.ann_scol, 11, 1, tzinfo=pytz.UTC)
|
||||
fin_conn = fin_conn.strftime('%Y%m%d%H%M%S%z')
|
||||
ldap_filter=u"""(&
|
||||
(finConnexion>=%(fin_conn)s)
|
||||
(!(carteEtudiant=*))
|
||||
(!(etudes=Personnel ENS))
|
||||
(aid=*)
|
||||
)""" % {'fin_conn': fin_conn, }
|
||||
|
||||
conn=lc_ldap.shortcuts.lc_ldap_readonly()
|
||||
mailaddrs=set()
|
||||
for adh in conn.search(ldap_filter):
|
||||
mail = adh.get_mail()
|
||||
if not mail:
|
||||
print "Skip %r (no valid mail)" % adh
|
||||
continue
|
||||
mailaddrs.add(mail)
|
||||
|
||||
print "Va envoyer le message à %s personnes." % len(mailaddrs)
|
||||
if not SEND:
|
||||
print "Mettre la variable SEND à True effectuer l'envoi"
|
||||
print "Appuyer sur entrée pour la génération"
|
||||
raw_input()
|
||||
|
||||
echecs=[]
|
||||
with mail_module.ServerConnection() as conn_smtp:
|
||||
for To in mailaddrs:
|
||||
cprint(u"Envoi du mail à %s" % To)
|
||||
params = {
|
||||
'deadline': deadline,
|
||||
'To': To,
|
||||
'lang_info': 'English version below',
|
||||
}
|
||||
mailtxt=mail_module.generate('carte_etudiant', params).as_string()
|
||||
try:
|
||||
# TODO DBG_MAIL
|
||||
if SEND:
|
||||
conn_smtp.sendmail("cableurs@crans.org", (To,), mailtxt)
|
||||
except:
|
||||
cprint(u"Erreur lors de l'envoi à %s " % To, "rouge")
|
||||
echecs.append(To)
|
||||
|
||||
if echecs:
|
||||
print "\nIl y a eu des erreurs :"
|
||||
print echecs
|
1
archive/gestion/mail/template/carte_etudiant/From/fr
Normal file
1
archive/gestion/mail/template/carte_etudiant/From/fr
Normal file
|
@ -0,0 +1 @@
|
|||
Les câbleurs du Crans <cableurs@crans.org>
|
1
archive/gestion/mail/template/carte_etudiant/Subject/fr
Normal file
1
archive/gestion/mail/template/carte_etudiant/Subject/fr
Normal file
|
@ -0,0 +1 @@
|
|||
[Crans] Rappel carte d'étudiant
|
1
archive/gestion/mail/template/carte_etudiant/To/fr
Normal file
1
archive/gestion/mail/template/carte_etudiant/To/fr
Normal file
|
@ -0,0 +1 @@
|
|||
{{To}}
|
1
archive/gestion/mail/template/carte_etudiant/X-Mailer/fr
Normal file
1
archive/gestion/mail/template/carte_etudiant/X-Mailer/fr
Normal file
|
@ -0,0 +1 @@
|
|||
{{ mailer }}
|
17
archive/gestion/mail/template/carte_etudiant/body/_fr_old
Normal file
17
archive/gestion/mail/template/carte_etudiant/body/_fr_old
Normal file
|
@ -0,0 +1,17 @@
|
|||
Cher adhérent,
|
||||
|
||||
Il apparaît que tu n'as pas encore fourni de justificatif de scolarité
|
||||
valide pour l'année en cours. Le Crans utilisant le réseau RENATER, il lui
|
||||
est nécessaire d'avoir une copie d'un papier attestant de ton statut
|
||||
d'étudiant.
|
||||
|
||||
Il est nécessaire que tu viennes à la Kfet avec un certificat de scolarité
|
||||
original ou ta carte d'étudiant, avant le {{deadline}}. Si tu ne
|
||||
pouvais venir avant cette date, ton accès serai suspendu jusqu'à ce que tu
|
||||
régularises ta situation.
|
||||
|
||||
Bien cordialement,
|
||||
|
||||
--
|
||||
Les câbleurs
|
||||
|
18
archive/gestion/mail/template/carte_etudiant/body/en
Normal file
18
archive/gestion/mail/template/carte_etudiant/body/en
Normal file
|
@ -0,0 +1,18 @@
|
|||
Dear Crans member,
|
||||
|
||||
It seems that your haven't yet given a school certificate for this academic
|
||||
year. The Crans is connected to the RENATER network so we have to justify the
|
||||
academic status of all our members.
|
||||
|
||||
You must therefore go to the Kfet with an original school certificate or with
|
||||
your student card, before {{deadline|date}}. In case you fail to come before that
|
||||
date, your Internet access will be suspended until you have the document sorted
|
||||
out.
|
||||
|
||||
Please do not send us your certificate by email, we need to see an original.
|
||||
|
||||
Faithfully,
|
||||
|
||||
--
|
||||
The Crans active members
|
||||
|
19
archive/gestion/mail/template/carte_etudiant/body/fr
Normal file
19
archive/gestion/mail/template/carte_etudiant/body/fr
Normal file
|
@ -0,0 +1,19 @@
|
|||
Cher adhérent,
|
||||
|
||||
Il apparaît que tu n'as pas encore fourni de justificatif de scolarité
|
||||
valide pour l'année en cours. Le Crans utilisant le réseau RENATER, il lui
|
||||
est demandé de pouvoir justifier ton statut d'étudiant.
|
||||
|
||||
Ainsi, il est nécessaire que tu viennes à la Kfet avec un certificat de
|
||||
scolarité original ou ta carte d'étudiant, avant le {{deadline|date}}. Si tu ne
|
||||
pouvais venir avant cette date, ton accès serait suspendu jusqu'à ce que tu
|
||||
régularises ta situation.
|
||||
|
||||
Merci de ne pas envoyer de certificat ou carte par retour de courriel,
|
||||
ceux-ci ne seront pas acceptés.
|
||||
|
||||
À bientôt !
|
||||
|
||||
--
|
||||
Les membres actifs du Crans
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue