[lc_ldap] ajout d'une fonction sursis_carte.
This commit is contained in:
parent
3c22c3c75e
commit
2d9cdeaa04
1 changed files with 22 additions and 8 deletions
30
lc_ldap.py
30
lc_ldap.py
|
@ -462,14 +462,9 @@ class CransLdapObject(object):
|
||||||
blacklist_liste=[]
|
blacklist_liste=[]
|
||||||
# blacklistes virtuelle si on est un adhérent pour carte étudiant et chambre invalides
|
# blacklistes virtuelle si on est un adhérent pour carte étudiant et chambre invalides
|
||||||
if self.__class__.__name__ == "adherent" and self.paiement_ok():
|
if self.__class__.__name__ == "adherent" and self.paiement_ok():
|
||||||
if not config.periode_transitoire and config.bl_carte_et_actif and not self.carte_ok():
|
if not config.periode_transitoire and config.bl_carte_et_actif and not self.carte_ok() and not self.sursis_carte():
|
||||||
for h in self['historique'][::-1]:
|
bl = blacklist(u'%s$%s$%s$%s' % ('-', '-', 'carte_etudiant', ''), {}, self.conn, False)
|
||||||
x=re.match("(.*),.* : .*paiement\+%s.*" % config.ann_scol,h.value)
|
blacklist_liste.append(bl)
|
||||||
if x != None:
|
|
||||||
if (time.time()-time.mktime(time.strptime(x.group(1),'%d/%m/%Y %H:%M')))>config.sursis_carte:
|
|
||||||
bl = blacklist(u'%s$%s$%s$%s' % ('-', '-', 'carte_etudiant', ''), {}, self.conn, False)
|
|
||||||
blacklist_liste.append(bl)
|
|
||||||
break
|
|
||||||
if self['chbre'][0].value == '????':
|
if self['chbre'][0].value == '????':
|
||||||
bl = blacklist(u'%s$%s$%s$%s' % ('-', '-', 'chambre_invalide', ''), {}, self.conn, False)
|
bl = blacklist(u'%s$%s$%s$%s' % ('-', '-', 'chambre_invalide', ''), {}, self.conn, False)
|
||||||
blacklist_liste.append(bl)
|
blacklist_liste.append(bl)
|
||||||
|
@ -506,6 +501,15 @@ class proprio(CransLdapObject):
|
||||||
super(proprio, self).__init__(conn, dn, mode, ldif)
|
super(proprio, self).__init__(conn, dn, mode, ldif)
|
||||||
self._machines = machines
|
self._machines = machines
|
||||||
|
|
||||||
|
def sursis_carte(self):
|
||||||
|
for h in self['historique'][::-1]:
|
||||||
|
x=re.match("(.*),.* : .*(paiement\+%s|inscription).*" % config.ann_scol,h.value)
|
||||||
|
if x != None:
|
||||||
|
if (time.time()-time.mktime(time.strptime(x.group(1),'%d/%m/%Y %H:%M')))<=config.sursis_carte:
|
||||||
|
return True
|
||||||
|
break
|
||||||
|
return False
|
||||||
|
|
||||||
def paiement_ok(self):
|
def paiement_ok(self):
|
||||||
u"""Renvoie si le propriétaire a payé pour l'année en cours"""
|
u"""Renvoie si le propriétaire a payé pour l'année en cours"""
|
||||||
if self.dn == base_dn:
|
if self.dn == base_dn:
|
||||||
|
@ -515,8 +519,15 @@ class proprio(CransLdapObject):
|
||||||
for paiement in self['paiement']:
|
for paiement in self['paiement']:
|
||||||
if paiement.value == config.ann_scol:
|
if paiement.value == config.ann_scol:
|
||||||
bool_paiement = True
|
bool_paiement = True
|
||||||
|
break
|
||||||
|
# Pour la période transitoire année précédente ok
|
||||||
|
if config.periode_transitoire and paiement.value == config.ann_scol -1:
|
||||||
|
bool_paiement = True
|
||||||
|
break
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
# Doit-on bloquer en cas de manque de la carte d'etudiant ?
|
||||||
|
# (si période transitoire on ne bloque dans aucun cas)
|
||||||
if config.bl_carte_et_definitif and not 'club' in map(lambda x:x.value,self["objectClass"]):
|
if config.bl_carte_et_definitif and not 'club' in map(lambda x:x.value,self["objectClass"]):
|
||||||
bool_carte = False
|
bool_carte = False
|
||||||
try:
|
try:
|
||||||
|
@ -525,6 +536,9 @@ class proprio(CransLdapObject):
|
||||||
bool_carte = True
|
bool_carte = True
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
# Si inscrit depuis moins de config.sursis_carte, on laisse un sursis
|
||||||
|
if not bool_carte and self.sursis_carte():
|
||||||
|
bool_carte = True
|
||||||
return bool_carte and bool_paiement
|
return bool_carte and bool_paiement
|
||||||
return bool_paiement
|
return bool_paiement
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue