Portal data sync: avoid erasing emailperso

This commit is contained in:
viennet 2020-10-12 23:16:41 +02:00
parent a934542537
commit 9d859ad146
2 changed files with 18 additions and 14 deletions

View File

@ -340,8 +340,7 @@ def build_page(
def list_synch(context, sem, anneeapogee=None):
"""
"""
""""""
inscrits = sco_inscr_passage.list_inscrits(
context, sem["formsemestre_id"], with_dems=True
)
@ -573,8 +572,7 @@ def get_annee_naissance(ddmmyyyyy): # stokee en dd/mm/yyyy dans le XML portail
def do_import_etuds_from_portal(context, sem, a_importer, etudsapo_ident, REQUEST):
"""Inscrit les etudiants Apogee dans ce semestre.
"""
"""Inscrit les etudiants Apogee dans ce semestre."""
log("do_import_etuds_from_portal: a_importer=%s" % a_importer)
if not a_importer:
return
@ -777,6 +775,7 @@ def formsemestre_import_etud_admission(
unknowns = [] # etudiants avec NIP mais inconnus du portail
changed_mails = [] # modification d'adresse mails
cnx = context.GetDBConnexion()
for i in ins:
etudid = i["etudid"]
info = context.getEtudInfo(etudid=etudid, filled=1)[0]
@ -794,10 +793,13 @@ def formsemestre_import_etud_admission(
import_naissance=True,
import_identite=import_identite,
)
apo_emailperso = etud.get("mailperso", "")
if info["emailperso"] and not apo_emailperso:
apo_emailperso = info["emailperso"]
if (
import_email
and info["email"] != etud["mail"]
or info["emailperso"] != etud.get("mailperso", "")
or info["emailperso"] != apo_emailperso
):
scolars.adresse_edit(
cnx,
@ -805,7 +807,7 @@ def formsemestre_import_etud_admission(
"etudid": etudid,
"adresse_id": info["adresse_id"],
"email": etud["mail"],
"emailperso": etud.get("mailperso", ""),
"emailperso": apo_emailperso,
},
context=context,
)

View File

@ -268,8 +268,7 @@ def identite_list(cnx, *a, **kw):
def identite_edit_nocheck(cnx, args):
"""Modifie les champs mentionnes dans args, sans verification ni notification.
"""
"""Modifie les champs mentionnes dans args, sans verification ni notification."""
_identiteEditor.edit(cnx, args)
@ -418,14 +417,17 @@ def notify_etud_change(context, email_addr, etud, before, after, subject):
txt = "\n".join(txt)
# build mail
log("notify_etud_change: sending notification to %s" % email_addr)
log("notify_etud_change: subject: %s" % subject)
log(txt)
msg = MIMEMultipart()
subj = Header("[ScoDoc] " + subject, SCO_ENCODING)
msg["Subject"] = subj
msg["From"] = context.get_preference("email_from_addr")
msg["To"] = email_addr
txt = MIMEText(txt, "plain", SCO_ENCODING)
msg.attach(txt)
mime_txt = MIMEText(txt, "plain", SCO_ENCODING)
msg.attach(mime_txt)
context.sendEmail(msg)
return txt
# --------