diff --git a/gestion/gest_crans.py b/gestion/gest_crans.py index 3ad046ea..5a11268e 100755 --- a/gestion/gest_crans.py +++ b/gestion/gest_crans.py @@ -1524,12 +1524,16 @@ def set_connexion(proprio): # Si l'adhérent ne l'est plus, on commence par le faire adhérer, sauf s'il a une facture adhésion. adhEnd = proprio.adhesion() + if in_facture is not None: adhEnd = max(adhEnd, fromGeneralizedTimeFormat(in_facture._data.get('finAdhesion', ["19700101000000Z"])[0])) - if adhEnd < time(): + + if adhEnd - cotisation.delai_readh < time(): stat = set_adhesion(proprio) - if stat == 1: + + if stat == 1 and adhEnd < time(): return 1 + if in_facture is not None: adhEnd = max(adhEnd, fromGeneralizedTimeFormat(in_facture._data.get('finAdhesion', ["19700101000000Z"])[0])) @@ -1554,7 +1558,8 @@ def set_connexion(proprio): annul, res = dialog(args) if annul: - in_facture.supprime(pop=True) + if in_facture is not None: + in_facture.supprime(pop=True) return 1 res = res[0] if res == "An":