WIP: don notification
This commit is contained in:
parent
99f5d7de9e
commit
1a459ba029
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue