Bugs corrections
This commit is contained in:
parent
5d76b1f584
commit
9ab362fd29
108
IFPass.py
108
IFPass.py
@ -428,43 +428,7 @@ def memberdo(choix, member):
|
|||||||
|
|
||||||
os.system('cls')
|
os.system('cls')
|
||||||
if choix == '1': # Edit member
|
if choix == '1': # Edit member
|
||||||
while "the informations are incorrect": # Loop Filling informations
|
titre, firstname, surname, dateexp = memberedit(titre, firstname, surname, clientID, dateinsc, dateexp)
|
||||||
titre, firstname, surname, titrename = get_fullname(titre=titre, firstname=firstname, surname=surname)
|
|
||||||
|
|
||||||
print("Titre : ", colored(titre, 'green'))
|
|
||||||
print("Prénom : ", colored(firstname, 'green'))
|
|
||||||
print("Nom : ", colored(surname, 'green'))
|
|
||||||
|
|
||||||
correct = yes_or_no("Ces informations sont elles correctes ?")
|
|
||||||
os.system('cls')
|
|
||||||
|
|
||||||
if correct:
|
|
||||||
wantnewpic = yes_or_no("Voulez-vous prendre une nouvelle photo ?")
|
|
||||||
os.system('cls')
|
|
||||||
if wantnewpic:
|
|
||||||
os.system('cls')
|
|
||||||
if version != 'devnocam':
|
|
||||||
picture = getpic()
|
|
||||||
else:
|
|
||||||
# We crop pic from the previous card
|
|
||||||
cartefilename = os.path.join(imgdir, clientID + '.pdf')
|
|
||||||
pdf = fitz.open(cartefilename)
|
|
||||||
page = pdf.loadPage(0)
|
|
||||||
mat = fitz.Matrix(4.165, 4.165) # To obtain good resolution
|
|
||||||
pix = page.getPixmap(matrix=mat)
|
|
||||||
|
|
||||||
pageimg = Image.frombytes("RGBA", [pix.width, pix.height], pix.samples)
|
|
||||||
picture = pageimg.crop((47, 49, 343, 378))
|
|
||||||
|
|
||||||
barcode = barcode_gen(clientID)
|
|
||||||
fillcard(clientID, titrename, firstname, dateexp, barcode, picture)
|
|
||||||
cartefilename = mergepdf(clientID)
|
|
||||||
if version not in ('dev', 'devnocam'):
|
|
||||||
bkpdb()
|
|
||||||
printcard(cartefilename)
|
|
||||||
writeindb(titre, firstname, surname, clientID, dateinsc, dateexp, new=False)
|
|
||||||
os.system('cls')
|
|
||||||
break
|
|
||||||
|
|
||||||
elif choix == '2': # Renew subscription
|
elif choix == '2': # Renew subscription
|
||||||
dateexp = datetime.strptime(dateexp, '%d/%m/%Y').date()
|
dateexp = datetime.strptime(dateexp, '%d/%m/%Y').date()
|
||||||
@ -474,19 +438,87 @@ 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')
|
||||||
|
|
||||||
|
if titre == 'Dr.':
|
||||||
|
titrename = titre + ' ' + surname
|
||||||
|
else:
|
||||||
|
titrename = surname
|
||||||
|
|
||||||
|
wantnewpic = yes_or_no("Voulez-vous prendre une nouvelle photo ?")
|
||||||
|
os.system('cls')
|
||||||
|
if wantnewpic:
|
||||||
|
os.system('cls')
|
||||||
|
if version != 'devnocam':
|
||||||
|
picture = getpic()
|
||||||
|
else:
|
||||||
|
# We crop pic from the previous card
|
||||||
|
cartefilename = os.path.join(imgdir, clientID + '.pdf')
|
||||||
|
pdf = fitz.open(cartefilename)
|
||||||
|
page = pdf.loadPage(0)
|
||||||
|
mat = fitz.Matrix(4.165, 4.165) # To obtain good resolution
|
||||||
|
pix = page.getPixmap(matrix=mat)
|
||||||
|
pageimg = Image.frombytes("RGBA", [pix.width, pix.height], pix.samples)
|
||||||
|
picture = pageimg.crop((47, 49, 343, 378))
|
||||||
|
|
||||||
|
barcode = barcode_gen(clientID)
|
||||||
|
fillcard(clientID, titrename, firstname, dateexp, barcode, picture)
|
||||||
|
cartefilename = mergepdf(clientID)
|
||||||
|
|
||||||
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, new=False)
|
writeindb(titre, firstname, surname, clientID, dateinsc, dateexp, new=False)
|
||||||
|
os.system('cls')
|
||||||
print(colored("La date d'expiration a bien été mise à jour !\n", 'blue', attrs=['bold']))
|
print(colored("La date d'expiration a bien été mise à jour !\n", 'blue', attrs=['bold']))
|
||||||
|
|
||||||
elif choix == '3': # Print card
|
elif choix == '3': # Print card
|
||||||
print('Print card')
|
printcard(cartefilename)
|
||||||
else:
|
else:
|
||||||
print(colored('Choix incorrect !\n', 'red', attrs=['bold']))
|
print(colored('Choix incorrect !\n', 'red', attrs=['bold']))
|
||||||
return titre, firstname, surname, dateexp
|
return titre, firstname, surname, dateexp
|
||||||
|
|
||||||
|
|
||||||
|
def memberedit(titre, firstname, surname, clientID, dateinsc, dateexp):
|
||||||
|
while "the informations are incorrect": # Loop Filling informations
|
||||||
|
titre, firstname, surname, titrename = get_fullname(titre=titre, firstname=firstname, surname=surname)
|
||||||
|
|
||||||
|
print("Titre : ", colored(titre, 'green'))
|
||||||
|
print("Prénom : ", colored(firstname, 'green'))
|
||||||
|
print("Nom : ", colored(surname, 'green'))
|
||||||
|
|
||||||
|
correct = yes_or_no("Ces informations sont elles correctes ?")
|
||||||
|
os.system('cls')
|
||||||
|
|
||||||
|
if correct:
|
||||||
|
wantnewpic = yes_or_no("Voulez-vous prendre une nouvelle photo ?")
|
||||||
|
os.system('cls')
|
||||||
|
if wantnewpic:
|
||||||
|
os.system('cls')
|
||||||
|
if version != 'devnocam':
|
||||||
|
picture = getpic()
|
||||||
|
else:
|
||||||
|
# We crop pic from the previous card
|
||||||
|
cartefilename = os.path.join(imgdir, clientID + '.pdf')
|
||||||
|
pdf = fitz.open(cartefilename)
|
||||||
|
page = pdf.loadPage(0)
|
||||||
|
mat = fitz.Matrix(4.165, 4.165) # To obtain good resolution
|
||||||
|
pix = page.getPixmap(matrix=mat)
|
||||||
|
|
||||||
|
pageimg = Image.frombytes("RGBA", [pix.width, pix.height], pix.samples)
|
||||||
|
picture = pageimg.crop((47, 49, 343, 378))
|
||||||
|
|
||||||
|
barcode = barcode_gen(clientID)
|
||||||
|
fillcard(clientID, titrename, firstname, dateexp, barcode, picture)
|
||||||
|
cartefilename = mergepdf(clientID)
|
||||||
|
if version not in ('dev', 'devnocam'):
|
||||||
|
bkpdb()
|
||||||
|
printcard(cartefilename)
|
||||||
|
writeindb(titre, firstname, surname, clientID, dateinsc, dateexp, new=False)
|
||||||
|
os.system('cls')
|
||||||
|
break
|
||||||
|
return titre, firstname, surname, dateexp
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
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":
|
||||||
|
Loading…
Reference in New Issue
Block a user