WIP: don notification

This commit is contained in:
Adrien Bourmault 2022-10-09 01:14:45 +02:00
parent 99f5d7de9e
commit 1a459ba029
No known key found for this signature in database
GPG Key ID: 6EB408FE0ACEC664
1 changed files with 15 additions and 7 deletions

View File

@ -87,16 +87,20 @@ def sendmail_with_attachment(headers, data, attachment_header, attachment, endin
def notify_unpaid(record):
# Get infos
name, surname, address, postal_code, city, email, amount, mode, truc = \
get_file_content_all(WORKDIR+"/transition/"+record).split("\n")
pass
content = get_file_content_all(WORKDIR+"/transition/"+record).split("\n")
if len(content) > 8 and "notified" in content[8]:
return
name, surname, address, postal_code, city, email, amount, mode = \
get_file_content_all(WORKDIR+"/transition/"+record).split("\n")[:8]
BUF.append("* {} {}, {}".format(record, name, amount))
BUF.append(" NOTIFICATION DONATEUR")
BUF.append("")
mailtext = get_file_content_all(MODALITY_MAIL) + "\n"
mailtext = mailtext.replace("NOM_DONNEUR", name)
mailtext = mailtext.replace("NOM_DONNEUR", surname+" "+name)
mailtext = mailtext.replace("NUMERO_DON", str(record))
mailtext = mailtext.replace("MONTANT_DON", amount)
mailtext = mailtext.replace("MODE_DON", mode)
@ -106,6 +110,10 @@ def notify_unpaid(record):
print(mailtext)
#sendmail(mailheaders, mailtext)
# Indicate as notified
with open(WORKDIR+"/transition/"+record, "a") as sfile:
sfile.write("notified")
def validate(record):
# Get infos
@ -120,8 +128,8 @@ def validate(record):
except:
return False
name, surname, address, postal_code, city, email, amount, mode, truc = \
get_file_content_all(WORKDIR+"/transition/"+record).split("\n")
name, surname, address, postal_code, city, email, amount, mode = \
get_file_content_all(WORKDIR+"/transition/"+record).split("\n")[:8]
date = datetime.datetime.strptime(
answer["date"],'%Y-%m-%d').strftime("%d/%m/%Y")
@ -188,7 +196,7 @@ def validate(record):
def check_record(intent):
numero, content = get_file_content_all(intent).split("|")
name, surname, address, postal_code, city, email, amount, mode = \
content.split(";")
content.split(";")[:8]
BUF.append("* {} {}, {}".format(numero, name+" "+surname, amount))
BUF.append(" NOUVEAU DON")