Passage aux adhésions glissantes (partie I, sans lc_ldap)
This commit is contained in:
parent
169b7000b8
commit
49cef4c095
12 changed files with 485 additions and 231 deletions
|
@ -13,6 +13,7 @@ import datetime
|
|||
import time
|
||||
import re
|
||||
import lc_ldap.shortcuts
|
||||
from lc_ldap.crans_utils import fromGeneralizedTimeFormat, toGeneralizedTimeFormat
|
||||
conn = lc_ldap.shortcuts.lc_ldap_admin()
|
||||
|
||||
import mail as mail_module
|
||||
|
@ -38,12 +39,11 @@ year = config.ann_scol
|
|||
delai = config.demenagement_delai
|
||||
|
||||
# On récupère ceux qui n'ont pas payé cette année
|
||||
if config.periode_transitoire:
|
||||
bad_boys_e_s = conn.search(u'(&(aid=*)(chbre=????)(paiement=%d)(!(paiement=%d)))' % (year-1,year))
|
||||
else:
|
||||
bad_boys_e_s = conn.search(u'(&(aid=*)(chbre=????)(paiement=%d))' % year)
|
||||
now = time.time()
|
||||
|
||||
if config.periode_transitoire:
|
||||
bad_boys_e_s = conn.search(u'(&(aid=*)(chbre=????)(|(&(paiement=%d)(!(paiement=%d)))(finAdhesion<=%s)(finConnexion<=%s)))' % (year-1, year, toGeneralizedTimeFormat(now), toGeneralizedTimeFormat(now)))
|
||||
else:
|
||||
bad_boys_e_s = conn.search(u'(&(aid=*)(chbre=????)(|(paiement=%d)(finAdhesion>=%s)(finConnexion>=%s)))' % (year, toGeneralizedTimeFormat(now), toGeneralizedTimeFormat(now)))
|
||||
|
||||
to_print = []
|
||||
to_error = []
|
||||
|
@ -56,7 +56,7 @@ for clandestin in bad_boys_e_s:
|
|||
if x <> None:
|
||||
kickout_date = x.group(1)
|
||||
exchambre = x.group(2)
|
||||
|
||||
|
||||
machine_liste = clandestin.machines()
|
||||
# On lui accorde un délai
|
||||
kickout_date = time.mktime(time.strptime(kickout_date, "%d/%m/%Y %H:%M"))
|
||||
|
@ -77,7 +77,7 @@ for clandestin in bad_boys_e_s:
|
|||
mailer = os.popen("/usr/sbin/sendmail -t", "w")
|
||||
mailer.write(mail + "\n.")
|
||||
mailer.close()
|
||||
|
||||
|
||||
else:
|
||||
for m in machine_liste:
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue