Bugs corrections
This commit is contained in:
parent
5d76b1f584
commit
9ab362fd29
70
IFPass.py
70
IFPass.py
@ -428,6 +428,57 @@ def memberdo(choix, member):
|
||||
|
||||
os.system('cls')
|
||||
if choix == '1': # Edit member
|
||||
titre, firstname, surname, dateexp = memberedit(titre, firstname, surname, clientID, dateinsc, dateexp)
|
||||
|
||||
elif choix == '2': # Renew subscription
|
||||
dateexp = datetime.strptime(dateexp, '%d/%m/%Y').date()
|
||||
diff = (dateexp - date.today()).days
|
||||
if diff >= 0:
|
||||
dateexp = dateexp + timedelta(days=365)
|
||||
elif diff < 0:
|
||||
dateexp = date.today() + timedelta(days=365)
|
||||
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'):
|
||||
bkpdb()
|
||||
printcard(cartefilename)
|
||||
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']))
|
||||
|
||||
elif choix == '3': # Print card
|
||||
printcard(cartefilename)
|
||||
else:
|
||||
print(colored('Choix incorrect !\n', 'red', attrs=['bold']))
|
||||
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)
|
||||
|
||||
@ -465,25 +516,6 @@ def memberdo(choix, member):
|
||||
writeindb(titre, firstname, surname, clientID, dateinsc, dateexp, new=False)
|
||||
os.system('cls')
|
||||
break
|
||||
|
||||
elif choix == '2': # Renew subscription
|
||||
dateexp = datetime.strptime(dateexp, '%d/%m/%Y').date()
|
||||
diff = (dateexp - date.today()).days
|
||||
if diff >= 0:
|
||||
dateexp = dateexp + timedelta(days=365)
|
||||
elif diff < 0:
|
||||
dateexp = date.today() + timedelta(days=365)
|
||||
dateexp = dateexp.strftime('%d/%m/%Y')
|
||||
if version not in ('dev', 'devnocam'):
|
||||
bkpdb()
|
||||
printcard(cartefilename)
|
||||
writeindb(titre, firstname, surname, clientID, dateinsc, dateexp, new=False)
|
||||
print(colored("La date d'expiration a bien été mise à jour !\n", 'blue', attrs=['bold']))
|
||||
|
||||
elif choix == '3': # Print card
|
||||
print('Print card')
|
||||
else:
|
||||
print(colored('Choix incorrect !\n', 'red', attrs=['bold']))
|
||||
return titre, firstname, surname, dateexp
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user