En mode bref affiche deux colonnes, une pour adhésion et une pour connexion.

This commit is contained in:
Pierre-Elliott Bécue 2015-08-26 19:06:46 +02:00
parent 1353f00e17
commit 4a3434847e
2 changed files with 49 additions and 20 deletions

View file

@ -1054,6 +1054,17 @@ class proprio(CransLdapObject):
if facture.get('controle', [''])[0] != u"FALSE" and facture.get('recuPaiement', [''])[0] != ''
] + [0.0])
def adhesion_ok(self, no_bl=False):
"""Renvoie si le propriétaire a une adhésion en cours."""
if self.dn == variables.base_dn:
return True
fin_paiement = self.fin_adhesion()
paiement = time.time() < fin_paiement or (config.periode_transitoire and config.debut_periode_transitoire <= fin_paiement <= config.fin_periode_transitoire)
return paiement
def paiement_ok(self, no_bl=False):
u"""
Renvoie si le propriétaire a payé pour l'année en cours, en prenant en compte les périodes de transition et les blacklistes.
@ -1061,15 +1072,19 @@ class proprio(CransLdapObject):
"""
if self.dn == variables.base_dn:
return True
if not no_bl:
for bl in self.blacklist_actif():
if bl['type'] == 'paiement':
return False
if isinstance(self, adherent):
fin_paiement = min(self.fin_adhesion(), self.fin_connexion())
else:
fin_paiement = self.fin_adhesion()
paiement = time.time() < fin_paiement or (config.periode_transitoire and config.debut_periode_transitoire <= fin_paiement <= config.fin_periode_transitoire)
return paiement
def carte_ok(self):

View file

@ -223,28 +223,42 @@ def list_factures(factures, width=None):
width=width)
def list_adherents(adherents, width=None):
return tableau([
[a['aid'][0],
return tableau(
[
[
a['aid'][0],
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'),
u', '.join(unicode(m['host'][0]).split('.',1)[0] for m in a.machines())
] for a in adherents ],
titre = [u'aid', u'Prénom Nom', u'Chbre', u'P', u'Machines'],
largeur = [5, 35, 5, 1, '*'],
alignement = ['d', 'c', 'c', 'c', 'g'],
width=width)
a['chbre'][0],
style('o', 'vert') if a.adhesion_ok() else style('n', 'rouge'),
style('o', 'vert') if a.paiement_ok() else style('n', 'rouge'),
u', '.join(unicode(m['host'][0]).split('.', 1)[0] for m in a.machines())
]
for a in adherents
],
titre=[u'aid', u'Prénom Nom', u'Chbre', u'A', u'C', u'Machines'],
largeur=[5, 35, 5, 1, 1, '*'],
alignement=['d', 'c', 'c', 'c', 'c', 'g'],
width=width
)
def list_clubs(clubs, width=None):
return tableau([
[a['cid'][0],
return tableau(
[
[
a['cid'][0],
u' '.join(unicode(i) for i in a['nom']),
a['chbre'][0], style('o', 'vert') if a.paiement_ok() else style('n', 'rouge'),
a['chbre'][0],
style('o', 'vert') if a.adhesion_ok() else style('n', 'rouge'),
style('o', 'vert') if a.paiement_ok() else style('n', 'rouge'),
u', '.join(unicode(m['host'][0]).split('.',1)[0] for m in a.machines())
] for a in clubs ],
titre = [u'cid', u'Nom', u'Chbre', u'P', u'Machines'],
largeur = [5, 35, 5, 1, '*'],
alignement = ['d', 'c', 'c', 'c', 'g'],
width=width)
]
for a in clubs
],
titre = [u'cid', u'Nom', u'Chbre', u'A', u'C', u'Machines'],
largeur = [5, 35, 5, 1, 1, '*'],
alignement = ['d', 'c', 'c', 'c', 'c', 'g'],
width=width
)
def proprio(proprio, params):
params['o']=proprio