Aération, indentation.
This commit is contained in:
parent
cb71139d02
commit
4b99950f97
1 changed files with 75 additions and 72 deletions
|
@ -23,6 +23,9 @@ import proprio
|
||||||
from CPS import TailCall, tailcaller, Continue
|
from CPS import TailCall, tailcaller, Continue
|
||||||
|
|
||||||
class Dialog(proprio.Dialog):
|
class Dialog(proprio.Dialog):
|
||||||
|
"""
|
||||||
|
Classe Dialog spécifique aux adhérents pour gest_crans_lc
|
||||||
|
"""
|
||||||
def modif_adherent_blacklist(self, adherent, cont):
|
def modif_adherent_blacklist(self, adherent, cont):
|
||||||
"""Raccourci vers edit_blacklist spécifique aux adherent"""
|
"""Raccourci vers edit_blacklist spécifique aux adherent"""
|
||||||
return self.edit_blacklist(obj=adherent, title="Éditions des blacklist de %s %s" % (adherent['prenom'][0], adherent['nom'][0]), update_obj='adherent', cont=cont)
|
return self.edit_blacklist(obj=adherent, title="Éditions des blacklist de %s %s" % (adherent['prenom'][0], adherent['nom'][0]), update_obj='adherent', cont=cont)
|
||||||
|
@ -216,9 +219,9 @@ class Dialog(proprio.Dialog):
|
||||||
def box_adherer(end=None):
|
def box_adherer(end=None):
|
||||||
if end:
|
if end:
|
||||||
t_end = time.strftime('%d/%m/%Y %H:%M:%S', time.localtime(end))
|
t_end = time.strftime('%d/%m/%Y %H:%M:%S', time.localtime(end))
|
||||||
adherer=self.confirm(text="Adhésion jusqu'au %s. Réadhérer ?" % t_end, title="Adhésion de %s %s" % (adherent.get("prenom", [''])[0], adherent["nom"][0]))
|
adherer = self.confirm(text="Adhésion jusqu'au %s. Réadhérer ?" % t_end, title="Adhésion de %s %s" % (adherent.get("prenom", [''])[0], adherent["nom"][0]))
|
||||||
else:
|
else:
|
||||||
adherer=self.confirm(text="Adhésion pour un an, continuer ?", title="Adhésion de %s %s" % (adherent.get("prenom", [''])[0], adherent["nom"][0]))
|
adherer = self.confirm(text="Adhésion pour un an, continuer ?", title="Adhésion de %s %s" % (adherent.get("prenom", [''])[0], adherent["nom"][0]))
|
||||||
return adherer
|
return adherer
|
||||||
|
|
||||||
def delete_facture(facture, cont):
|
def delete_facture(facture, cont):
|
||||||
|
@ -226,7 +229,7 @@ class Dialog(proprio.Dialog):
|
||||||
with self.conn.search(dn=facture.dn, scope=0, mode='rw')[0] as facture:
|
with self.conn.search(dn=facture.dn, scope=0, mode='rw')[0] as facture:
|
||||||
facture.delete()
|
facture.delete()
|
||||||
raise Continue(cont)
|
raise Continue(cont)
|
||||||
|
|
||||||
# Génération de la facture pour adhésion
|
# Génération de la facture pour adhésion
|
||||||
def paiement(tag_paiement, adherent, finadhesion, comment, cancel_cont, cont):
|
def paiement(tag_paiement, adherent, finadhesion, comment, cancel_cont, cont):
|
||||||
now = time.time()
|
now = time.time()
|
||||||
|
@ -234,11 +237,11 @@ class Dialog(proprio.Dialog):
|
||||||
new_finadhesion = time.mktime(new_finadhesion.replace(year=new_finadhesion.year + config.cotisation.duree_adh_an).timetuple()) + 86400
|
new_finadhesion = time.mktime(new_finadhesion.replace(year=new_finadhesion.year + config.cotisation.duree_adh_an).timetuple()) + 86400
|
||||||
new_debutadhesion = now
|
new_debutadhesion = now
|
||||||
with self.conn.newFacture(adherent.dn, {}) as facture:
|
with self.conn.newFacture(adherent.dn, {}) as facture:
|
||||||
facture['modePaiement']=unicode(tag_paiement, 'utf-8')
|
facture['modePaiement'] = unicode(tag_paiement, 'utf-8')
|
||||||
facture['article'].append(config.cotisation.dico_adh)
|
facture['article'].append(config.cotisation.dico_adh)
|
||||||
facture['info']=unicode(comment, 'utf-8')
|
facture['info'] = unicode(comment, 'utf-8')
|
||||||
facture["finAdhesion"]=unicode(new_finadhesion)
|
facture["finAdhesion"] = unicode(new_finadhesion)
|
||||||
facture["debutAdhesion"]=unicode(new_debutadhesion)
|
facture["debutAdhesion"] = unicode(new_debutadhesion)
|
||||||
if crediter:
|
if crediter:
|
||||||
if self.confirm_item(item=facture,
|
if self.confirm_item(item=facture,
|
||||||
text=u"Le paiement de %sEUR a-t-il bien été reçu (mode : %s) ?\n" % (facture.total(), tag_paiement),
|
text=u"Le paiement de %sEUR a-t-il bien été reçu (mode : %s) ?\n" % (facture.total(), tag_paiement),
|
||||||
|
@ -324,8 +327,8 @@ class Dialog(proprio.Dialog):
|
||||||
if facture:
|
if facture:
|
||||||
with self.conn.search(dn=facture.dn, scope=0, mode='rw')[0] as facture:
|
with self.conn.search(dn=facture.dn, scope=0, mode='rw')[0] as facture:
|
||||||
if mois:
|
if mois:
|
||||||
facture["finConnexion"]=unicode(new_finconnexion)
|
facture["finConnexion"] = unicode(new_finconnexion)
|
||||||
facture["debutConnexion"]=unicode(new_debutconnexion)
|
facture["debutConnexion"] = unicode(new_debutconnexion)
|
||||||
facture["article"].append(config.cotisation.dico_cotis(mois))
|
facture["article"].append(config.cotisation.dico_cotis(mois))
|
||||||
if self.confirm_item(item=facture,
|
if self.confirm_item(item=facture,
|
||||||
text=u"Le paiement de %sEUR a-t-il bien été reçu (mode : %s) ?\n" % (facture.total(), facture['modePaiement'][0]),
|
text=u"Le paiement de %sEUR a-t-il bien été reçu (mode : %s) ?\n" % (facture.total(), facture['modePaiement'][0]),
|
||||||
|
@ -345,11 +348,11 @@ class Dialog(proprio.Dialog):
|
||||||
if not mois:
|
if not mois:
|
||||||
raise ValueError("Il faut prolonger la connexion d'un nombre de mois strictement positif")
|
raise ValueError("Il faut prolonger la connexion d'un nombre de mois strictement positif")
|
||||||
with self.conn.newFacture(adherent.dn, {}) as facture:
|
with self.conn.newFacture(adherent.dn, {}) as facture:
|
||||||
facture['modePaiement']=unicode(tag_paiment, 'utf-8')
|
facture['modePaiement'] = unicode(tag_paiment, 'utf-8')
|
||||||
facture['article'].append(config.cotisation.dico_cotis(mois))
|
facture['article'].append(config.cotisation.dico_cotis(mois))
|
||||||
facture['info']=unicode(comment, 'utf-8')
|
facture['info'] = unicode(comment, 'utf-8')
|
||||||
facture["finConnexion"]=unicode(new_finconnexion)
|
facture["finConnexion"] = unicode(new_finconnexion)
|
||||||
facture["debutConnexion"]=unicode(new_debutconnexion)
|
facture["debutConnexion"] = unicode(new_debutconnexion)
|
||||||
if self.confirm_item(item=facture,
|
if self.confirm_item(item=facture,
|
||||||
text=u"Le paiement de %sEUR a-t-il bien été reçu (mode : %s) ?\n" % (facture.total(), tag_paiment),
|
text=u"Le paiement de %sEUR a-t-il bien été reçu (mode : %s) ?\n" % (facture.total(), tag_paiment),
|
||||||
title=u"Validation du paiement",
|
title=u"Validation du paiement",
|
||||||
|
@ -365,7 +368,7 @@ class Dialog(proprio.Dialog):
|
||||||
if tag == 'An':
|
if tag == 'An':
|
||||||
mois = 12
|
mois = 12
|
||||||
else:
|
else:
|
||||||
mois = int(tag.split(' ',1)[0])
|
mois = int(tag.split(' ', 1)[0])
|
||||||
raise Continue(self_cont(mois=mois, default_item=tag))
|
raise Continue(self_cont(mois=mois, default_item=tag))
|
||||||
|
|
||||||
self_cont = TailCall(self.adherent_connexion, cont=cont, adherent=adherent, cancel_cont=cancel_cont, facture=facture, mois=mois, default_item=default_item, tag_paiment=tag_paiment, comment_paiement=comment_paiement)
|
self_cont = TailCall(self.adherent_connexion, cont=cont, adherent=adherent, cancel_cont=cancel_cont, facture=facture, mois=mois, default_item=default_item, tag_paiment=tag_paiment, comment_paiement=comment_paiement)
|
||||||
|
@ -378,10 +381,10 @@ class Dialog(proprio.Dialog):
|
||||||
# Si l'adhésion fini avant la connexion
|
# Si l'adhésion fini avant la connexion
|
||||||
if finadhesion <= time.time() or finadhesion < finconnexion:
|
if finadhesion <= time.time() or finadhesion < finconnexion:
|
||||||
if finadhesion:
|
if finadhesion:
|
||||||
if finadhesion <= time.time():
|
if finadhesion <= time.time():
|
||||||
self.dialog.msgbox(text=u"L'adhésion a expiré, il va falloir réadhérer d'abord", title="Réadhésion nécessaire", width=0, height=0, timeout=self.timeout)
|
self.dialog.msgbox(text=u"L'adhésion a expiré, il va falloir réadhérer d'abord", title="Réadhésion nécessaire", width=0, height=0, timeout=self.timeout)
|
||||||
elif finadhesion < finconnexion:
|
elif finadhesion < finconnexion:
|
||||||
self.dialog.msgbox(text=u"L'adhésion de termine avant la fin de la connexion, il va falloir réadhérer d'abord", title="Réadhésion nécessaire", width=0, height=0, timeout=self.timeout)
|
self.dialog.msgbox(text=u"L'adhésion de termine avant la fin de la connexion, il va falloir réadhérer d'abord", title="Réadhésion nécessaire", width=0, height=0, timeout=self.timeout)
|
||||||
# Échouera si on essaie de prolonger la connexion au dela de l'adhésion et que l'adhésion est encore valable plus de quinze jours
|
# Échouera si on essaie de prolonger la connexion au dela de l'adhésion et que l'adhésion est encore valable plus de quinze jours
|
||||||
return self.adherent_adhesion(cont=self_cont, cancel_cont=cont, adherent=adherent, crediter=False)
|
return self.adherent_adhesion(cont=self_cont, cancel_cont=cont, adherent=adherent, crediter=False)
|
||||||
if facture:
|
if facture:
|
||||||
|
@ -397,7 +400,7 @@ class Dialog(proprio.Dialog):
|
||||||
codes_todo=[([self.dialog.DIALOG_OK], todo_mois, [tag, self_cont])]
|
codes_todo=[([self.dialog.DIALOG_OK], todo_mois, [tag, self_cont])]
|
||||||
)
|
)
|
||||||
elif tag_paiment or facture:
|
elif tag_paiment or facture:
|
||||||
lcont=self_cont.copy()
|
lcont = self_cont.copy()
|
||||||
if facture:
|
if facture:
|
||||||
lcont(mois=None)
|
lcont(mois=None)
|
||||||
else:
|
else:
|
||||||
|
@ -410,7 +413,7 @@ class Dialog(proprio.Dialog):
|
||||||
codes_todo=[([self.dialog.DIALOG_OK], todo, [adherent, mois, finconnexion, lcont, cont, facture, tag_paiment, comment_paiement])]
|
codes_todo=[([self.dialog.DIALOG_OK], todo, [adherent, mois, finconnexion, lcont, cont, facture, tag_paiment, comment_paiement])]
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
lcont=self_cont.copy()
|
lcont = self_cont.copy()
|
||||||
lcont(mois=None)
|
lcont(mois=None)
|
||||||
return self.proprio_choose_paiement(proprio=adherent, cont=self_cont, cancel_cont=lcont)
|
return self.proprio_choose_paiement(proprio=adherent, cont=self_cont, cancel_cont=lcont)
|
||||||
return cont
|
return cont
|
||||||
|
@ -453,7 +456,7 @@ class Dialog(proprio.Dialog):
|
||||||
else:
|
else:
|
||||||
adherent["controle"] = u"c"
|
adherent["controle"] = u"c"
|
||||||
elif self.has_right(a.tresorier, adherent) and not values["controleCarte"] and adherent.carte_controle():
|
elif self.has_right(a.tresorier, adherent) and not values["controleCarte"] and adherent.carte_controle():
|
||||||
adherent["controle"]=unicode(adherent["controle"][0]).replace('c','')
|
adherent["controle"] = unicode(adherent["controle"][0]).replace('c','')
|
||||||
if not adherent["controle"][0]:
|
if not adherent["controle"][0]:
|
||||||
adherent["controle"] = []
|
adherent["controle"] = []
|
||||||
# Si la carte n'est pas validé ou qu'on est trésorier, on sauvegarde les changements
|
# Si la carte n'est pas validé ou qu'on est trésorier, on sauvegarde les changements
|
||||||
|
@ -462,7 +465,7 @@ class Dialog(proprio.Dialog):
|
||||||
elif not values[a.carteEtudiant.ldap_name] and adherent[a.carteEtudiant.ldap_name] and (not adherent.carte_controle() or self.has_right(a.tresorier, adherent)):
|
elif not values[a.carteEtudiant.ldap_name] and adherent[a.carteEtudiant.ldap_name] and (not adherent.carte_controle() or self.has_right(a.tresorier, adherent)):
|
||||||
adherent[a.carteEtudiant.ldap_name] = []
|
adherent[a.carteEtudiant.ldap_name] = []
|
||||||
if adherent["controle"]:
|
if adherent["controle"]:
|
||||||
adherent["controle"]=unicode(adherent["controle"][0]).replace('c','')
|
adherent["controle"] = unicode(adherent["controle"][0]).replace('c','')
|
||||||
if not adherent["controle"][0]:
|
if not adherent["controle"][0]:
|
||||||
adherent["controle"] = []
|
adherent["controle"] = []
|
||||||
adherent.validate_changes()
|
adherent.validate_changes()
|
||||||
|
@ -512,9 +515,9 @@ class Dialog(proprio.Dialog):
|
||||||
|
|
||||||
def box(make_compte_crans):
|
def box(make_compte_crans):
|
||||||
if force_create and adherent is None and fields_attrs and make_compte_crans is not None:
|
if force_create and adherent is None and fields_attrs and make_compte_crans is not None:
|
||||||
return (self.dialog.DIALOG_OK, [fields_attrs[a] for a,l in to_display], make_compte_crans)
|
return (self.dialog.DIALOG_OK, [fields_attrs[a] for (a, l) in to_display], make_compte_crans)
|
||||||
if adherent:
|
if adherent:
|
||||||
attrs = dict((k,[str(a) for a in at]) for k,at in adherent.items())
|
attrs = dict((k, [str(a) for a in at]) for (k, at) in adherent.items())
|
||||||
if 'cransAccount' in adherent['objectClass']:
|
if 'cransAccount' in adherent['objectClass']:
|
||||||
input_type[attributs.mail] = 2
|
input_type[attributs.mail] = 2
|
||||||
to_display.append((attributs.mailExt, 30))
|
to_display.append((attributs.mailExt, 30))
|
||||||
|
@ -547,7 +550,7 @@ class Dialog(proprio.Dialog):
|
||||||
def modif_adherent(adherent, attrs):
|
def modif_adherent(adherent, attrs):
|
||||||
with self.conn.search(dn=adherent.dn, scope=0, mode='rw')[0] as adherent:
|
with self.conn.search(dn=adherent.dn, scope=0, mode='rw')[0] as adherent:
|
||||||
for (key, values) in attrs.items():
|
for (key, values) in attrs.items():
|
||||||
adherent[key]=values
|
adherent[key] = values
|
||||||
adherent.validate_changes()
|
adherent.validate_changes()
|
||||||
adherent.history_gen()
|
adherent.history_gen()
|
||||||
adherent.save()
|
adherent.save()
|
||||||
|
@ -560,13 +563,13 @@ class Dialog(proprio.Dialog):
|
||||||
newadherent = self.select_one(items, title="Choisir un adhérant existant", text="Des adhérent avec les même noms et prénoms existent déjà, en utiliser un ?\n(Annuler pour continuer la création)", cont=self_cont(make_compte_crans=make_compte_crans, force_create=True))
|
newadherent = self.select_one(items, title="Choisir un adhérant existant", text="Des adhérent avec les même noms et prénoms existent déjà, en utiliser un ?\n(Annuler pour continuer la création)", cont=self_cont(make_compte_crans=make_compte_crans, force_create=True))
|
||||||
raise Continue(cont(adherent=newadherent))
|
raise Continue(cont(adherent=newadherent))
|
||||||
with self.conn.newAdherent({}) as adherent:
|
with self.conn.newAdherent({}) as adherent:
|
||||||
delay={}
|
delay = {}
|
||||||
for (key, values) in attrs.items():
|
for (key, values) in attrs.items():
|
||||||
try:
|
try:
|
||||||
adherent[key]=values
|
adherent[key] = values
|
||||||
# En cas d'erreur, on a peut être besoin du compte crans
|
# En cas d'erreur, on a peut être besoin du compte crans
|
||||||
except ValueError:
|
except ValueError:
|
||||||
delay[key]=values
|
delay[key] = values
|
||||||
print delay
|
print delay
|
||||||
# on récupère la chambre
|
# on récupère la chambre
|
||||||
adherent = self.adherent_chambre_campus(success_cont=None, cont=self_cont(make_compte_crans=make_compte_crans), adherent=adherent, create=True)
|
adherent = self.adherent_chambre_campus(success_cont=None, cont=self_cont(make_compte_crans=make_compte_crans), adherent=adherent, create=True)
|
||||||
|
@ -580,7 +583,7 @@ class Dialog(proprio.Dialog):
|
||||||
adherent = self.proprio_compte_create(proprio=adherent, cont=self_cont(make_compte_crans=None, force_create=False, adherent=None), update_obj='adherent', return_obj=True)
|
adherent = self.proprio_compte_create(proprio=adherent, cont=self_cont(make_compte_crans=None, force_create=False, adherent=None), update_obj='adherent', return_obj=True)
|
||||||
# On réeaffecte les attributs de tout à l'heure
|
# On réeaffecte les attributs de tout à l'heure
|
||||||
for (key, values) in delay.items():
|
for (key, values) in delay.items():
|
||||||
adherent[key]=values
|
adherent[key] = values
|
||||||
# On confirme la création
|
# On confirme la création
|
||||||
if self.confirm_item(adherent, title="Créer l'adhérent suivant ?"):
|
if self.confirm_item(adherent, title="Créer l'adhérent suivant ?"):
|
||||||
adherent.validate_changes()
|
adherent.validate_changes()
|
||||||
|
@ -592,7 +595,7 @@ class Dialog(proprio.Dialog):
|
||||||
def todo(to_display, non_empty, tags, adherent, separateur, make_compte_crans, force_create, self_cont, cont):
|
def todo(to_display, non_empty, tags, adherent, separateur, make_compte_crans, force_create, self_cont, cont):
|
||||||
attrs = {}
|
attrs = {}
|
||||||
# On traite les valeurs reçues
|
# On traite les valeurs reçues
|
||||||
for ((a,l),values) in zip(to_display, tags):
|
for ((a, l), values) in zip(to_display, tags):
|
||||||
if not values and a in non_empty:
|
if not values and a in non_empty:
|
||||||
raise ValueError(u"%s ne devrait pas être vide" % a.legend)
|
raise ValueError(u"%s ne devrait pas être vide" % a.legend)
|
||||||
values = unicode(values, 'utf-8')
|
values = unicode(values, 'utf-8')
|
||||||
|
@ -600,7 +603,7 @@ class Dialog(proprio.Dialog):
|
||||||
# et on ne garde que les valeurs non vides
|
# et on ne garde que les valeurs non vides
|
||||||
if not a.singlevalue:
|
if not a.singlevalue:
|
||||||
values = [v for v in values.split(separateur) if v]
|
values = [v for v in values.split(separateur) if v]
|
||||||
attrs[a.ldap_name]=values
|
attrs[a.ldap_name] = values
|
||||||
if adherent:
|
if adherent:
|
||||||
adherent = modif_adherent(adherent, attrs)
|
adherent = modif_adherent(adherent, attrs)
|
||||||
else:
|
else:
|
||||||
|
@ -613,7 +616,7 @@ class Dialog(proprio.Dialog):
|
||||||
# On prépare les fiels à afficher à l'utilisateur si une erreure à lieu
|
# On prépare les fiels à afficher à l'utilisateur si une erreure à lieu
|
||||||
# pendant le traitement des donnée (on n'éfface pas ce qui a déjà été entré
|
# pendant le traitement des donnée (on n'éfface pas ce qui a déjà été entré
|
||||||
# c'est au cableur de corriger ou d'annuler
|
# c'est au cableur de corriger ou d'annuler
|
||||||
fields_attrs = dict((a, values) for ((a,l),values) in zip(to_display, tags))
|
fields_attrs = dict((a, values) for ((a, l), values) in zip(to_display, tags))
|
||||||
retry_cont = TailCall(self.adherent_personnel, adherent=adherent, cont=cont, fields_attrs=fields_attrs)
|
retry_cont = TailCall(self.adherent_personnel, adherent=adherent, cont=cont, fields_attrs=fields_attrs)
|
||||||
|
|
||||||
return self.handle_dialog_result(
|
return self.handle_dialog_result(
|
||||||
|
@ -644,7 +647,7 @@ class Dialog(proprio.Dialog):
|
||||||
text=u"L'adhérent ci-dessous occupé déjà la chambre %s :\n" % output,
|
text=u"L'adhérent ci-dessous occupé déjà la chambre %s :\n" % output,
|
||||||
text_bottom=u"\nPasser la chambre de cet adhérent en chambre inconnue ?"
|
text_bottom=u"\nPasser la chambre de cet adhérent en chambre inconnue ?"
|
||||||
):
|
):
|
||||||
squatteur['chbre']=u'????'
|
squatteur['chbre'] = u'????'
|
||||||
squatteur.validate_changes()
|
squatteur.validate_changes()
|
||||||
squatteur.history_gen()
|
squatteur.history_gen()
|
||||||
squatteur.save()
|
squatteur.save()
|
||||||
|
@ -654,12 +657,12 @@ class Dialog(proprio.Dialog):
|
||||||
|
|
||||||
def set_chambre(adherent, chbre):
|
def set_chambre(adherent, chbre):
|
||||||
try:
|
try:
|
||||||
adherent['postalAddress']=[]
|
adherent['postalAddress'] = []
|
||||||
adherent['chbre']=unicode(output, 'utf-8')
|
adherent['chbre'] = unicode(output, 'utf-8')
|
||||||
except UniquenessError:
|
except UniquenessError:
|
||||||
if expulse_squatteur(adherent, chbre):
|
if expulse_squatteur(adherent, chbre):
|
||||||
# La chambre est maintenant normalement libre
|
# La chambre est maintenant normalement libre
|
||||||
adherent['chbre']=unicode(output, 'utf-8')
|
adherent['chbre'] = unicode(output, 'utf-8')
|
||||||
else:
|
else:
|
||||||
raise Continue(self_cont)
|
raise Continue(self_cont)
|
||||||
return adherent
|
return adherent
|
||||||
|
@ -698,7 +701,7 @@ class Dialog(proprio.Dialog):
|
||||||
elif keep_machine and keep_compte:
|
elif keep_machine and keep_compte:
|
||||||
def box(values={}):
|
def box(values={}):
|
||||||
form = [("Adresse", 40), ("Compl. adr.", 40), ("Code postal", 7), ("Ville", 16)]
|
form = [("Adresse", 40), ("Compl. adr.", 40), ("Code postal", 7), ("Ville", 16)]
|
||||||
fields = [("%s :" % k, values.get(k, ""), l, 50) for k,l in form]
|
fields = [("%s :" % k, values.get(k, ""), l, 50) for (k, l) in form]
|
||||||
return self.dialog.form(
|
return self.dialog.form(
|
||||||
text="",
|
text="",
|
||||||
timeout=self.timeout,
|
timeout=self.timeout,
|
||||||
|
@ -711,19 +714,19 @@ class Dialog(proprio.Dialog):
|
||||||
if self.dialog.yesno("changer l'adresse de l'adhérent pour %s ?" % ", ".join([o for o in output if o]),
|
if self.dialog.yesno("changer l'adresse de l'adhérent pour %s ?" % ", ".join([o for o in output if o]),
|
||||||
title=u"Déménagement de %s %s" % (adherent['prenom'][0], adherent["nom"][0]),
|
title=u"Déménagement de %s %s" % (adherent['prenom'][0], adherent["nom"][0]),
|
||||||
defaultno=True, timeout=self.timeout) == self.dialog.DIALOG_OK:
|
defaultno=True, timeout=self.timeout) == self.dialog.DIALOG_OK:
|
||||||
with self.conn.search(dn=adherent.dn, scope=0, mode='rw')[0] as adherent:
|
with self.conn.search(dn=adherent.dn, scope=0, mode='rw')[0] as adherent:
|
||||||
adherent['postalAddress']=[unicode(pa, 'utf-8') for pa in output]
|
adherent['postalAddress'] = [unicode(pa, 'utf-8') for pa in output]
|
||||||
adherent['chbre']=u'EXT'
|
adherent['chbre'] = u'EXT'
|
||||||
adherent.validate_changes()
|
adherent.validate_changes()
|
||||||
adherent.history_gen()
|
adherent.history_gen()
|
||||||
adherent.save()
|
adherent.save()
|
||||||
self.display_item(item=adherent, title="Adhérent déménégé hors campus, machines conservées")
|
self.display_item(item=adherent, title="Adhérent déménégé hors campus, machines conservées")
|
||||||
raise Continue(success_cont(adherent=adherent))
|
raise Continue(success_cont(adherent=adherent))
|
||||||
else:
|
else:
|
||||||
raise Continue(cont)
|
raise Continue(cont)
|
||||||
else:
|
else:
|
||||||
adherent['postalAddress']=[unicode(pa, 'utf-8') for pa in output]
|
adherent['postalAddress'] = [unicode(pa, 'utf-8') for pa in output]
|
||||||
adherent['chbre']=u'EXT'
|
adherent['chbre'] = u'EXT'
|
||||||
return adherent
|
return adherent
|
||||||
elif not keep_machine and keep_compte:
|
elif not keep_machine and keep_compte:
|
||||||
if create:
|
if create:
|
||||||
|
@ -741,7 +744,7 @@ class Dialog(proprio.Dialog):
|
||||||
for machine in adherent.machines():
|
for machine in adherent.machines():
|
||||||
with machine:
|
with machine:
|
||||||
machine.delete()
|
machine.delete()
|
||||||
adherent['chbre']=u'EXT'
|
adherent['chbre'] = u'EXT'
|
||||||
adherent.validate_changes()
|
adherent.validate_changes()
|
||||||
adherent.history_gen()
|
adherent.history_gen()
|
||||||
adherent.save()
|
adherent.save()
|
||||||
|
@ -770,7 +773,7 @@ class Dialog(proprio.Dialog):
|
||||||
for machine in adherent.machines():
|
for machine in adherent.machines():
|
||||||
with machine:
|
with machine:
|
||||||
machine.delete()
|
machine.delete()
|
||||||
adherent['chbre']=u'EXT'
|
adherent['chbre'] = u'EXT'
|
||||||
adherent.validate_changes()
|
adherent.validate_changes()
|
||||||
adherent.history_gen()
|
adherent.history_gen()
|
||||||
adherent.save()
|
adherent.save()
|
||||||
|
@ -842,7 +845,7 @@ class Dialog(proprio.Dialog):
|
||||||
cancel_cont=cont,
|
cancel_cont=cont,
|
||||||
error_cont=self_cont,
|
error_cont=self_cont,
|
||||||
codes_todo=[([self.dialog.DIALOG_OK], todo, [tag, menu, adherent, self_cont, cont])]
|
codes_todo=[([self.dialog.DIALOG_OK], todo, [tag, menu, adherent, self_cont, cont])]
|
||||||
)
|
)
|
||||||
|
|
||||||
def create_adherent(self, cont):
|
def create_adherent(self, cont):
|
||||||
"""Crée un adhérent et potentiellement son compte crans avec lui"""
|
"""Crée un adhérent et potentiellement son compte crans avec lui"""
|
||||||
|
@ -897,7 +900,7 @@ class Dialog(proprio.Dialog):
|
||||||
def todo(droits, adherent, self_cont, cont):
|
def todo(droits, adherent, self_cont, cont):
|
||||||
# Les vérifications de sécurité sont faites dans lc_ldap
|
# Les vérifications de sécurité sont faites dans lc_ldap
|
||||||
with self.conn.search(dn=adherent.dn, scope=0, mode='rw')[0] as adherent:
|
with self.conn.search(dn=adherent.dn, scope=0, mode='rw')[0] as adherent:
|
||||||
adherent['droits']=[unicode(d) for d in droits]
|
adherent['droits'] = [unicode(d) for d in droits]
|
||||||
adherent.validate_changes()
|
adherent.validate_changes()
|
||||||
adherent.history_gen()
|
adherent.history_gen()
|
||||||
adherent.save()
|
adherent.save()
|
||||||
|
@ -949,7 +952,7 @@ class Dialog(proprio.Dialog):
|
||||||
|
|
||||||
def choices(max_annee):
|
def choices(max_annee):
|
||||||
c = []
|
c = []
|
||||||
if max_annee>=1:
|
if max_annee >= 1:
|
||||||
c.append(('1', '1ère année'))
|
c.append(('1', '1ère année'))
|
||||||
for i in range(2, max_annee+1):
|
for i in range(2, max_annee+1):
|
||||||
c.append((str(i), "%sème année" % i))
|
c.append((str(i), "%sème année" % i))
|
||||||
|
@ -1005,16 +1008,16 @@ class Dialog(proprio.Dialog):
|
||||||
]
|
]
|
||||||
|
|
||||||
def box_etablissement(default_item):
|
def box_etablissement(default_item):
|
||||||
if etablissement == 'Autre' or \
|
if etablissement == 'Autre' or \
|
||||||
(etablissement is not None and etablissement not in [i[0] for i in choices_etablissement]) or \
|
(etablissement is not None and etablissement not in [i[0] for i in choices_etablissement]) or \
|
||||||
(default_item is not None and default_item not in [i[0] for i in choices_etablissement]):
|
(default_item is not None and default_item not in [i[0] for i in choices_etablissement]):
|
||||||
return self.dialog.inputbox(
|
return self.dialog.inputbox(
|
||||||
text="Choisissez l'établissement :",
|
text="Choisissez l'établissement :",
|
||||||
title="Études de %s %s" % (adherent['prenom'][0], adherent["nom"][0]),
|
title="Études de %s %s" % (adherent['prenom'][0], adherent["nom"][0]),
|
||||||
timeout=self.timeout,
|
timeout=self.timeout,
|
||||||
init=str(default_item) if default_item else "")
|
init=str(default_item) if default_item else "")
|
||||||
else:
|
else:
|
||||||
return self.dialog.menu(
|
return self.dialog.menu(
|
||||||
"Choisissez l'établissement :",
|
"Choisissez l'établissement :",
|
||||||
width=0,
|
width=0,
|
||||||
height=0,
|
height=0,
|
||||||
|
@ -1029,26 +1032,26 @@ class Dialog(proprio.Dialog):
|
||||||
choices=choices_etablissement)
|
choices=choices_etablissement)
|
||||||
|
|
||||||
def box_annee(default_item):
|
def box_annee(default_item):
|
||||||
if etablissement in LMD:
|
if etablissement in LMD:
|
||||||
box_choice = choices_LMD
|
box_choice = choices_LMD
|
||||||
elif etablissement in LM:
|
elif etablissement in LM:
|
||||||
box_choice = choices_LM
|
box_choice = choices_LM
|
||||||
elif etablissement in LYCEE:
|
elif etablissement in LYCEE:
|
||||||
box_choice = choices_LYCEE
|
box_choice = choices_LYCEE
|
||||||
elif etablissement == 'ENS':
|
elif etablissement == 'ENS':
|
||||||
box_choice = choices_ENS
|
box_choice = choices_ENS
|
||||||
else:
|
else:
|
||||||
box_choice = choices(7)
|
box_choice = choices(7)
|
||||||
if not box_choice or annee == 'Autre' or \
|
if not box_choice or annee == 'Autre' or \
|
||||||
(annee is not None and annee not in [i[0] for i in box_choice]) or \
|
(annee is not None and annee not in [i[0] for i in box_choice]) or \
|
||||||
(default_item is not None and default_item not in [i[0] for i in box_choice]):
|
(default_item is not None and default_item not in [i[0] for i in box_choice]):
|
||||||
return self.dialog.inputbox(
|
return self.dialog.inputbox(
|
||||||
text="Choisissez l'année administrative :",
|
text="Choisissez l'année administrative :",
|
||||||
title="Études de %s %s" % (adherent['prenom'][0], adherent["nom"][0]),
|
title="Études de %s %s" % (adherent['prenom'][0], adherent["nom"][0]),
|
||||||
timeout=self.timeout,
|
timeout=self.timeout,
|
||||||
init=str(default_item) if default_item else "")
|
init=str(default_item) if default_item else "")
|
||||||
else:
|
else:
|
||||||
return self.dialog.menu(
|
return self.dialog.menu(
|
||||||
"Choisissez l'année administrative :",
|
"Choisissez l'année administrative :",
|
||||||
width=0,
|
width=0,
|
||||||
height=0,
|
height=0,
|
||||||
|
@ -1072,7 +1075,7 @@ class Dialog(proprio.Dialog):
|
||||||
timeout=self.timeout,
|
timeout=self.timeout,
|
||||||
init=str(default_item) if default_item else "")
|
init=str(default_item) if default_item else "")
|
||||||
else:
|
else:
|
||||||
return self.dialog.menu(
|
return self.dialog.menu(
|
||||||
"Choisissez la section :",
|
"Choisissez la section :",
|
||||||
width=0,
|
width=0,
|
||||||
height=0,
|
height=0,
|
||||||
|
@ -1123,7 +1126,7 @@ class Dialog(proprio.Dialog):
|
||||||
else:
|
else:
|
||||||
if not adherent["etudes"] or adherent["etudes"][0] != etablissement or adherent["etudes"][1] != annee or adherent["etudes"][2] != section:
|
if not adherent["etudes"] or adherent["etudes"][0] != etablissement or adherent["etudes"][1] != annee or adherent["etudes"][2] != section:
|
||||||
with self.conn.search(dn=adherent.dn, scope=0, mode='rw')[0] as adherent:
|
with self.conn.search(dn=adherent.dn, scope=0, mode='rw')[0] as adherent:
|
||||||
adherent["etudes"]=[unicode(etablissement), unicode(annee), unicode(section)]
|
adherent["etudes"] = [unicode(etablissement), unicode(annee), unicode(section)]
|
||||||
adherent.validate_changes()
|
adherent.validate_changes()
|
||||||
adherent.history_gen()
|
adherent.history_gen()
|
||||||
adherent.save()
|
adherent.save()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue