Ajout generation password admin + fonction reminder pour les cotisations en retard (non implementee dans le scheduler a ce jour
This commit is contained in:
parent
fe01287064
commit
8259f23703
@ -1,6 +1,7 @@
|
|||||||
from brie.config import ldap_config
|
from brie.config import ldap_config
|
||||||
from brie.model.ldap import *
|
from brie.model.ldap import *
|
||||||
import datetime
|
import datetime
|
||||||
|
import smtplib
|
||||||
|
|
||||||
class Residences:
|
class Residences:
|
||||||
|
|
||||||
@ -275,6 +276,32 @@ class CotisationComputes:
|
|||||||
return delta.days <= 30 and delta.days > 7
|
return delta.days <= 30 and delta.days > 7
|
||||||
#end def
|
#end def
|
||||||
|
|
||||||
|
def cotisation_late_reminder(member_dn, user_session, residence_dn):
|
||||||
|
member = Member.get_by_dn(user_session,member_dn)
|
||||||
|
from_mail = "noreply@fede-aurore.net"
|
||||||
|
to_mail = [member.mail.first()]
|
||||||
|
residence_name = Residences.get_name_by_dn(user_session,residence_dn).decode("utf-8").encode("ascii", "ignore")
|
||||||
|
|
||||||
|
message = """From: Federation Aurore <noreply@fede-aurore.net>
|
||||||
|
To: """ + member.cn.first().decode("utf-8").encode("ascii", "ignore") + """ <""" + member.mail.first().decode("utf-8").encode("ascii", "ignore") + """>
|
||||||
|
Subject: Rappel: Votre cotisation """ + residence_name + """
|
||||||
|
|
||||||
|
Cher membre,
|
||||||
|
|
||||||
|
Ceci est un message de la federation Aurore concernant votre cotisation a l'association """ + residence_name.encode("ascii","ignore") + """.
|
||||||
|
En effet celle-ci arrive a son terme dans moins de 7 jours, si vous souhaitez renouveller votre acces internet il est necessaire de recotiser a l'association a""" + residence_name + """ dans les délais les plus courts.
|
||||||
|
|
||||||
|
Cordialement,
|
||||||
|
|
||||||
|
Federation Aurore """
|
||||||
|
message = message.encode("utf-8")
|
||||||
|
|
||||||
|
try:
|
||||||
|
smtpObj = smtplib.SMTP('smtp.u-psud.fr')
|
||||||
|
smtpObj.sendmail(sender, receivers, message)
|
||||||
|
except SMTPException:
|
||||||
|
print "Error: unable to send email"
|
||||||
|
#end def
|
||||||
@staticmethod
|
@staticmethod
|
||||||
# more than a month late
|
# more than a month late
|
||||||
def is_no_cotisation(member_dn, user_session, residence_dn, cotisations = None, anniversary = None, verification_old_member = True):
|
def is_no_cotisation(member_dn, user_session, residence_dn, cotisations = None, anniversary = None, verification_old_member = True):
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import unicodedata
|
import unicodedata
|
||||||
from random import randint
|
from random import randint
|
||||||
|
from os import urandom
|
||||||
|
from binascii import b2a_hex
|
||||||
|
|
||||||
class Translations(object):
|
class Translations(object):
|
||||||
|
|
||||||
@ -62,5 +64,10 @@ class Passwords(object):
|
|||||||
#end for
|
#end for
|
||||||
return password
|
return password
|
||||||
#end def
|
#end def
|
||||||
|
|
||||||
|
@static_method
|
||||||
|
def generate_password_admin():
|
||||||
|
return b2a_hex(os.urandom(4))
|
||||||
|
|
||||||
#end class
|
#end class
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user