From fe6f71acbc7600342b5076fc6e2fe4558af9d6fc Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Thu, 3 Dec 2015 02:19:45 +0100 Subject: [PATCH] =?UTF-8?q?Le=20message=20de=20la=20date=20de=20fin=20d'ad?= =?UTF-8?q?hesion=20est=20plus=20coh=C3=A9rent=20(plus=201er=20jan=201970)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gestion/dialog/adherent.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gestion/dialog/adherent.py b/gestion/dialog/adherent.py index 68f59517..346ede23 100644 --- a/gestion/dialog/adherent.py +++ b/gestion/dialog/adherent.py @@ -10,6 +10,7 @@ import sys import time import datetime import subprocess +import pytz import dateutil.relativedelta if '/usr/scripts' not in sys.path: sys.path.append('/usr/scripts') @@ -227,7 +228,7 @@ class Dialog(proprio.Dialog): # Boite de confirmation à l'ahésion def box_adherer(end=None): - if end: + if end != crans_utils.localized_datetime(): adherer = self.confirm(text="Adhésion jusqu'au %s. Réadhérer ?" % end, title="Adhésion de %s %s" % (adherent.get("prenom", [''])[0], adherent["nom"][0])) else: adherer = self.confirm(text="Adhésion pour un an, continuer ?", title="Adhésion de %s %s" % (adherent.get("prenom", [''])[0], adherent["nom"][0])) @@ -341,7 +342,7 @@ class Dialog(proprio.Dialog): def box(finconnexion, default_item=None): t_end = finconnexion return self.dialog.menu( - "Connexion jusqu'au %s" % t_end if finconnexion else "N'a jamais été connecté", + "Connexion jusqu'au %s" % t_end if finconnexion != datetime.datetime.fromtimestamp(0, tz=pytz.utc) else "N'a jamais été connecté", width=0, height=0, menu_height=0, @@ -434,14 +435,16 @@ class Dialog(proprio.Dialog): # Si l'adhésion fini avant la connexion if finadhesion <= crans_utils.localized_datetime() or finadhesion <= finconnexion: if finadhesion: - t_end_adh = finadhesion # Si l'adhésion est déjà fini if finadhesion <= crans_utils.localized_datetime(): - self.dialog.msgbox(text=u"L'adhésion a expiré le %s, il va falloir réadhérer d'abord (10€)" % t_end_adh, title="Réadhésion nécessaire", width=0, height=0, timeout=self.timeout) + if finadhesion == datetime.datetime.fromtimestamp(0, tz=pytz.utc): + self.dialog.msgbox(text=u"L'adhérent n'a jamais adhéré à l'association, on va d'abord le faire adhérer (10€)", title="Adhésion nécessaire", width=0, height=0, timeout=self.timeout) + else: + self.dialog.msgbox(text=u"L'adhésion a expiré le %s, il va falloir réadhérer d'abord (10€)" % finadhesion, title="Réadhésion nécessaire", width=0, height=0, timeout=self.timeout) # Sinon si elle fini avant la fin de la connexion courante elif finadhesion < finconnexion: t_end_conn = finconnexion - self.dialog.msgbox(text=u"L'adhésion de termine le %s, avant la fin de la connexion le %s, il va falloir réadhérer d'abord (10€)" % (t_end_adh, t_end_conn), title="Réadhésion nécessaire", width=0, height=0, timeout=self.timeout) + self.dialog.msgbox(text=u"L'adhésion de termine le %s, avant la fin de la connexion le %s, il va falloir réadhérer d'abord (10€)" % (finadhesion, t_end_conn), title="Réadhésion nécessaire", width=0, height=0, timeout=self.timeout) # Échouera si on essaie de prolonger la connexion au dela de l'adhésion et que l'adhésion est encore valable plus de quinze jours return self.adherent_adhesion(cont=self_cont, cancel_cont=cont, adherent=adherent, crediter=False)