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
|
## 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
|
Définition de l'état administratif : carte d'étudiant, paiement
|
||||||
et caution.
|
et caution.
|
||||||
"""
|
"""
|
||||||
# Le propriétaire est-il un personnel de l'ENS ?
|
# 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 ?
|
# Le proprietaire a-t-il une section carte d'étudiant (pas les clubs) ?
|
||||||
# Pas pour les clubs
|
has_card = proprio.idn != 'cid'
|
||||||
if proprio.idn != 'cid':
|
|
||||||
card = 1
|
|
||||||
else :
|
|
||||||
card = 0
|
|
||||||
|
|
||||||
# Initialisation
|
# Initialisation des différentes checkbox
|
||||||
if card and ann_scol in proprio.carteEtudiant() : carte='on'
|
carte = on_off(ann_scol in proprio.carteEtudiant())
|
||||||
else : carte='off'
|
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'
|
# Construction de la boîte de dialogue
|
||||||
else : paid_now='off'
|
texte = []
|
||||||
|
checklist = []
|
||||||
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)
|
|
||||||
|
|
||||||
if carte_ok == 'off' or iscontroleur:
|
if carte_ok == 'off' or iscontroleur:
|
||||||
if personnel:
|
if is_personnel:
|
||||||
arg+= u'"1" "Preuve informelle d\'appartenance aux personnels de l\'ENS" "%s" ' % carte
|
checklist.append(u'"1" "Preuve informelle d\'appartenance au personnel de l\'ENS" "%s"' % carte)
|
||||||
elif card:
|
else:
|
||||||
arg+= u'"1" "Carte d\'étudiant %d/%d fournie" "%s" ' % (ann_scol,ann_scol+1, carte)
|
checklist.append(u'"1" "Carte d\'étudiant %d/%d fournie" "%s"' %
|
||||||
|
(ann_scol, ann_scol+1, carte))
|
||||||
if paid_ok == 'off' or iscontroleur:
|
else:
|
||||||
arg+= u'"2" "Adhésion %d/%d réglée et charte signée" "%s" ' % (ann_scol,ann_scol+1,paid_now)
|
texte.append(u'Carte vérifiée')
|
||||||
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 iscontroleur or (caution_ok == 'off' and not personnel):
|
|
||||||
arg+= u'"C" "Caution payée" "%s" ' % caution_ok
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
annul , result = dialog(arg)
|
if paiement_ok == 'off' or iscontroleur:
|
||||||
if annul : return 1
|
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')
|
||||||
|
|
||||||
|
# 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 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)
|
||||||
|
|
||||||
|
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
|
# Traitement
|
||||||
if card :
|
if has_card:
|
||||||
if '1\n' in result : proprio.carteEtudiant(ann_scol)
|
if '1\n' in result:
|
||||||
elif iscontroleur or carte_ok == 'off' : proprio.carteEtudiant(-ann_scol)
|
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():
|
if '2\n' in result and ann_scol not in proprio.paiement():
|
||||||
# On est en train de renouveller l'adhésion
|
# On est en train de renouveller l'adhésion
|
||||||
|
@ -984,21 +991,23 @@ def set_admin(proprio) :
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
proprio.paiement(ann_scol)
|
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)
|
proprio.paiement(-ann_scol)
|
||||||
|
|
||||||
if '3\n' in result : proprio.paiement(ann_scol+1)
|
if '3\n' in result:
|
||||||
elif paid_ok == 'off' or iscontroleur: proprio.paiement(-ann_scol-1)
|
proprio.paiement(ann_scol+1)
|
||||||
|
elif paiement_ok == 'off' or iscontroleur:
|
||||||
|
proprio.paiement(-ann_scol-1)
|
||||||
|
|
||||||
if card:
|
if '5\n' in result:
|
||||||
if '4\n' in result: proprio.controle('+c')
|
proprio.controle('+p')
|
||||||
elif iscontroleur: proprio.controle('-c')
|
elif iscontroleur:
|
||||||
|
proprio.controle('-p')
|
||||||
if '5\n' in result: proprio.controle('+p')
|
|
||||||
elif iscontroleur: proprio.controle('-p')
|
|
||||||
|
|
||||||
if 'C\n' in result:
|
if 'C\n' in result:
|
||||||
proprio.controle('+k')
|
proprio.controle('+k')
|
||||||
|
if not iscontroleur:
|
||||||
|
proprio.controle('-p')
|
||||||
elif iscontroleur:
|
elif iscontroleur:
|
||||||
proprio.controle('-k')
|
proprio.controle('-k')
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue