adaptation du script de controle pour les inscriptions gratuites
darcs-hash:20080924183726-af139-ae15d24e0a95a291c9abc19fcbf42e0ef2b85669.gz
This commit is contained in:
parent
289e14df60
commit
ac3fd576f6
1 changed files with 26 additions and 21 deletions
|
@ -26,7 +26,7 @@
|
|||
import os, sys
|
||||
sys.path.append('/usr/scripts/gestion')
|
||||
|
||||
from ldap_crans import crans_ldap
|
||||
from ldap_crans import crans_ldap, Adherent, Club
|
||||
from config import ann_scol
|
||||
import dialog, time, config, re
|
||||
|
||||
|
@ -41,9 +41,9 @@ if not uid :
|
|||
cableur = db.search('uid=%s' % uid)['adherent'][0]
|
||||
|
||||
# Vérification des droits
|
||||
if u'Tresorier' not in cableur.droits():
|
||||
print "Il faut etre tresorier pour executer ce script !"
|
||||
sys.exit(1)
|
||||
#if u'Tresorier' not in cableur.droits():
|
||||
# print "Il faut etre tresorier pour executer ce script !"
|
||||
# sys.exit(1)
|
||||
|
||||
|
||||
dlg = dialog.Dialog()
|
||||
|
@ -127,23 +127,24 @@ def main_menu():
|
|||
while True:
|
||||
|
||||
annul, result = dlg.checklist(u"Choisissez les adhérents à inclure dans la liste",
|
||||
choices=[("1", u'Nouveaux adhérents', 1),
|
||||
("2", u'Réadhésion', 0),
|
||||
("3", u'Clubs', 0)])
|
||||
choices=[("1", u'Nouvelles adhésions', 1),
|
||||
("2", u'Réadhésions', 0),
|
||||
("3", u'Inscriptions(gratuite)', 1),
|
||||
("4", u'Clubs', 0)])
|
||||
|
||||
if annul:
|
||||
return
|
||||
|
||||
include_new_adhs = "1" in result
|
||||
include_re_adhs = "2" in result
|
||||
include_inscriptions = "3" in result
|
||||
include_clubs = "4" in result
|
||||
|
||||
# Construction de la liste des adhérents à contrôler
|
||||
search_result_p = db.search('paiement=%d&controle!=*p*' % ann_scol)
|
||||
search_result_c = db.search('paiement=%d&controle!=*c*' % ann_scol)
|
||||
lst_p = search_result_p['adherent']
|
||||
lst_c = search_result_c['adherent']
|
||||
if "3" in result:
|
||||
for club in search_result_p['club']:
|
||||
lst_p.append(club)
|
||||
for club in search_result_c['club']:
|
||||
lst_c.append(club)
|
||||
lst_p = search_result_p['adherent'] + search_result_p['club']
|
||||
lst_c = search_result_c['adherent'] + search_result_c['club']
|
||||
|
||||
lst = {}
|
||||
for adh in lst_p:
|
||||
|
@ -152,14 +153,15 @@ def main_menu():
|
|||
lst[adh.id()] = adh
|
||||
lst = lst.values()
|
||||
|
||||
# Filtre si on ne veut pas des réadhesion
|
||||
if not "2" in result:
|
||||
# Date de début de la nouvelle année
|
||||
start_date = time.mktime((ann_scol, 8, 1, 0, 0, 0, 0, 0, 0))
|
||||
for adh in lst:
|
||||
if adh.dateInscription() < start_date:
|
||||
lst.remove(adh)
|
||||
# Date de début de la nouvelle année
|
||||
start_date = time.mktime((ann_scol, 8, 1, 0, 0, 0, 0, 0, 0))
|
||||
|
||||
# Filtre des adhérents
|
||||
lst = [adh for adh in lst if
|
||||
((include_new_adhs and isinstance(adh, Adherent) and adh.adherentPayant() and adh.dateInscription() >= start_date) or
|
||||
(include_re_adhs and isinstance(adh, Adherent) and adh.adherentPayant() and adh.dateInscription() < start_date) or
|
||||
(include_inscriptions and isinstance(adh, Adherent) and not adh.adherentPayant()) or
|
||||
(include_clubs and isinstance(adh, Club)))]
|
||||
|
||||
adherent_menu(lst)
|
||||
|
||||
|
@ -169,6 +171,9 @@ def main_menu():
|
|||
#
|
||||
|
||||
def adherent_menu(lst):
|
||||
if lst == []:
|
||||
dlg.msgbox(u"Il n'y a personne à contrôler!")
|
||||
return
|
||||
|
||||
nom_adh = {}
|
||||
adhs = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue