Passage aux adhésions glissantes (partie I, sans lc_ldap)

This commit is contained in:
Pierre-Elliott Bécue 2014-08-15 20:26:12 +02:00
parent 169b7000b8
commit 49cef4c095
12 changed files with 485 additions and 231 deletions

View file

@ -179,17 +179,13 @@ def adhers_brief(adhers) :
ook = u'\x1b[1;32mO\x1b[1;0m'
nok = u'\x1b[1;31mn\x1b[1;0m'
# Paiement
if ann_scol in a.paiement():
if a.adhesion() > time() or a.paiement():
if 'p' in a.controle(): paid = ook
else: paid = ok
elif isinstance(a,Adherent) and not a.adherentPayant(): paid = coul('G', 'bleu')
else: paid = nok
# Précablage
if ann_scol+1 in a.paiement() : paid = coul(paid,'f_vert')
# Carte d'étudiant
if ann_scol in a.carteEtudiant():
if a.carteEtudiant():
if 'c' in a.controle(): carte = ook
else: carte = ok
else : carte = nok
@ -254,11 +250,8 @@ def machines_brief(machines) :
p = a.Nom()
# A jour administrativement
if ann_scol not in a.paiement() or ann_scol not in a.carteEtudiant():
if isinstance(a, Adherent) and not a.adherentPayant():
p = coul(p, 'bleu')
else:
p = coul(p,'rouge')
if (a.adhesion() > time() and ann_scol not in a.paiement()) or not a.carteEtudiant():
p = coul(p,'rouge')
# Données
data.append([m.id(), m.rid() , t, m.nom().split('.')[0], p, a.chbre(), bl])
@ -515,24 +508,22 @@ def adher_details(adher) :
f += u"\n"
# État administratif
f += coul("Date d'inscription : ", "gras")
f += coul(u"Date d'inscription : ", "gras")
f += strftime('%d/%m/%Y %H:%M:%S', localtime(adher.dateInscription()))
f += coul(u'\nÉtat administratif : ','gras')
jour=1
if ann_scol not in adher.carteEtudiant() :
jour = True
if not adher.carteEtudiant() :
f += coul(u"manque carte d'étudiant",'violet')
jour = 0
if ann_scol not in adher.paiement() :
if not jour : f += ' et '
if isinstance(adher, Adherent) and not adher.adherentPayant():
f += coul(u"inscription gratuite ", 'bleu')
jour = False
if ann_scol not in adher.paiement() and (adher.adhesion() <= time()):
if not jour: f += ' et '
else:
f += coul(u"cotisation %s/%d non réglée"% (ann_scol, ann_scol+1 ),'violet')
jour = 0
f += coul(u"Non adhérent actuellement.",'violet')
jour = False
if jour :
if jour:
f += coul(u"à jour",'vert')
f += '\n'
f += "\n"
# Telephone
tel = adher.tel()
@ -591,30 +582,25 @@ def adher_details(adher) :
f += coul(u" (droits gelés car pas cotisé cette année)",'bleu')
f += u'\n'
# Adhésion
if adher.adhesion() > time():
f += coul(u"Adhésion jusqu'au %s" % strftime("%d/%m/%Y %H:%M:%S", localtime(adher.adhesion())), "vert")
f += u"\n"
elif adher.paiement():
f += coul(u"Paiement pour %s/%s ok (connexion inclue)" % (ann_scol, ann_scol+1), "vert")
f += u"\n"
# Paiement
if adher.paiement() :
if len(adher.paiement()) == 1 :
f += coul(u'Cotisation payée pour l\'année scolaire :','gras')
else :
f += coul(u'Cotisation payée pour les années scolaires :','gras')
g = u''
for an in adher.paiement() : g += u" %i-%i" % ( an, an+1 )
if len(g) > 35 : f += '\n\t'
f += g
if 'p' in adher.controle(): f += coul(u' (OK)', 'vert')
if adher.connexion() > time():
f += coul(u"Connexion jusqu'au %s" % strftime("%d/%m/%Y %H:%M:%S", localtime(adher.adhesion())), "vert")
if adher.adhesion() < adher.connexion():
f += coul(u"(Théoriquement %s, sous réserve de réadhésion)" % (strftime("%d/%m/%Y %H:%M:%S", localtime(adher.connexion())),), "rouge")
f += u'\n'
# Cartes d'étudiant fournie
if adher.carteEtudiant() :
if len(adher.carteEtudiant()) == 1 :
f += coul(u"Carte d'étudiant fournie pour l'année scolaire :",'gras')
else :
f += coul(u"Carte d'étudiant fournie pour les années scolaires :",'gras')
g = u''
for an in adher.carteEtudiant() : g += u" %i-%i" % ( an, an+1 )
if len(g) > 25 : f += '\n\t'
f += g
if 'c' in adher.controle(): f += coul(u' (OK)', 'vert')
# Carte d'étudiant fournie
if adher.carteEtudiant():
f += coul(u"Carte d'étudiant fournie.",'gras')
if 'c' in adher.controle(): f += coul(u' (Contrôle OK)', 'vert')
f += u'\n'
f += _blacklist(adher)
@ -820,13 +806,12 @@ def club_details(club) :
# État administratif
f += coul(u'État administratif : ','gras')
jour=1
if ann_scol not in club.paiement() :
if not jour : f += ' et '
f += coul(u"charte %s/%d non signée"% (ann_scol, ann_scol+1 ),'violet')
jour = 0
jour = True
if club.adhesion() < time() and not club.paiement():
jour = False
f += coul(u"Non adhérent." ,'violet')
if jour :
if jour:
f += coul(u"à jour",'vert')
f += '\n'
@ -843,14 +828,12 @@ def club_details(club) :
f += coul(u'VLAN : ','gras') + u'%s' % vlans
f += u'\n'
# Paiement
if club.paiement() :
f += coul(u'Charte signée pour les années scolaires :','gras')
g = ''
for an in club.paiement() : g += " %i-%i" % ( an, an+1 )
if len(g) > 35 : f += '\n\t'
f += g
if 'p' in club.controle(): f += coul(u' (OK)', 'vert')
# Adhésion
if club.adhesion() > time():
f += coul(u"Adhésion jusque %s." % (strftime("%d/%m/%Y %H:%M:%S", localtime(club.adhesion())),), "vert")
f += '\n'
elif ann_scol in club.paiement():
f += coul(u"Adhésion pour l'année en cours", "vert")
f += '\n'
login = club.compte()
@ -883,6 +866,14 @@ def club_details(club) :
else :
f += 'aucune'
f += u"\n"
f += coul(u'Facture(s) : ','gras')
m = club.factures()
if m :
f += u'\n' + list_factures(m)
else :
f += u'aucune'
return f
###########################################
@ -1014,8 +1005,6 @@ def borne_clients_canal(borne) :
wl = subprocess.Popen("ssh -o StrictHostKeyChecking=no -i %s root@%s 'cat /tmp/auth-mac.dump ; echo -n \"CANAL \" ; /usr/sbin/nvram get wl0_channel'" % (clef, borne), shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
wl.stdin.close()
for line in wl.stdout.readlines():
print 'coucou'
print line
# Chaque ligne est de la forme
# 00:11:22:33:44:55 -20
line = line.strip().split()