WIP: don notification

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

View File

@ -86,12 +86,12 @@ def sendmail_with_attachment(headers, data, attachment_header, attachment, endin
subprocess.run([SENDMAIL_LOCATION, "-t", "-oi"], input=msg) subprocess.run([SENDMAIL_LOCATION, "-t", "-oi"], input=msg)
def notify_unpaid(record): def notify_unpaid(record):
# Get infos # Check if notified
content = get_file_content_all(WORKDIR+"/transition/"+record).split("\n") content = get_file_content_all(WORKDIR+"/transition/"+record).split("\n")
if len(content) > 8 and "notified" in content[8]: if len(content) > 8 and "notified" in content[8]:
return return
# Get infos
name, surname, address, postal_code, city, email, amount, mode = \ name, surname, address, postal_code, city, email, amount, mode = \
get_file_content_all(WORKDIR+"/transition/"+record).split("\n")[:8] get_file_content_all(WORKDIR+"/transition/"+record).split("\n")[:8]
@ -107,8 +107,8 @@ def notify_unpaid(record):
mailheaders = get_file_content_all(MODALITY_MAIL_HEADERS) + "\n" mailheaders = get_file_content_all(MODALITY_MAIL_HEADERS) + "\n"
mailheaders = mailheaders.replace("COURRIEL_DONNEUR", email) mailheaders = mailheaders.replace("COURRIEL_DONNEUR", email)
print(mailtext) # Notify
#sendmail(mailheaders, mailtext) sendmail(mailheaders, mailtext)
# Indicate as notified # Indicate as notified
with open(WORKDIR+"/transition/"+record, "a") as sfile: with open(WORKDIR+"/transition/"+record, "a") as sfile: