Supprime ce qui concerne la carte d'étudiant
This commit is contained in:
parent
20dd2d64cd
commit
f0de8bd515
4 changed files with 15 additions and 53 deletions
34
objets.py
34
objets.py
|
@ -782,9 +782,6 @@ 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 isinstance(self, adherent):
|
if isinstance(self, adherent):
|
||||||
if not self.carte_ok():
|
|
||||||
bl = attributs.blacklist(u'%s$%s$%s$%s' % ('-', '-', 'carte_etudiant', ''), {}, self.conn)
|
|
||||||
blacklist_liste.append(bl)
|
|
||||||
if self['chbre'][0] == '????':
|
if self['chbre'][0] == '????':
|
||||||
bl = attributs.blacklist(u'%s$%s$%s$%s' % ('-', '-', 'chambre_invalide', ''), {}, self.conn)
|
bl = attributs.blacklist(u'%s$%s$%s$%s' % ('-', '-', 'chambre_invalide', ''), {}, self.conn)
|
||||||
blacklist_liste.append(bl)
|
blacklist_liste.append(bl)
|
||||||
|
@ -1006,17 +1003,9 @@ class proprio(CransLdapObject):
|
||||||
|
|
||||||
return super(proprio, self).may_be(what, liste)
|
return super(proprio, self).may_be(what, liste)
|
||||||
|
|
||||||
|
|
||||||
def sursis_carte(self):
|
|
||||||
for h in self['historique'][::-1]:
|
|
||||||
x = re.match("(.*),.* : .*(paiement\+%s|inscription).*" % (config.ann_scol,), h.value)
|
|
||||||
if x != None:
|
|
||||||
return ((time.time()-time.mktime(time.strptime(x.group(1),'%d/%m/%Y %H:%M'))) <= config.sursis_carte)
|
|
||||||
return False
|
|
||||||
|
|
||||||
def access_ok(self):
|
def access_ok(self):
|
||||||
u"""Renvoie si le propriétaire a payé et donné sa carte pour l'année en cours"""
|
u"""Renvoie si le propriétaire a payé et donné sa carte pour l'année en cours"""
|
||||||
return self.paiement_ok() and self.carte_ok()
|
return self.paiement_ok()
|
||||||
|
|
||||||
def fin_adhesion(self):
|
def fin_adhesion(self):
|
||||||
"""Retourne la date de fin d'adhésion"""
|
"""Retourne la date de fin d'adhésion"""
|
||||||
|
@ -1037,31 +1026,20 @@ class proprio(CransLdapObject):
|
||||||
for bl in self.blacklist_actif():
|
for bl in self.blacklist_actif():
|
||||||
if bl['type'] == 'paiement':
|
if bl['type'] == 'paiement':
|
||||||
return False
|
return False
|
||||||
old_style_paiement = config.ann_scol in self['paiement'] or (config.periode_transitoire and (config.ann_scol - 1) in self['paiement'])
|
|
||||||
if isinstance(self, adherent):
|
if isinstance(self, adherent):
|
||||||
fin_paiement = min(self.fin_adhesion(), self.fin_connexion())
|
fin_paiement = min(self.fin_adhesion(), self.fin_connexion())
|
||||||
else:
|
else:
|
||||||
fin_paiement = self.fin_adhesion()
|
fin_paiement = self.fin_adhesion()
|
||||||
new_style_paiement = time.time() < fin_paiement or (config.periode_transitoire and config.debut_periode_transitoire <= fin_paiement <= config.fin_periode_transitoire)
|
paiement = time.time() < fin_paiement or (config.periode_transitoire and config.debut_periode_transitoire <= fin_paiement <= config.fin_periode_transitoire)
|
||||||
return (old_style_paiement or new_style_paiement)
|
return paiement
|
||||||
|
|
||||||
def carte_ok(self):
|
def carte_ok(self):
|
||||||
u"""Renvoie si le propriétaire a donné sa carte pour l'année en cours, en prenant en compte les periode transitoires et le sursis carte"""
|
"""Dummy"""
|
||||||
if self.dn == variables.base_dn:
|
|
||||||
return True
|
return True
|
||||||
elif 'club' in self["objectClass"]:
|
|
||||||
return True
|
|
||||||
elif config.periode_transitoire or not config.bl_carte_et_actif:
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
return bool(self.get('carteEtudiant', [])) or self.sursis_carte()
|
|
||||||
|
|
||||||
def carte_controle(self):
|
def carte_controle(self):
|
||||||
u"""Renvoie si la carte a été controlé pour l'année en cours par le trésorier"""
|
"""Dummy"""
|
||||||
if self["controle"]:
|
return True
|
||||||
return "c" in str(self["controle"][0])
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
|
|
||||||
# TODO: gérer cela en modifiant un attribut ?
|
# TODO: gérer cela en modifiant un attribut ?
|
||||||
def solde(self, diff, comment=u"", login=None):
|
def solde(self, diff, comment=u"", login=None):
|
||||||
|
|
|
@ -15,6 +15,4 @@
|
||||||
|
|
||||||
{{conn}} {% if o.get('controle', []) and 'p' in o.controle.0.value %}{{"(OK)"|coul('vert')}}{% endif %}
|
{{conn}} {% if o.get('controle', []) and 'p' in o.controle.0.value %}{{"(OK)"|coul('vert')}}{% endif %}
|
||||||
|
|
||||||
{{cetud}} {% if o.get('controle', []) and 'c' in o.controle.0.value %}{{"(OK)"|coul('vert')}}{% endif %}
|
|
||||||
|
|
||||||
{% endblock%}
|
{% endblock%}
|
||||||
|
|
|
@ -227,12 +227,11 @@ def list_adherents(adherents, width=None):
|
||||||
[a['aid'][0],
|
[a['aid'][0],
|
||||||
u' '.join(unicode(i) for i in a['prenom'] + a['nom']),
|
u' '.join(unicode(i) for i in a['prenom'] + a['nom']),
|
||||||
a['chbre'][0], style('o', 'vert') if a.paiement_ok() else style('n', 'rouge'),
|
a['chbre'][0], style('o', 'vert') if a.paiement_ok() else style('n', 'rouge'),
|
||||||
style('o', 'vert') if a.carte_ok() else style('n', 'rouge'),
|
|
||||||
u', '.join(unicode(m['host'][0]).split('.',1)[0] for m in a.machines())
|
u', '.join(unicode(m['host'][0]).split('.',1)[0] for m in a.machines())
|
||||||
] for a in adherents ],
|
] for a in adherents ],
|
||||||
titre = [u'aid', u'Prénom Nom', u'Chbre', u'P', u'C', u'Machines'],
|
titre = [u'aid', u'Prénom Nom', u'Chbre', u'P', u'Machines'],
|
||||||
largeur = [5, 35, 5, 1, 1, '*'],
|
largeur = [5, 35, 5, 1, '*'],
|
||||||
alignement = ['d', 'c', 'c', 'c', 'c', 'g'],
|
alignement = ['d', 'c', 'c', 'c', 'g'],
|
||||||
width=width)
|
width=width)
|
||||||
|
|
||||||
def list_clubs(clubs, width=None):
|
def list_clubs(clubs, width=None):
|
||||||
|
@ -250,16 +249,12 @@ def list_clubs(clubs, width=None):
|
||||||
def proprio(proprio, params):
|
def proprio(proprio, params):
|
||||||
params['o']=proprio
|
params['o']=proprio
|
||||||
etat_administratif=[]
|
etat_administratif=[]
|
||||||
if proprio.paiement_ok() and proprio.carte_ok():
|
if proprio.paiement_ok():
|
||||||
etat_administratif.append(style(u"à jour", "vert"))
|
etat_administratif.append(style(u"à jour", "vert"))
|
||||||
if not proprio.carte_ok():
|
|
||||||
etat_administratif.append(style(u"manque carte d'étudiant", "violet"))
|
|
||||||
if not proprio.paiement_ok():
|
if not proprio.paiement_ok():
|
||||||
etat_administratif.append(style(u"cotisation non réglée", "violet"))
|
etat_administratif.append(style(u"cotisation non réglée", "violet"))
|
||||||
if proprio.fin_adhesion() >= time.time():
|
if proprio.fin_adhesion() >= time.time():
|
||||||
adh = style(u"Adhésion jusqu'au %s" % (time.strftime("%d/%m/%Y %H:%M:%S", time.localtime(proprio.fin_adhesion())),), "vert")
|
adh = style(u"Adhésion jusqu'au %s" % (time.strftime("%d/%m/%Y %H:%M:%S", time.localtime(proprio.fin_adhesion())),), "vert")
|
||||||
elif config.ann_scol in proprio['paiement']:
|
|
||||||
adh = style(u"Adhésion pour la période %s-%s ok." % (config.ann_scol, config.ann_scol+1), "vert")
|
|
||||||
elif proprio.paiement_ok():
|
elif proprio.paiement_ok():
|
||||||
adh = style(u"Adhésion terminée, mais il y a un sursis.", 'orange')
|
adh = style(u"Adhésion terminée, mais il y a un sursis.", 'orange')
|
||||||
else:
|
else:
|
||||||
|
@ -267,27 +262,18 @@ def proprio(proprio, params):
|
||||||
params["adh"] = adh
|
params["adh"] = adh
|
||||||
if proprio.fin_connexion() >= time.time():
|
if proprio.fin_connexion() >= time.time():
|
||||||
conn = style(u"Connexion jusqu'au %s" % (time.strftime("%d/%m/%Y %H:%M:%S", time.localtime(proprio.fin_connexion())),), "vert")
|
conn = style(u"Connexion jusqu'au %s" % (time.strftime("%d/%m/%Y %H:%M:%S", time.localtime(proprio.fin_connexion())),), "vert")
|
||||||
elif config.ann_scol in proprio['paiement']:
|
|
||||||
conn = style(u"Connexion pour la période %s-%s ok." % (config.ann_scol, config.ann_scol+1), "vert")
|
|
||||||
elif proprio.paiement_ok():
|
elif proprio.paiement_ok():
|
||||||
conn = style(u"Connexion terminée, mais il y a un sursis.", 'orange')
|
conn = style(u"Connexion terminée, mais il y a un sursis.", 'orange')
|
||||||
else:
|
else:
|
||||||
conn = style(u"Pas connecté actuellement.", 'rouge')
|
conn = style(u"Pas connecté actuellement.", 'rouge')
|
||||||
params["conn"] = conn
|
params["conn"] = conn
|
||||||
if proprio.get('carteEtudiant', []):
|
params['etat_administratif'] = etat_administratif
|
||||||
cetud = style(u"Carte d'étudiant fournie.", 'vert')
|
|
||||||
elif proprio.sursis_carte() or proprio.carte_ok():
|
|
||||||
cetud = style(u"Carte d'étudiant non fournie, mais en sursis.", 'orange')
|
|
||||||
else:
|
|
||||||
cetud = style(u"Pas de carte d'étudiant")
|
|
||||||
params["cetud"] = cetud
|
|
||||||
params['etat_administratif']=etat_administratif
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if proprio.machines():
|
if proprio.machines():
|
||||||
params['machines']=list_machines(proprio.machines())
|
params['machines'] = list_machines(proprio.machines())
|
||||||
if proprio.factures():
|
if proprio.factures():
|
||||||
params['factures']=list_factures(proprio.factures())
|
params['factures'] = list_factures(proprio.factures())
|
||||||
# On essaye d'afficher un adhérent qui n'existe pas encore
|
# On essaye d'afficher un adhérent qui n'existe pas encore
|
||||||
# et donc, on ne peut pas récupérer ses objets enfant
|
# et donc, on ne peut pas récupérer ses objets enfant
|
||||||
except ldap.NO_SUCH_OBJECT:
|
except ldap.NO_SUCH_OBJECT:
|
||||||
|
|
|
@ -19,7 +19,7 @@ services_to_attrs['filtrage_machines'] = [ attributs.ipHostNumber, attributs.ip6
|
||||||
services_to_attrs['surveillance_machines'] = services_to_attrs['filtrage_machines']
|
services_to_attrs['surveillance_machines'] = services_to_attrs['filtrage_machines']
|
||||||
services_to_attrs['filtrage_exemptions'] = [ attributs.exempt ]
|
services_to_attrs['filtrage_exemptions'] = [ attributs.exempt ]
|
||||||
services_to_attrs['surveillance_exemptions'] = services_to_attrs['filtrage_exemptions']
|
services_to_attrs['surveillance_exemptions'] = services_to_attrs['filtrage_exemptions']
|
||||||
services_to_attrs['macip'] = [ attributs.ipHostNumber, attributs.ip6HostNumber, attributs.macAddress, attributs.paiement, attributs.carteEtudiant, attributs.finConnexion ]
|
services_to_attrs['macip'] = [ attributs.ipHostNumber, attributs.ip6HostNumber, attributs.macAddress, attributs.paiement, attributs.finConnexion ]
|
||||||
services_to_attrs['dns'] = [ attributs.ipHostNumber, attributs.ip6HostNumber, attributs.sshFingerprint, attributs.host, attributs.hostAlias, attributs.dnsIpv6 , attributs.hostCert, attributs.portTCPin, attributs.portUDPin ]
|
services_to_attrs['dns'] = [ attributs.ipHostNumber, attributs.ip6HostNumber, attributs.sshFingerprint, attributs.host, attributs.hostAlias, attributs.dnsIpv6 , attributs.hostCert, attributs.portTCPin, attributs.portUDPin ]
|
||||||
services_to_attrs['blacklist'] = [ attributs.blacklist, attributs.chbre, attributs.mailInvalide ] + services_to_attrs['macip']
|
services_to_attrs['blacklist'] = [ attributs.blacklist, attributs.chbre, attributs.mailInvalide ] + services_to_attrs['macip']
|
||||||
services_to_attrs['ports'] = [ attributs.portUDPout, attributs.portUDPin, attributs.portTCPout, attributs.portTCPin ]
|
services_to_attrs['ports'] = [ attributs.portUDPout, attributs.portUDPin, attributs.portTCPout, attributs.portTCPin ]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue