ajout d'un délai de paiement pour le mois de septembre, si le membre était à jour des cotisations à la fin Aout.
This commit is contained in:
parent
aa559459c8
commit
a75cafe44c
@ -25,6 +25,7 @@ sched = Scheduler()
|
||||
def disconnect_members_from_residence(admin_user, residence_dn):
|
||||
members = Member.get_all_non_admin(admin_user, residence_dn)
|
||||
print (CotisationComputes.current_year())
|
||||
date_actuelle = datetime.datetime.now()
|
||||
|
||||
for member in members:
|
||||
|
||||
@ -32,6 +33,12 @@ def disconnect_members_from_residence(admin_user, residence_dn):
|
||||
if machines_tuples != []:
|
||||
|
||||
if not CotisationComputes.is_cotisation_paid(member.dn, admin_user, residence_dn):
|
||||
#verification de grace pour septembre : si le membre avait cotise en Aout, on lui accorde un delai de paiement pour Septembre, et on ne le deconnecte pas
|
||||
if date_actuelle.month = 9 and is_cotisation_was_paid_last_year(member_dn, admin_user, residence_dn):
|
||||
#le membre etait a jour en aout, on lui autorise un delai de paiement en septembre - pas de deconnexion
|
||||
break
|
||||
#end if
|
||||
|
||||
dhcps = Machine.get_dhcps(admin_user, member.dn)
|
||||
machine_membre_tag = "machine_membre" # FIXME move to config
|
||||
|
||||
|
@ -176,6 +176,32 @@ class CotisationComputes:
|
||||
return cotisations_this_year == [] and cotisations_previous_year == []
|
||||
#end def
|
||||
|
||||
@staticmethod
|
||||
# 7 days grace period
|
||||
def is_cotisation_was_paid_last_year(member_dn, user_session, residence_dn, cotisations = None, anniversary = None):
|
||||
if cotisations is None:
|
||||
current_year = CotisationComputes.current_year() - 1
|
||||
#end if
|
||||
|
||||
now = datetime.datetime.now()
|
||||
if now.month < 9:
|
||||
last_year = datetime.datetime(now.year - 1, 8, 31, 12, 0)
|
||||
else:
|
||||
last_year = datetime.datetime(now, 8, 31, 12, 0)
|
||||
#end if
|
||||
|
||||
if cotisations is None:
|
||||
cotisations = Cotisation.cotisations_of_member(user_session, member_dn, current_year)
|
||||
#end if
|
||||
|
||||
if anniversary is None:
|
||||
anniversary = CotisationComputes.anniversary_from_ldap_items(cotisations)
|
||||
#end if
|
||||
|
||||
delta = (last_year - anniversary)
|
||||
return delta.days <= 7
|
||||
#end def
|
||||
|
||||
@staticmethod
|
||||
# 7 days grace period
|
||||
def is_cotisation_paid(member_dn, user_session, residence_dn, cotisations = None, anniversary = None, verification_old_member = True):
|
||||
|
Loading…
Reference in New Issue
Block a user