Le message de la date de fin d'adhesion est plus cohérent (plus 1er jan 1970)
This commit is contained in:
parent
cf76003c1f
commit
fe6f71acbc
1 changed files with 8 additions and 5 deletions
|
@ -10,6 +10,7 @@ import sys
|
||||||
import time
|
import time
|
||||||
import datetime
|
import datetime
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import pytz
|
||||||
import dateutil.relativedelta
|
import dateutil.relativedelta
|
||||||
if '/usr/scripts' not in sys.path:
|
if '/usr/scripts' not in sys.path:
|
||||||
sys.path.append('/usr/scripts')
|
sys.path.append('/usr/scripts')
|
||||||
|
@ -227,7 +228,7 @@ class Dialog(proprio.Dialog):
|
||||||
|
|
||||||
# Boite de confirmation à l'ahésion
|
# Boite de confirmation à l'ahésion
|
||||||
def box_adherer(end=None):
|
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]))
|
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:
|
else:
|
||||||
adherer = self.confirm(text="Adhésion pour un an, continuer ?", title="Adhésion de %s %s" % (adherent.get("prenom", [''])[0], adherent["nom"][0]))
|
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):
|
def box(finconnexion, default_item=None):
|
||||||
t_end = finconnexion
|
t_end = finconnexion
|
||||||
return self.dialog.menu(
|
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,
|
width=0,
|
||||||
height=0,
|
height=0,
|
||||||
menu_height=0,
|
menu_height=0,
|
||||||
|
@ -434,14 +435,16 @@ class Dialog(proprio.Dialog):
|
||||||
# Si l'adhésion fini avant la connexion
|
# Si l'adhésion fini avant la connexion
|
||||||
if finadhesion <= crans_utils.localized_datetime() or finadhesion <= finconnexion:
|
if finadhesion <= crans_utils.localized_datetime() or finadhesion <= finconnexion:
|
||||||
if finadhesion:
|
if finadhesion:
|
||||||
t_end_adh = finadhesion
|
|
||||||
# Si l'adhésion est déjà fini
|
# Si l'adhésion est déjà fini
|
||||||
if finadhesion <= crans_utils.localized_datetime():
|
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
|
# Sinon si elle fini avant la fin de la connexion courante
|
||||||
elif finadhesion < finconnexion:
|
elif finadhesion < finconnexion:
|
||||||
t_end_conn = 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
|
# É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)
|
return self.adherent_adhesion(cont=self_cont, cancel_cont=cont, adherent=adherent, crediter=False)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue