Rcriture de lq gestion des paeiment, caution, cartes et controles par
Stphane. darcs-hash:20051124213903-41617-781717ec267d0cef485c9b46e49dc349184f83ca.gz
This commit is contained in:
parent
0b83d903ae
commit
3389461b0b
1 changed files with 85 additions and 76 deletions
|
@ -883,86 +883,93 @@ def set_blackliste(clas) :
|
|||
##########################################################################
|
||||
## Fonction de remplissage ou modification des paramètres club ou adhérent
|
||||
|
||||
def set_admin(proprio) :
|
||||
def on_off(condition):
|
||||
"""
|
||||
Renvoie 'on' ou 'off' selon la condition (pour dialog).
|
||||
"""
|
||||
if condition:
|
||||
return 'on'
|
||||
else:
|
||||
return 'off'
|
||||
|
||||
def set_admin(proprio):
|
||||
"""
|
||||
Définition de l'état administratif : carte d'étudiant, paiement
|
||||
et caution.
|
||||
"""
|
||||
# Le propriétaire est-il un personnel de l'ENS ?
|
||||
personnel = proprio.etudes(0) == "ENS" and proprio.etudes(1) == "Pers"
|
||||
is_personnel = proprio.etudes(0) == "ENS" and proprio.etudes(1) == "Pers"
|
||||
|
||||
# Le proprietaire a t-il une section carte d'étudiant ?
|
||||
# Pas pour les clubs
|
||||
if proprio.idn != 'cid':
|
||||
card = 1
|
||||
else :
|
||||
card = 0
|
||||
# Le proprietaire a-t-il une section carte d'étudiant (pas les clubs) ?
|
||||
has_card = proprio.idn != 'cid'
|
||||
|
||||
# Initialisation
|
||||
if card and ann_scol in proprio.carteEtudiant() : carte='on'
|
||||
else : carte='off'
|
||||
# Initialisation des différentes checkbox
|
||||
carte = on_off(ann_scol in proprio.carteEtudiant())
|
||||
paiement = on_off(ann_scol in proprio.paiement())
|
||||
precab = on_off(ann_scol+1 in proprio.paiement())
|
||||
caution = on_off('k' in proprio.controle())
|
||||
paiement_ok = on_off('p' in proprio.controle())
|
||||
carte_ok = on_off('c' in proprio.controle())
|
||||
|
||||
if ann_scol in proprio.paiement() : paid_now='on'
|
||||
else : paid_now='off'
|
||||
|
||||
if ann_scol+1 in proprio.paiement() : precab='on'
|
||||
else : precab='off'
|
||||
|
||||
txt = []
|
||||
if 'p' in proprio.controle():
|
||||
txt.append(u'Cotisation vérifiée')
|
||||
paid_ok = 'on'
|
||||
else:
|
||||
paid_ok = 'off'
|
||||
|
||||
if 'k' in proprio.controle():
|
||||
txt.append(u'Caution payée')
|
||||
caution_ok = 'on'
|
||||
else:
|
||||
caution_ok = 'off'
|
||||
|
||||
if 'c' in proprio.controle():
|
||||
txt.append(u'Carte vérifiée')
|
||||
carte_ok = 'on'
|
||||
else:
|
||||
carte_ok = 'off'
|
||||
|
||||
if iscontroleur: txt = []
|
||||
|
||||
if len(txt) == 3 :
|
||||
# Il n'y a rien à demander
|
||||
dialog(u'--title "État administratif de %s non modifiable" --msgbox "%s\n" 0 0 ' % (proprio.Nom(), '\n'.join(txt)))
|
||||
return
|
||||
|
||||
arg = u'--title "Etat administratif de %s" ' % proprio.Nom()
|
||||
arg+= u'--separate-output '
|
||||
arg+= u'--checklist "%s" 0 0 0 ' % '\n'.join(txt)
|
||||
# Construction de la boîte de dialogue
|
||||
texte = []
|
||||
checklist = []
|
||||
|
||||
if carte_ok == 'off' or iscontroleur:
|
||||
if personnel:
|
||||
arg+= u'"1" "Preuve informelle d\'appartenance aux personnels de l\'ENS" "%s" ' % carte
|
||||
elif card:
|
||||
arg+= u'"1" "Carte d\'étudiant %d/%d fournie" "%s" ' % (ann_scol,ann_scol+1, carte)
|
||||
if is_personnel:
|
||||
checklist.append(u'"1" "Preuve informelle d\'appartenance au personnel de l\'ENS" "%s"' % carte)
|
||||
else:
|
||||
checklist.append(u'"1" "Carte d\'étudiant %d/%d fournie" "%s"' %
|
||||
(ann_scol, ann_scol+1, carte))
|
||||
else:
|
||||
texte.append(u'Carte vérifiée')
|
||||
|
||||
if paid_ok == 'off' or iscontroleur:
|
||||
arg+= u'"2" "Adhésion %d/%d réglée et charte signée" "%s" ' % (ann_scol,ann_scol+1,paid_now)
|
||||
if config.precab == 1 :
|
||||
arg+= u'"3" "Adhésion %d/%d réglée et charte signée (précâblage)" "%s" ' % (ann_scol+1,ann_scol+2,precab)
|
||||
if paiement_ok == 'off' or iscontroleur:
|
||||
checklist.append(u'"2" "Cotisation %d/%d réglée et charte signée" "%s"' %
|
||||
(ann_scol, ann_scol+1, paiement_ok))
|
||||
else:
|
||||
texte.append(u'Cotisation/charte/caution vérifiées')
|
||||
|
||||
if iscontroleur or (caution_ok == 'off' and not personnel):
|
||||
arg+= u'"C" "Caution payée" "%s" ' % caution_ok
|
||||
# TODO: controle pour le précâblage
|
||||
if config.precab == 1:
|
||||
checklist.append(u'"3" "Adhésion %d/%d réglée et charte signée (précâblage)" "%s"' %
|
||||
(ann_scol+1, ann_scol+2, precab))
|
||||
|
||||
if (caution == 'off' and not is_personnel) or iscontroleur:
|
||||
checklist.append(u'"C" "Caution payée" "%s"' % caution)
|
||||
else:
|
||||
texte.append(u'Caution payée')
|
||||
|
||||
if iscontroleur:
|
||||
if card: arg += u'"4" "Vérification de la carte d\'étudiant effectuée" "%s" ' % carte_ok
|
||||
arg += u'"5" "Vérification de la cotisation/charte effectuée" "%s" ' % paid_ok
|
||||
if has_card:
|
||||
checklist.append(u'"4" "Carte d\'étudiant vérifiée" "%s"' % carte_ok)
|
||||
checklist.append(u'"5" "Cotisation/charte/caution vérifées" "%s"' % paiement_ok)
|
||||
|
||||
annul , result = dialog(arg)
|
||||
if annul : return 1
|
||||
if not checklist:
|
||||
# Il n'y a rien de modifiable
|
||||
dialog(u'--title "État administratif de %s non modifiable" --msgbox "%s\n" 0 0 ' %
|
||||
(proprio.Nom(), '\n'.join(texte)))
|
||||
return
|
||||
|
||||
# Il y a qqch de modifiable, on construit la checklist
|
||||
arg = u'--title "Etat administratif de %s" ' % proprio.Nom()
|
||||
arg += u'--separate-output '
|
||||
arg += u'--checklist "%s\n" 0 0 0 ' % '\n'.join(texte)
|
||||
arg += u' '.join(checklist)
|
||||
|
||||
annul, result = dialog(arg)
|
||||
if annul: return 1
|
||||
|
||||
# Traitement
|
||||
if card :
|
||||
if '1\n' in result : proprio.carteEtudiant(ann_scol)
|
||||
elif iscontroleur or carte_ok == 'off' : proprio.carteEtudiant(-ann_scol)
|
||||
if has_card:
|
||||
if '1\n' in result:
|
||||
proprio.carteEtudiant(ann_scol)
|
||||
elif iscontroleur or carte_ok == 'off':
|
||||
proprio.carteEtudiant(-ann_scol)
|
||||
if '4\n' in result:
|
||||
proprio.controle('+c')
|
||||
elif iscontroleur:
|
||||
proprio.controle('-c')
|
||||
|
||||
if '2\n' in result and ann_scol not in proprio.paiement():
|
||||
# On est en train de renouveller l'adhésion
|
||||
|
@ -984,21 +991,23 @@ def set_admin(proprio) :
|
|||
return
|
||||
else:
|
||||
proprio.paiement(ann_scol)
|
||||
elif '2\n' not in result and (paid_ok == 'off' or iscontroleur):
|
||||
elif '2\n' not in result and (paiement_ok == 'off' or iscontroleur):
|
||||
proprio.paiement(-ann_scol)
|
||||
|
||||
if '3\n' in result : proprio.paiement(ann_scol+1)
|
||||
elif paid_ok == 'off' or iscontroleur: proprio.paiement(-ann_scol-1)
|
||||
if '3\n' in result:
|
||||
proprio.paiement(ann_scol+1)
|
||||
elif paiement_ok == 'off' or iscontroleur:
|
||||
proprio.paiement(-ann_scol-1)
|
||||
|
||||
if card:
|
||||
if '4\n' in result: proprio.controle('+c')
|
||||
elif iscontroleur: proprio.controle('-c')
|
||||
|
||||
if '5\n' in result: proprio.controle('+p')
|
||||
elif iscontroleur: proprio.controle('-p')
|
||||
if '5\n' in result:
|
||||
proprio.controle('+p')
|
||||
elif iscontroleur:
|
||||
proprio.controle('-p')
|
||||
|
||||
if 'C\n' in result:
|
||||
proprio.controle('+k')
|
||||
if not iscontroleur:
|
||||
proprio.controle('-p')
|
||||
elif iscontroleur:
|
||||
proprio.controle('-k')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue