diff --git a/app/api/etudiants.py b/app/api/etudiants.py index cb150fe7..4ee02a29 100644 --- a/app/api/etudiants.py +++ b/app/api/etudiants.py @@ -219,6 +219,10 @@ def etudiant_formsemestres(etudid: int = None, nip: int = None, ine: int = None) "/etudiant///formsemestre//bulletin//pdf", defaults={"pdf": True}, ) +@bp.route( + "/etudiant///formsemestre//bulletin//pdf/nosig", + defaults={"pdf": True, "with_img_signatures_pdf": False}, +) @api_web_bp.route( "/etudiant///formsemestre//bulletin", ) @@ -229,6 +233,10 @@ def etudiant_formsemestres(etudid: int = None, nip: int = None, ine: int = None) "/etudiant///formsemestre//bulletin//pdf", defaults={"pdf": True}, ) +@api_web_bp.route( + "/etudiant///formsemestre//bulletin//pdf/nosig", + defaults={"pdf": True, "with_img_signatures_pdf": False}, +) @scodoc @permission_required(Permission.ScoView) def bulletin( @@ -237,6 +245,7 @@ def bulletin( formsemestre_id: int = None, version: str = "long", pdf: bool = False, + with_img_signatures_pdf: bool = True, ): """ Retourne le bulletin d'un étudiant en fonction de son id et d'un semestre donné @@ -276,7 +285,11 @@ def bulletin( return json_error(404, message="etudiant inexistant") if pdf: pdf_response, _ = do_formsemestre_bulletinetud( - formsemestre, etud.id, version=version, format="pdf" + formsemestre, + etud.id, + version=version, + format="pdf", + with_img_signatures_pdf=with_img_signatures_pdf, ) return pdf_response return sco_bulletins.get_formsemestre_bulletin_etud_json( diff --git a/app/scodoc/sco_bulletins.py b/app/scodoc/sco_bulletins.py index 2bc44494..67ba9851 100644 --- a/app/scodoc/sco_bulletins.py +++ b/app/scodoc/sco_bulletins.py @@ -951,9 +951,10 @@ def do_formsemestre_bulletinetud( etudid: int, version="long", # short, long, selectedevals format=None, - xml_with_decisions=False, # force décisions dans XML - force_publishing=False, # force publication meme si semestre non publié sur "portail" - prefer_mail_perso=False, # mails envoyés sur adresse perso si non vide + xml_with_decisions: bool = False, + force_publishing: bool = False, + prefer_mail_perso: bool = False, + with_img_signatures_pdf: bool = True, ): """Génère le bulletin au format demandé. Utilisé pour: @@ -961,6 +962,12 @@ def do_formsemestre_bulletinetud( - le format "oldjson" (les json sont générés à part, voir get_formsemestre_bulletin_etud_json) - les formats PDF, XML et mail pdf (toutes formations) + Options: + - xml_with_decisions: force décisions dans XML + - force_publishing: force publication meme si semestre non publié sur "portail" + - prefer_mail_perso: mails envoyés sur adresse perso si non vide + - with_img_signatures_pdf: si faux, ne met pas les signatures dans le footer PDF. + Résultat: (bul, filigranne) où bul est str ou bytes au format demandé (html, pdf, pdfmail, pdfpart, xml, json) et filigranne est un message à placer en "filigranne" (eg "Provisoire"). @@ -1009,6 +1016,7 @@ def do_formsemestre_bulletinetud( version=version, format="pdf", stand_alone=(format != "pdfpart"), + with_img_signatures_pdf=with_img_signatures_pdf, ) if format == "pdf": return ( diff --git a/app/scodoc/sco_bulletins_generator.py b/app/scodoc/sco_bulletins_generator.py index 0d5ad046..36e69cd6 100644 --- a/app/scodoc/sco_bulletins_generator.py +++ b/app/scodoc/sco_bulletins_generator.py @@ -88,6 +88,7 @@ class BulletinGenerator: version="long", filigranne=None, server_name=None, + with_img_signatures_pdf: bool = True, ): from app.scodoc import sco_preferences @@ -98,6 +99,7 @@ class BulletinGenerator: self.version = version self.filigranne = filigranne self.server_name = server_name + self.with_img_signatures_pdf = with_img_signatures_pdf # Store preferences for convenience: formsemestre_id = self.infos["formsemestre_id"] self.preferences = sco_preferences.SemPreferences(formsemestre_id) @@ -249,6 +251,7 @@ def make_formsemestre_bulletinetud( version=None, # short, long, selectedevals format="pdf", # html, pdf stand_alone=True, + with_img_signatures_pdf: bool = True, ): """Bulletin de notes @@ -277,9 +280,7 @@ def make_formsemestre_bulletinetud( gen_class = bulletin_get_class(bul_class_name) if gen_class is None: - raise ValueError( - "Type de bulletin PDF invalide (paramètre: %s)" % bul_class_name - ) + raise ValueError(f"Type de bulletin PDF invalide (paramètre: {bul_class_name})") try: PDFLOCK.acquire() @@ -289,6 +290,7 @@ def make_formsemestre_bulletinetud( version=version, filigranne=infos["filigranne"], server_name=request.url_root, + with_img_signatures_pdf=with_img_signatures_pdf, ) if format not in bul_generator.supported_formats: # use standard generator @@ -304,6 +306,7 @@ def make_formsemestre_bulletinetud( version=version, filigranne=infos["filigranne"], server_name=request.url_root, + with_img_signatures_pdf=with_img_signatures_pdf, ) data = bul_generator.generate(format=format, stand_alone=stand_alone) diff --git a/app/scodoc/sco_bulletins_standard.py b/app/scodoc/sco_bulletins_standard.py index be5c506f..da854cbe 100644 --- a/app/scodoc/sco_bulletins_standard.py +++ b/app/scodoc/sco_bulletins_standard.py @@ -213,7 +213,7 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator): """ show_left = self.preferences["bul_show_sig_left"] show_right = self.preferences["bul_show_sig_right"] - if show_left or show_right: + if self.with_img_signatures_pdf and (show_left or show_right): if show_left: L = [ [