Allow to choose date manually
This commit is contained in:
parent
ad2c7de563
commit
a93c05bcc3
26
IFPass.py
26
IFPass.py
@ -311,6 +311,17 @@ def printcard(cartefilename):
|
|||||||
subprocess.Popen('"' + AcrobatReader + '"' + ' /h /n /t ' + cartefilename + ' ' + printername, shell=False)
|
subprocess.Popen('"' + AcrobatReader + '"' + ' /h /n /t ' + cartefilename + ' ' + printername, shell=False)
|
||||||
|
|
||||||
|
|
||||||
|
def getdateexp():
|
||||||
|
while True:
|
||||||
|
dateexp = input("Quelle date d'expiration voulez-vous mettre (Format : JJ/MM/AAAA)? : ")
|
||||||
|
match = re.fullmatch(r'^(0[1-9]|1[0-9]|2[0-9]|3[0-1])/(0[1-9]|1[0-2])/([0-9]){4}$', dateexp)
|
||||||
|
if match:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
print('Mauvais format ! JJ/MM/AAAA, exemple : 01/08/2042')
|
||||||
|
return dateexp
|
||||||
|
|
||||||
|
|
||||||
def newmember():
|
def newmember():
|
||||||
while "the informations are incorrect": # Loop Filling informations
|
while "the informations are incorrect": # Loop Filling informations
|
||||||
os.system('cls')
|
os.system('cls')
|
||||||
@ -322,13 +333,7 @@ def newmember():
|
|||||||
dateexp = dateexp.strftime('%d/%m/%Y')
|
dateexp = dateexp.strftime('%d/%m/%Y')
|
||||||
changeexp = yes_or_no("Voulez-vous choisir la date d'expiration ?")
|
changeexp = yes_or_no("Voulez-vous choisir la date d'expiration ?")
|
||||||
if changeexp:
|
if changeexp:
|
||||||
while True:
|
dateexp = getdateexp()
|
||||||
dateexp = input("Quelle date d'expiration voulez-vous mettre (Format : JJ/MM/AAAA)? : ")
|
|
||||||
match = re.fullmatch(r'^(0[1-9]|1[0-9]|2[0-9]|3[0-1])/(0[1-9]|1[0-2])/([0-9]){4}$', dateexp)
|
|
||||||
if match:
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
print('Mauvais format ! JJ/MM/AAAA, exemple : 01/08/2042')
|
|
||||||
|
|
||||||
os.system('cls')
|
os.system('cls')
|
||||||
print("Titre : ", colored(titre, 'green'))
|
print("Titre : ", colored(titre, 'green'))
|
||||||
@ -404,7 +409,7 @@ def membersearch():
|
|||||||
elif diff == 0:
|
elif diff == 0:
|
||||||
print(colored("Il s'agit du dernier jour de l'abonnement, il expirera demain.", 'yellow', attrs=['bold']))
|
print(colored("Il s'agit du dernier jour de l'abonnement, il expirera demain.", 'yellow', attrs=['bold']))
|
||||||
|
|
||||||
print('\n1 - Modifier', "2 - Renouveller l'abonnement", '3 - Imprimer la carte', '0 - Menu principal', sep='\n')
|
print('\n1 - Modifier', "2 - Renouveller l'abonnement / Choisir un nouvelle date d'expiration", '3 - Imprimer la carte', '0 - Menu principal', sep='\n')
|
||||||
choix = input('Choix : ')
|
choix = input('Choix : ')
|
||||||
if choix == '0':
|
if choix == '0':
|
||||||
os.system('cls')
|
os.system('cls')
|
||||||
@ -431,6 +436,9 @@ def memberdo(choix, member):
|
|||||||
titre, firstname, surname, dateexp = memberedit(titre, firstname, surname, clientID, dateinsc, dateexp)
|
titre, firstname, surname, dateexp = memberedit(titre, firstname, surname, clientID, dateinsc, dateexp)
|
||||||
|
|
||||||
elif choix == '2': # Renew subscription
|
elif choix == '2': # Renew subscription
|
||||||
|
print("1 - Renouveller l'abonnement automatiquement", "2 - Choisir la date d'expiration", sep='\n')
|
||||||
|
choix = input("Choix : ")
|
||||||
|
if choix == 1:
|
||||||
dateexp = datetime.strptime(dateexp, '%d/%m/%Y').date()
|
dateexp = datetime.strptime(dateexp, '%d/%m/%Y').date()
|
||||||
diff = (dateexp - date.today()).days
|
diff = (dateexp - date.today()).days
|
||||||
if diff >= 0:
|
if diff >= 0:
|
||||||
@ -438,6 +446,8 @@ def memberdo(choix, member):
|
|||||||
elif diff < 0:
|
elif diff < 0:
|
||||||
dateexp = date.today() + timedelta(days=365)
|
dateexp = date.today() + timedelta(days=365)
|
||||||
dateexp = dateexp.strftime('%d/%m/%Y')
|
dateexp = dateexp.strftime('%d/%m/%Y')
|
||||||
|
elif choix == 2:
|
||||||
|
dateexp = getdateexp()
|
||||||
|
|
||||||
if titre == 'Dr.':
|
if titre == 'Dr.':
|
||||||
titrename = titre + ' ' + surname
|
titrename = titre + ' ' + surname
|
||||||
|
Loading…
Reference in New Issue
Block a user