|
|
@@ -22,7 +22,6 @@ logger = logging.getLogger("mails_rappel_ctrl")
|
|
|
logconf.start("mails_rappel_ctrl", logging.DEBUG)
|
|
|
|
|
|
DEBUG = False
|
|
|
-wrkdir = ""
|
|
|
|
|
|
# # CONFIG
|
|
|
|
|
|
@@ -44,7 +43,7 @@ CONTACT = "jacky.klein@bas-rhin.fr"
|
|
|
# NB: variables optionelles utilisables dans CONTENT: {chantier_id}, {date_status}, {contact}
|
|
|
CONTENT = """<p>Bonjour,</p>
|
|
|
<p>
|
|
|
- Le chantier numéro {chantier_id} est en attente d'une intervention depuis le {date_status:%d-%m-%Y}.
|
|
|
+ Le chantier numéro {chantier_id}, situé à '{chantier_loc}', est en attente d'une intervention depuis le {date_status:%d-%m-%Y}.
|
|
|
</p>
|
|
|
<p>Pour plus d'information, ou si vous ne souhaitez plus recevoir de rappel pour ce chantier: <a href="mailto:{contact}">{contact}</a></p>
|
|
|
<p>
|
|
|
@@ -89,13 +88,12 @@ def main():
|
|
|
"""
|
|
|
|
|
|
# Selectionne les chantiers pour lesquels un mail doit être envoyé
|
|
|
- sql = """SELECT tblChantiers.lngChantierId, tblChantiers.mailContact, tblChantiers.strInterlEntreprise,
|
|
|
+ sql = """SELECT tblChantiers.lngChantierId, tblChantiers.strLocChantier, tblChantiers.mailContact, tblChantiers.strInterlEntreprise,
|
|
|
tblChantiers.stopMails, statuts.a1_status, statuts.since
|
|
|
FROM tblChantiers INNER JOIN ({subsql}) as statuts ON tblChantiers.lngChantierId = statuts.lngChantierId
|
|
|
WHERE statuts.a1_status=True
|
|
|
AND tblChantiers.lngChantierId>={depart}
|
|
|
AND statuts.since<=(Date()-{seuil})
|
|
|
- ;
|
|
|
""".format(subsql=subsql,
|
|
|
seuil=SEUIL_DUREE,
|
|
|
depart=CHANTIER_DEPART)
|
|
|
@@ -105,7 +103,7 @@ def main():
|
|
|
qry = db.execute(sql)
|
|
|
|
|
|
for row in qry:
|
|
|
- chantier_id, mail_to, nom_dest, stop_mails, _, since = row
|
|
|
+ chantier_id, chantier_loc, mail_to, nom_dest, stop_mails, _, since = row
|
|
|
if DEBUG:
|
|
|
mail_to = "olivier.massot@bas-rhin.fr"
|
|
|
|
|
|
@@ -123,7 +121,7 @@ def main():
|
|
|
"Application": "scripts-pde",
|
|
|
"Sujet": "Rappel Chantier {chantier_id}".format(chantier_id=chantier_id),
|
|
|
"MessageURL": TEMPLATE_URL,
|
|
|
- "Message": html.escape(CONTENT.format(chantier_id=chantier_id, date_status=since, contact=CONTACT), quote=False),
|
|
|
+ "Message": html.escape(CONTENT.format(chantier_id=chantier_id, chantier_loc=chantier_loc, date_status=since, contact=CONTACT), quote=False),
|
|
|
"Email": mail_to,
|
|
|
"NomExpediteur": "Script - Parc Départemental d'Erstein",
|
|
|
"NomDestinataire": nom_dest
|