Bulletins mails interdits - closes #810

This commit is contained in:
Emmanuel Viennet 2023-12-06 23:05:23 +01:00
parent dc0061fb92
commit 7b8d5cff4d
4 changed files with 19 additions and 16 deletions

View File

@ -370,7 +370,7 @@ def bulletin(
formsemestre_id : l'id d'un formsemestre formsemestre_id : l'id d'un formsemestre
code_type : "etudid", "nip" ou "ine" code_type : "etudid", "nip" ou "ine"
code : valeur du code INE, NIP ou etudid, selon code_type. code : valeur du code INE, NIP ou etudid, selon code_type.
version : type de bulletin (par défaut, "long"): short, long, selectedevals, butcourt version : type de bulletin (par défaut, "selectedevals"): short, long, selectedevals, butcourt
pdf : si spécifié, bulletin au format PDF (et non JSON). pdf : si spécifié, bulletin au format PDF (et non JSON).
Exemple de résultat : voir https://scodoc.org/ScoDoc9API/#bulletin Exemple de résultat : voir https://scodoc.org/ScoDoc9API/#bulletin

View File

@ -52,6 +52,7 @@ from app.models import (
FormSemestre, FormSemestre,
Identite, Identite,
ModuleImplInscription, ModuleImplInscription,
ScoDocSiteConfig,
) )
from app.scodoc.sco_permissions import Permission from app.scodoc.sco_permissions import Permission
from app.scodoc.sco_exceptions import AccessDenied, ScoValueError from app.scodoc.sco_exceptions import AccessDenied, ScoValueError
@ -950,13 +951,13 @@ def formsemestre_bulletinetud(
def can_send_bulletin_by_mail(formsemestre_id): def can_send_bulletin_by_mail(formsemestre_id):
"""True if current user is allowed to send a bulletin by mail""" """True if current user is allowed to send a bulletin (pdf) by mail"""
sem = sco_formsemestre.get_formsemestre(formsemestre_id) sem = sco_formsemestre.get_formsemestre(formsemestre_id)
return ( return (
sco_preferences.get_preference("bul_mail_allowed_for_all", formsemestre_id) sco_preferences.get_preference("bul_mail_allowed_for_all", formsemestre_id)
or current_user.has_permission(Permission.EditFormSemestre) or current_user.has_permission(Permission.EditFormSemestre)
or current_user.id in sem["responsables"] or current_user.id in sem["responsables"]
) ) and not ScoDocSiteConfig.is_bul_pdf_disabled()
def do_formsemestre_bulletinetud( def do_formsemestre_bulletinetud(

View File

@ -35,8 +35,8 @@ from flask_login import current_user
from app import db, log from app import db, log
from app.but import cursus_but from app.but import cursus_but
from app.models.etudiants import Identite, make_etud_args from app.models.etudiants import make_etud_args
from app.models.formsemestre import FormSemestre from app.models import Identite, FormSemestre, ScoDocSiteConfig
from app.scodoc import html_sco_header from app.scodoc import html_sco_header
from app.scodoc import htmlutils from app.scodoc import htmlutils
from app.scodoc import sco_archives_etud from app.scodoc import sco_archives_etud
@ -235,7 +235,7 @@ def ficheEtud(etudid=None):
info[ info[
"modifadresse" "modifadresse"
] = f"""<a class="stdlink" href="{ ] = f"""<a class="stdlink" href="{
url_for("scolar.form_change_coordonnees", url_for("scolar.form_change_coordonnees",
scodoc_dept=g.scodoc_dept, etudid=etudid) scodoc_dept=g.scodoc_dept, etudid=etudid)
}">modifier adresse</a>""" }">modifier adresse</a>"""
else: else:
@ -282,7 +282,7 @@ def ficheEtud(etudid=None):
grlinks.append( grlinks.append(
f"""<a class="discretelink" href="{ f"""<a class="discretelink" href="{
url_for('scolar.groups_view', url_for('scolar.groups_view',
scodoc_dept=g.scodoc_dept, group_ids=partition['group_id']) scodoc_dept=g.scodoc_dept, group_ids=partition['group_id'])
}" title="Liste du groupe {gr_name}">{gr_name}</a> }" title="Liste du groupe {gr_name}">{gr_name}</a>
""" """
@ -307,15 +307,17 @@ def ficheEtud(etudid=None):
with_all_columns=False, with_all_columns=False,
a_url="Notes/", a_url="Notes/",
) )
info[ info["link_bul_pdf"] = (
"link_bul_pdf" """<span class="link_bul_pdf fontred">PDF interdits par l'admin.</span>"""
] = f""" if ScoDocSiteConfig.is_bul_pdf_disabled()
else f"""
<span class="link_bul_pdf"> <span class="link_bul_pdf">
<a class="stdlink" href="{ <a class="stdlink" href="{
url_for("notes.etud_bulletins_pdf", scodoc_dept=g.scodoc_dept, etudid=etudid) url_for("notes.etud_bulletins_pdf", scodoc_dept=g.scodoc_dept, etudid=etudid)
}">Tous les bulletins</a> }">Tous les bulletins</a>
</span> </span>
""" """
)
last_formsemestre: FormSemestre = db.session.get( last_formsemestre: FormSemestre = db.session.get(
FormSemestre, info["sems"][0]["formsemestre_id"] FormSemestre, info["sems"][0]["formsemestre_id"]
) )
@ -333,11 +335,11 @@ def ficheEtud(etudid=None):
info[ info[
"link_inscrire_ailleurs" "link_inscrire_ailleurs"
] = f"""<span class="link_bul_pdf"><a class="stdlink" href="{ ] = f"""<span class="link_bul_pdf"><a class="stdlink" href="{
url_for("notes.formsemestre_inscription_with_modules_form", url_for("notes.formsemestre_inscription_with_modules_form",
scodoc_dept=g.scodoc_dept, etudid=etudid) scodoc_dept=g.scodoc_dept, etudid=etudid)
}">Inscrire à un autre semestre</a></span> }">Inscrire à un autre semestre</a></span>
<span class="link_bul_pdf"><a class="stdlink" href="{ <span class="link_bul_pdf"><a class="stdlink" href="{
url_for("notes.jury_delete_manual", url_for("notes.jury_delete_manual",
scodoc_dept=g.scodoc_dept, etudid=etudid) scodoc_dept=g.scodoc_dept, etudid=etudid)
}">Éditer toutes décisions de jury</a></span> }">Éditer toutes décisions de jury</a></span>
""" """
@ -381,7 +383,7 @@ def ficheEtud(etudid=None):
) )
author = sco_users.user_info(a["author"]) author = sco_users.user_info(a["author"])
alist.append( alist.append(
f"""<tr><td><span class="annodate">Le {a['date']} par {author['prenomnom']} : f"""<tr><td><span class="annodate">Le {a['date']} par {author['prenomnom']} :
</span><span class="annoc">{a['comment']}</span></td>{a['dellink']}</tr> </span><span class="annoc">{a['comment']}</span></td>{a['dellink']}</tr>
""" """
) )
@ -514,7 +516,7 @@ def ficheEtud(etudid=None):
scu=scu, scu=scu,
)} )}
<div class="link_validation_rcues"> <div class="link_validation_rcues">
<a href="{url_for("notes.validation_rcues", <a href="{url_for("notes.validation_rcues",
scodoc_dept=g.scodoc_dept, etudid=etudid, scodoc_dept=g.scodoc_dept, etudid=etudid,
formsemestre_id=last_formsemestre.id)}" formsemestre_id=last_formsemestre.id)}"
title="Visualiser les compétences BUT" title="Visualiser les compétences BUT"
@ -530,7 +532,7 @@ def ficheEtud(etudid=None):
<tr><td> <tr><td>
<h2>%(nomprenom)s (%(inscription)s)</h2> <h2>%(nomprenom)s (%(inscription)s)</h2>
%(etat_civil)s %(etat_civil)s
<span>%(emaillink)s</span> <span>%(emaillink)s</span>
</td><td class="photocell"> </td><td class="photocell">
<a href="etud_photo_orig_page?etudid=%(etudid)s">%(etudfoto)s</a> <a href="etud_photo_orig_page?etudid=%(etudid)s">%(etudfoto)s</a>
</td></tr></table> </td></tr></table>

View File

@ -1,7 +1,7 @@
# -*- mode: python -*- # -*- mode: python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
SCOVERSION = "9.6.64" SCOVERSION = "9.6.65"
SCONAME = "ScoDoc" SCONAME = "ScoDoc"