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