IFPass dev uploaded

This commit is contained in:
Jordan ERNST 2018-04-12 15:11:48 +02:00
parent cab6fb644d
commit 46e18814a4

106
IFPass.py
View File

@ -27,7 +27,7 @@ from termcolor import colored
version = '1.0' version = '1.0'
computer = '' # 'test', 'mediatheque' or 'accueil' computer = 'test' # 'test', 'mediatheque' or 'accueil'
if computer == 'test': if computer == 'test':
IFPassdir = '\\\\192.168.1.1\SSIC\\04-Projets\IFPass\\' IFPassdir = '\\\\192.168.1.1\SSIC\\04-Projets\IFPass\\'
@ -239,45 +239,73 @@ def printcard(cartefilename):
print('test') print('test')
while "the informations are incorrect": # Loop Filling informations while True:
os.system('cls') print('1 - Nouveau membre', '2 - Rechercher un membre', '3 - Quitter', sep='\n')
init() choix = input('Choix : ')
f = Figlet(font='big') if choix == '1':
print(colored(f.renderText('IFPass'), 'cyan', attrs=['bold'])) while "the informations are incorrect": # Loop Filling informations
print('Version :', version) os.system('cls')
print('\nLe programme IFPass à été écrit par Jordan ERNST Q1 2018.') init()
print('Pour toute question ou problème contactez-moi à pro.ernst@gmail.com.\n') f = Figlet(font='big')
titre, firstname, surname, fullname = get_fullname() print(colored(f.renderText('IFPass'), 'cyan', attrs=['bold']))
dateinsc = date.today() print('Version :', version)
dateexp = dateinsc + timedelta(days=365) print('\nLe programme IFPass à été écrit par Jordan ERNST Q1 2018.')
print('Pour toute question ou problème contactez-moi à pro.ernst@gmail.com.\n')
titre, firstname, surname, fullname = get_fullname()
dateinsc = date.today()
dateexp = dateinsc + timedelta(days=365)
dateinsc = dateinsc.strftime('%d/%m/%Y') dateinsc = dateinsc.strftime('%d/%m/%Y')
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: while True:
dateexp = input('Quelle date d\'expiration voulez-vous mettre (Format : JJ/MM/AAAA)? : ') 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) 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: if match:
break break
else: else:
print('Mauvais format ! JJ/MM/AAAA, exemple : 01/08/2042') 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'))
print("Prénom : ", colored(firstname, 'green')) print("Prénom : ", colored(firstname, 'green'))
print("Nom : ", colored(surname, 'green')) print("Nom : ", colored(surname, 'green'))
print("Date d'inscription :", colored(dateinsc, 'green')) print("Date d'inscription :", colored(dateinsc, 'green'))
print("Date d'expiration : ", colored(dateexp, 'green')) print("Date d'expiration : ", colored(dateexp, 'green'))
correct = yes_or_no("Ces informations sont elles correctes ?") correct = yes_or_no("Ces informations sont elles correctes ?")
if correct: if correct:
os.system('cls')
picture = getpic()
clientID = getclientID()
barcode = barcode_gen(clientID)
fillcard(barcode)
cartefilename = mergepdf()
bkpdb()
if computer == 'mediatheque' or computer == 'accueil':
printcard(cartefilename)
elif choix == '2':
os.system('cls') os.system('cls')
picture = getpic() research = input('Entrez le nom, prénom, ou numéro de carte (ou flashez) : ').lower()
clientID = getclientID() try:
barcode = barcode_gen(clientID) with open(clientsfile, 'r', newline='', encoding='utf-8') as csvfile:
fillcard(barcode) results = []
cartefilename = mergepdf() for line in csvfile.readlines():
bkpdb() resfirstname = line.split(';')[1].lower()
if computer == 'mediatheque' or computer == 'accueil': ressurname = line.split(';')[2].lower()
printcard(cartefilename) resnumber = line.split(';')[3]
if research in (ressurname or resfirstname):
results.append([resfirstname, ressurname, resnumber])
print(results)
except FileNotFoundError:
print('Le fichier client est inexistant.')
elif choix == '3':
sys.exit()
else:
os.system('cls')
print('Choix incorrect !')