diff --git a/lc_ldap.py b/lc_ldap.py index f615e27..cf123f7 100644 --- a/lc_ldap.py +++ b/lc_ldap.py @@ -463,8 +463,13 @@ class CransLdapObject(object): # blacklistes virtuelle si on est un adhérent pour carte étudiant et chambre invalides 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(): - bl = blacklist(u'%s$%s$%s$%s' % ('-', '-', 'carte_etudiant', ''), {}, self.conn, False) - blacklist_liste.append(bl) + for h in self['historique'][::-1]: + x=re.match("(.*),.* : .*paiement\+%s.*" % 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: + bl = blacklist(u'%s$%s$%s$%s' % ('-', '-', 'carte_etudiant', ''), {}, self.conn, False) + blacklist_liste.append(bl) + break if self['chbre'][0].value == '????': bl = blacklist(u'%s$%s$%s$%s' % ('-', '-', 'chambre_invalide', ''), {}, self.conn, False) blacklist_liste.append(bl)