[gest_crans] gestion du G pour les cableurs

Les adherents du G:
 * ont droit a deux machines fixes
 * ont le droit d'avoir une machine fixe avec une adresse MAC existante

darcs-hash:20091119015646-61eff-68439c87acca656328d94d574d5a9dbe3b8ec954.gz
This commit is contained in:
Stephane Glondu 2009-11-19 02:56:46 +01:00
parent d3501e0754
commit 6d83c7aef0

View file

@ -1412,7 +1412,8 @@ def set_machine(machine):
try: machine.mac(result[1])
except ValueError, c:
if len(c.args)>1 and c.args[1] == 1 and isadm:
if len(c.args)>1 and c.args[1] == 1 \
and (isadm or machine.proprietaire().chbre()[0] == 'G'):
# Mac en double
arg = u'--title "Adresse MAC" '
arg += u'--yesno "L\'adresse MAC existe déja, continuer ? \n" 0 0'
@ -2084,6 +2085,7 @@ def menu_principal():
# déjà une machine fixe, sauf si on est membre actif
# (expérimental)
machines_fixes = proprio.machines_fixes()
if not isinstance(proprio, Club) and not proprio.adherentPayant():
# Les gens qui ne paient pas n'ont le droit qu'à une
# seule machine fixe
@ -2092,7 +2094,11 @@ def menu_principal():
continue
else:
choix = "Fixe"
elif isinstance(proprio, Club) or not proprio.machines_fixes() or proprio.droits() or proprio.etudes(0) == 'Personnel ENS':
elif isinstance(proprio, Club) \
or not machines_fixes \
or proprio.droits() \
or proprio.etudes(0) == 'Personnel ENS' \
or (proprio.chbre()[0] == 'G' and len(machines_fixes) < 2):
arg = u'--title "Nouvelle machine" '
arg += u'--menu "Type de machine ?" 0 0 0 '
arg += u'"Fixe" "Machine fixe" '