Edit member ongoing
This commit is contained in:
parent
0ce5ed334c
commit
d651a4973a
66
IFPass.py
66
IFPass.py
@ -85,14 +85,20 @@ def initialisation():
|
|||||||
return IFPassDBdir, printername, AcrobatReader, clientsfile, clientsbkpfile, imgdir, templatesdir, pdftemplate, pngtemplate, fonttemplate
|
return IFPassDBdir, printername, AcrobatReader, clientsfile, clientsbkpfile, imgdir, templatesdir, pdftemplate, pngtemplate, fonttemplate
|
||||||
|
|
||||||
|
|
||||||
def get_fullname():
|
def get_fullname(**kwargs): # **kwargs => Optionnal arguments
|
||||||
while "Empty firstname":
|
if 'firstname' in kwargs:
|
||||||
firstname = input("Prénom : ").strip()
|
firstname = kwargs['firstname']
|
||||||
if len(firstname) == 0:
|
newfirstname = input("Prénom (" + firstname + "): ").strip()
|
||||||
os.system('cls')
|
if len(newfirstname) != 0:
|
||||||
print(colored("\nLe Prénom ne peut pas être vide.", 'red'))
|
firstname = newfirstname
|
||||||
else:
|
else:
|
||||||
break
|
while "Empty firstname":
|
||||||
|
firstname = input("Prénom : ").strip()
|
||||||
|
if len(firstname) == 0:
|
||||||
|
os.system('cls')
|
||||||
|
print(colored("\nLe Prénom ne peut pas être vide.", 'red'))
|
||||||
|
else:
|
||||||
|
break
|
||||||
firstname = firstname[0].upper() + firstname[1:].lower()
|
firstname = firstname[0].upper() + firstname[1:].lower()
|
||||||
if '-' in firstname:
|
if '-' in firstname:
|
||||||
pos = firstname.find("-")
|
pos = firstname.find("-")
|
||||||
@ -102,13 +108,20 @@ def get_fullname():
|
|||||||
pos = firstname.find(" ")
|
pos = firstname.find(" ")
|
||||||
firstname = firstname[:pos + 1] + firstname[pos + 1].upper() + \
|
firstname = firstname[:pos + 1] + firstname[pos + 1].upper() + \
|
||||||
firstname[pos + 2:] # Check if compound name
|
firstname[pos + 2:] # Check if compound name
|
||||||
while "Empty surname":
|
|
||||||
surname = input("Nom : ").upper().strip()
|
if 'surname' in kwargs:
|
||||||
if len(surname) == 0:
|
surname = kwargs['surname']
|
||||||
os.system('cls')
|
newsurname = input("Prénom (" + surname + "): ").strip()
|
||||||
print(colored("\nLe Nom ne peut pas être vide.", 'red'))
|
if len(newsurname) != 0:
|
||||||
else:
|
surname = newsurname
|
||||||
break
|
else:
|
||||||
|
while "Empty surname":
|
||||||
|
surname = input("Nom : ").upper().strip()
|
||||||
|
if len(surname) == 0:
|
||||||
|
os.system('cls')
|
||||||
|
print(colored("\nLe Nom ne peut pas être vide.", 'red'))
|
||||||
|
else:
|
||||||
|
break
|
||||||
docteur = yes_or_no('Est-ce un Docteur ?')
|
docteur = yes_or_no('Est-ce un Docteur ?')
|
||||||
if docteur:
|
if docteur:
|
||||||
titre = 'Dr.'
|
titre = 'Dr.'
|
||||||
@ -213,7 +226,7 @@ def bkpdb():
|
|||||||
copyfile(clientsfile, clientsbkpfile)
|
copyfile(clientsfile, clientsbkpfile)
|
||||||
|
|
||||||
|
|
||||||
def fillcard(clientID, titrename, firstname, dateexp, barcode):
|
def fillcard(clientID, titrename, firstname, dateexp, barcode, picture):
|
||||||
print("Création de la carte avec les informations...", end='')
|
print("Création de la carte avec les informations...", end='')
|
||||||
try:
|
try:
|
||||||
im = Image.open(pngtemplate)
|
im = Image.open(pngtemplate)
|
||||||
@ -307,11 +320,10 @@ def newmember():
|
|||||||
if correct:
|
if correct:
|
||||||
os.system('cls')
|
os.system('cls')
|
||||||
if version != 'devnocam':
|
if version != 'devnocam':
|
||||||
global picture
|
|
||||||
picture = getpic()
|
picture = getpic()
|
||||||
clientID = getclientID()
|
clientID = getclientID()
|
||||||
barcode = barcode_gen(clientID)
|
barcode = barcode_gen(clientID)
|
||||||
fillcard(clientID, titrename, firstname, dateexp, barcode)
|
fillcard(clientID, titrename, firstname, dateexp, barcode, picture)
|
||||||
cartefilename = mergepdf(clientID)
|
cartefilename = mergepdf(clientID)
|
||||||
if version not in ('dev', 'devnocam'):
|
if version not in ('dev', 'devnocam'):
|
||||||
bkpdb()
|
bkpdb()
|
||||||
@ -382,10 +394,14 @@ def membersearch():
|
|||||||
def memberdo(choix, member):
|
def memberdo(choix, member):
|
||||||
titre = member[0]
|
titre = member[0]
|
||||||
firstname = member[1]
|
firstname = member[1]
|
||||||
|
surname = member[2]
|
||||||
|
clientID = member[3]
|
||||||
|
dateinsc = member[4]
|
||||||
|
dateexp = member[5]
|
||||||
os.system('cls')
|
os.system('cls')
|
||||||
if choix == '1': # Edit member
|
if choix == '1': # Edit member
|
||||||
while "the informations are incorrect": # Loop Filling informations
|
while "the informations are incorrect": # Loop Filling informations
|
||||||
titre, firstname, surname, titrename = get_fullname()
|
titre, firstname, surname, titrename = get_fullname(titre=titre, firstname=firstname, surname=surname)
|
||||||
|
|
||||||
os.system('cls')
|
os.system('cls')
|
||||||
print("Titre : ", colored(titre, 'green'))
|
print("Titre : ", colored(titre, 'green'))
|
||||||
@ -395,20 +411,23 @@ def memberdo(choix, member):
|
|||||||
correct = yes_or_no("Ces informations sont elles correctes ?")
|
correct = yes_or_no("Ces informations sont elles correctes ?")
|
||||||
|
|
||||||
if correct:
|
if correct:
|
||||||
newpic = yes_or_no("Voulez-vous prendre une nouvelle photo ?")
|
wantnewpic = yes_or_no("Voulez-vous prendre une nouvelle photo ?")
|
||||||
if newpic:
|
if wantnewpic:
|
||||||
os.system('cls')
|
os.system('cls')
|
||||||
if version != 'devnocam':
|
if version != 'devnocam':
|
||||||
global picture
|
|
||||||
picture = getpic()
|
picture = getpic()
|
||||||
clientID = member[3]
|
clientID = member[3]
|
||||||
barcode = barcode_gen(clientID)
|
barcode = barcode_gen(clientID)
|
||||||
fillcard(barcode)
|
fillcard(clientID, titrename, firstname, dateexp, barcode, picture)
|
||||||
cartefilename = mergepdf()
|
cartefilename = mergepdf()
|
||||||
if version not in ('dev', 'devnocam'):
|
if version not in ('dev', 'devnocam'):
|
||||||
bkpdb()
|
bkpdb()
|
||||||
printcard(cartefilename)
|
printcard(cartefilename)
|
||||||
|
writeindb(titre, firstname, surname, clientID, dateinsc, dateexp)
|
||||||
break
|
break
|
||||||
|
else:
|
||||||
|
# We crop pic from the previous card
|
||||||
|
pass
|
||||||
|
|
||||||
elif choix == '2': # Renew subscription
|
elif choix == '2': # Renew subscription
|
||||||
print(2)
|
print(2)
|
||||||
@ -422,7 +441,6 @@ def memberdo(choix, member):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# global titre, firstname, surname, titrename, dateinsc, dateexp, clientID, clientsfile, IFPassDBdir, clientsfile, imgdir, clientsbkpfile, templatesdir, pngtemplate, fonttemplate, picture, pdftemplate, printername, AcrobatReader
|
|
||||||
global IFPassDBdir, clientsfile, imgdir, clientsbkpfile, templatesdir, pngtemplate, fonttemplate, pdftemplate, printername, AcrobatReader
|
global IFPassDBdir, clientsfile, imgdir, clientsbkpfile, templatesdir, pngtemplate, fonttemplate, pdftemplate, printername, AcrobatReader
|
||||||
while "The program is running":
|
while "The program is running":
|
||||||
init() # Initialisation of colorama
|
init() # Initialisation of colorama
|
||||||
|
Loading…
Reference in New Issue
Block a user