Front-end pour les oprations/visualisation du solde
Droits imrpimeur pour pourvoir crditer/dbiter un compte. darcs-hash:20050212183442-41617-26b8acd481fe3f71b095ec5c69bf9293ef9fbff6.gz
This commit is contained in:
parent
e19194147e
commit
60be2b4c14
4 changed files with 63 additions and 44 deletions
|
@ -32,6 +32,11 @@ from ldap_crans import adherent, machine, crans_ldap, crans, club, blacklist_ite
|
|||
def dialog(arg) :
|
||||
return affich_tools.dialog(u'Gestion des adhérents et machines du Crans',arg)
|
||||
|
||||
try:
|
||||
isimprimeur = u"Imprimeur" in crans_ldap().search("uid=%s" % script_utilisateur)['adherent'][0].droits()
|
||||
except:
|
||||
imprimeur = False
|
||||
|
||||
#########################################################################
|
||||
## Fonctions de remplissage ou modification des paramètres d'un adhérent
|
||||
|
||||
|
@ -461,23 +466,7 @@ def set_droits(adher) :
|
|||
|
||||
# Traitement
|
||||
adher.droits(result)
|
||||
|
||||
def set_shell(adher) :
|
||||
""" Modification du shell d'un adhérent """
|
||||
while 1 :
|
||||
arg = u'--title "Nouveau shell pour %s" ' % adher.Nom()
|
||||
arg+= u'--inputbox "Shell : " 0 0 "%s" ' % adher.chsh()
|
||||
annul,res = dialog(arg)
|
||||
if annul : return 1
|
||||
|
||||
try :
|
||||
adher.chsh(res[0])
|
||||
break
|
||||
except ValueError, c :
|
||||
arg = u'--title "Changement du shell de %s" ' % adher.Nom()
|
||||
arg+= u'--msgbox "%s\n\n\n" 0 0' % c.args[0]
|
||||
dialog(arg)
|
||||
|
||||
|
||||
def set_adresse(adher) :
|
||||
""" Modification de l'édresse d'un adhérent """
|
||||
arg = u'--title "Déménagement de %s" ' % adher.Nom()
|
||||
|
@ -711,7 +700,23 @@ def __prompt_input_menu(method,titre,prompt) :
|
|||
arg+= u'--msgbox "%s\n\n\n" 0 0' % c.args[0]
|
||||
dialog(arg)
|
||||
return __prompt_input_menu(method,titre,prompt)
|
||||
|
||||
|
||||
def set_solde(clas) :
|
||||
""" Débit ou crédit d'un compte """
|
||||
while 1 :
|
||||
arg = u'--title "Crédit / débit du compte de %s" ' % clas.Nom()
|
||||
arg+= u'--inputbox "Solde actuel : %s\n Opération à effectuer (+ pour crédits et - pour débit) ?" 0 0 "" ' % clas.solde()
|
||||
annul,res = dialog(arg)
|
||||
if annul : return 1
|
||||
|
||||
try:
|
||||
clas.solde(res[0])
|
||||
break
|
||||
except ValueError, c :
|
||||
arg = u'--title "Opération impossible" '
|
||||
arg+= u'--msgbox "%s\n\n\n" 0 0' % c.args[0]
|
||||
dialog(arg)
|
||||
|
||||
def confirm(clas) :
|
||||
""" Demande confirmation avant enregistrement"""
|
||||
# On va faire en texte, les couleurs ne passent pas en curses
|
||||
|
@ -916,10 +921,11 @@ def modif_club(club) :
|
|||
arg+= u'"Compte" "Créer un compte sur zamok" '
|
||||
if club.compte() :
|
||||
arg+= u'"Alias" "Créer ou supprimer un alias mail" '
|
||||
#if isadm and club.compte() :
|
||||
# arg+= u'"Shell" "Changer le shell du club" '
|
||||
if isdeconnecteur :
|
||||
arg+= u'"Blackliste" "Modifier la blackliste du club" '
|
||||
if isimprimeur :
|
||||
arg+= u'"Solde" "Effectuer un débit/crédit pour ce club" '
|
||||
|
||||
arg+= u'"Remarque" "Ajouter ou modifer un commentaire" '
|
||||
annul, res = dialog(arg)
|
||||
|
||||
|
@ -941,8 +947,8 @@ def modif_club(club) :
|
|||
set_local(club)
|
||||
elif res[0]=='Alias' :
|
||||
__prompt_input_menu(club.alias,'Alias mail', "Entrez ou modifier un alias mail.\nPour ajouter un alias modifier le dernier de la liste.")
|
||||
#elif res[0]=='Shell' :
|
||||
# set_shell(club)
|
||||
elif res[0]=='Solde' :
|
||||
set_solde(club)
|
||||
|
||||
if club.modifs :
|
||||
return confirm(club)
|
||||
|
@ -1193,6 +1199,9 @@ def modif_adher(adher) :
|
|||
arg+= u'"Shell" "Changer le shell de cet utilisateur" '
|
||||
if isdeconnecteur :
|
||||
arg+= u'"Blackliste" "Modifier la blackliste de cet adhérent" '
|
||||
if isimprimeur :
|
||||
arg+= u'"Solde" "Effectuer un débit/crédit pour cet adhérent" '
|
||||
|
||||
annul, res = dialog(arg)
|
||||
|
||||
if annul : return 1
|
||||
|
@ -1297,6 +1306,9 @@ def modif_adher(adher) :
|
|||
arg = u'--title "Changement du shell de %s" ' % adher.Nom()
|
||||
arg+= u'--msgbox "%s\n\n\n" 0 0' % c.args[0]
|
||||
dialog(arg)
|
||||
|
||||
elif res[0]=='Solde' :
|
||||
set_solde(adher)
|
||||
|
||||
if adher.modifs :
|
||||
return confirm(adher)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue