Passage aux adhésions glissantes (partie 2/2, lc_ldap)
This commit is contained in:
parent
6880051943
commit
7f1ffbeed5
7 changed files with 180 additions and 30 deletions
27
objets.py
27
objets.py
|
@ -713,10 +713,13 @@ class proprio(CransLdapObject):
|
|||
u""" Un propriétaire de machine (adhérent, club…) """
|
||||
can_be_by = { variables.created: [attributs.nounou, attributs.bureau, attributs.cableur],
|
||||
variables.modified: [attributs.nounou, attributs.bureau, attributs.soi, attributs.cableur],
|
||||
variables.deleted: [attributs.nounou, attributs.bureau],
|
||||
variables.deleted: [attributs.nounou, attributs.bureau,],
|
||||
}
|
||||
|
||||
attribs = [attributs.nom, attributs.chbre, attributs.paiement, attributs.info, attributs.blacklist, attributs.controle, attributs.historique]
|
||||
attribs = [attributs.nom, attributs.chbre, attributs.paiement, attributs.info,
|
||||
attributs.blacklist, attributs.controle, attributs.historique,
|
||||
attributs.debutAdhesion, attributs.finAdhesion, attributs.debutConnexion,
|
||||
attributs.finConnexion]
|
||||
|
||||
def __repr__(self):
|
||||
return str(self.__class__) + " : nom=" + str(self['nom'][0])
|
||||
|
@ -857,6 +860,14 @@ class proprio(CransLdapObject):
|
|||
u"""Renvoie si le propriétaire a payé et donné sa carte pour l'année en cours"""
|
||||
return self.paiement_ok() and self.carte_ok()
|
||||
|
||||
def fin_adhesion(self):
|
||||
"""Retourne la date de fin d'adhésion"""
|
||||
return max([float(facture.get('finAdhesion', [crans_utils.fromGeneralizedTimeFormat(attributs.finAdhesion.default)])[0]) for facture in self.factures() if facture.get('controle', [''])[0] != u"FALSE"] + [0.0])
|
||||
|
||||
def fin_connexion(self):
|
||||
"""Retourne la date de fin de connexion"""
|
||||
return max([float(facture.get('finConnexion', [crans_utils.fromGeneralizedTimeFormat(attributs.finConnexion.default)])[0]) for facture in self.factures() if facture.get('controle', [''])[0] != u"FALSE"] + [0.0])
|
||||
|
||||
def paiement_ok(self, no_bl=False):
|
||||
u"""
|
||||
Renvoie si le propriétaire a payé pour l'année en cours, en prenant en compte les périodes de transition et les blacklistes.
|
||||
|
@ -868,7 +879,13 @@ class proprio(CransLdapObject):
|
|||
for bl in self.blacklist_actif():
|
||||
if bl['type'] == 'paiement':
|
||||
return False
|
||||
return config.ann_scol in self['paiement'] or (config.periode_transitoire and (config.ann_scol - 1) in self['paiement'])
|
||||
old_style_paiement = config.ann_scol in self['paiement'] or (config.periode_transitoire and (config.ann_scol - 1) in self['paiement'])
|
||||
if isinstance(self, adherent):
|
||||
fin_paiement = min(self.fin_adhesion(), self.fin_connexion())
|
||||
else:
|
||||
fin_paiement = self.fin_adhesion()
|
||||
new_style_paiement = time.time() < fin_paiement or (config.periode_transitoire and config.debut_periode_transitoire <= fin_paiement <= config.fin_periode_transitoire)
|
||||
return (old_style_paiement or new_style_paiement)
|
||||
|
||||
def carte_ok(self):
|
||||
u"""Renvoie si le propriétaire a donné sa carte pour l'année en cours, en prenant en compte les periode transitoires et le sursis carte"""
|
||||
|
@ -1251,7 +1268,9 @@ class facture(CransLdapObject):
|
|||
variables.deleted: [attributs.nounou, attributs.bureau, attributs.cableur],
|
||||
}
|
||||
attribs = [attributs.fid, attributs.modePaiement, attributs.recuPaiement,
|
||||
attributs.historique, attributs.article, attributs.info]
|
||||
attributs.historique, attributs.article, attributs.info,
|
||||
attributs.debutAdhesion, attributs.finAdhesion, attributs.debutConnexion,
|
||||
attributs.finConnexion, attributs.controle ]
|
||||
ldap_name = "facture"
|
||||
|
||||
_proprio = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue