diff --git a/app/auth/models.py b/app/auth/models.py index 289334761b0ac029a7ff0edc6523f11675aaf9ec..7020db177c34b4b7b3d78fc0db032776f12f0eb8 100644 --- a/app/auth/models.py +++ b/app/auth/models.py @@ -630,7 +630,7 @@ class User(UserMixin, ScoDocModel): def get_nomcomplet(self): "Prénom et nom complets" - return "Tata Yoyoyoyo" + return scu.format_prenom(self.prenom) + " " + self.get_nom_fmt() # nomnoacc était le nom en minuscules sans accents (inutile) diff --git a/app/scodoc/sco_formsemestre_inscriptions.py b/app/scodoc/sco_formsemestre_inscriptions.py index 9e9324255eb24f413004a5c845a1af2234c2eeb7..814e887a60a1003bd33c28bf1ad0e1b519af6e30 100644 --- a/app/scodoc/sco_formsemestre_inscriptions.py +++ b/app/scodoc/sco_formsemestre_inscriptions.py @@ -57,6 +57,8 @@ from app.scodoc import sco_moduleimpl from app.scodoc import sco_groups from app.scodoc import sco_etud from app.scodoc import sco_cache +from app.scodoc import sco_preferences +from app import email # --- Gestion des inscriptions aux semestres @@ -142,10 +144,28 @@ def do_formsemestre_demission( db.session.commit() sco_cache.invalidate_formsemestre(formsemestre_id=formsemestre_id) if etat_new == scu.DEMISSION: - flash("Démission enregistrée") + + etud = Identite.get_etud(etudid) + prefs = sco_preferences.SemPreferences( + formsemestre_id=formsemestre.id if formsemestre else None + ) + destination = prefs["emails_notifications"] or "" + if (destination == ""): + str_mail_send = "aucune adresse mail disponible pour notifier les opérations dans le paramétrage" + else : + send_demission_mail(etud.__repr__(),destination) + str_mail_send = "mail pour notifier les opérations envoyer" + flash("Démission enregistrée, " + str_mail_send) + elif etat_new == scu.DEF: flash("Défaillance enregistrée") +def send_demission_mail(etud_info,destinations): + subject = "[ScoDoc] Notification de démission" + sender = email.get_from_addr() + txt = "La démission de l'étudiant : " + etud_info + " à était réaliser avec succès" + email.send_email(subject, sender, destinations, txt) + def do_formsemestre_inscription_edit(args=None, formsemestre_id=None): "edit a formsemestre_inscription"