diff --git a/app/scodoc/sco_pvjury.py b/app/scodoc/sco_pvjury.py index 3cba7a93..9b374b8e 100644 --- a/app/scodoc/sco_pvjury.py +++ b/app/scodoc/sco_pvjury.py @@ -52,7 +52,8 @@ from reportlab.platypus import Paragraph from reportlab.lib import styles import flask -from flask import url_for, g, redirect, request +from flask import flash, redirect, url_for +from flask import g, request from app.comp import res_sem from app.comp.res_compat import NotesTableCompat @@ -798,7 +799,7 @@ def descrform_pvjury(sem): def formsemestre_lettres_individuelles(formsemestre_id, group_ids=[]): "Lettres avis jury en PDF" - sem = sco_formsemestre.get_formsemestre(formsemestre_id) + formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id) if not group_ids: # tous les inscrits du semestre group_ids = [sco_groups.get_default_group(formsemestre_id)] @@ -814,10 +815,15 @@ def formsemestre_lettres_individuelles(formsemestre_id, group_ids=[]): cssstyles=sco_groups_view.CSSSTYLES, init_qtip=True, ), - """
Utiliser cette page pour éditer des versions provisoires des PV. - Il est recommandé d'archiver les versions définitives: voir cette page
- """ - % formsemestre_id, + f"""Utiliser cette page pour éditer des versions provisoires des PV. + Il est recommandé d'archiver les versions définitives: voir cette page
+ """, ] F = html_sco_header.sco_footer() descr = descrform_lettres_individuelles() @@ -842,7 +848,11 @@ def formsemestre_lettres_individuelles(formsemestre_id, group_ids=[]): return "\n".join(H) + "\n" + tf[1] + F elif tf[0] == -1: return flask.redirect( - "formsemestre_pvjury?formsemestre_id=%s" % (formsemestre_id) + url_for( + "notes.formsemestre_pvjury", + scodoc_dept=g.scodoc_dept, + formsemestre_id=formsemestre_id, + ) ) else: # submit @@ -860,15 +870,17 @@ def formsemestre_lettres_individuelles(formsemestre_id, group_ids=[]): finally: PDFLOCK.release() if not pdfdoc: + flash("Aucun étudiant n'a de décision de jury !") return flask.redirect( - "formsemestre_status?formsemestre_id={}&head_message=Aucun%20%C3%A9tudiant%20n%27a%20de%20d%C3%A9cision%20de%20jury".format( - formsemestre_id + url_for( + "notes.formsemestre_status", + scodoc_dept=g.scodoc_dept, + formsemestre_id=formsemestre_id, ) ) - sem = sco_formsemestre.get_formsemestre(formsemestre_id) - dt = time.strftime("%Y-%m-%d") + groups_filename = "-" + groups_infos.groups_filename - filename = "lettres-%s%s-%s.pdf" % (sem["titre_num"], groups_filename, dt) + filename = f"""lettres-{formsemestre.titre_num()}{groups_filename}-{time.strftime("%Y-%m-%d")}.pdf""" return scu.sendPDFFile(pdfdoc, filename) diff --git a/app/scodoc/sco_pvpdf.py b/app/scodoc/sco_pvpdf.py index b2515895..8ef1c12c 100644 --- a/app/scodoc/sco_pvpdf.py +++ b/app/scodoc/sco_pvpdf.py @@ -45,13 +45,14 @@ from flask import g import app.scodoc.sco_utils as scu from app.scodoc import sco_bulletins_pdf from app.scodoc import sco_codes_parcours +from app.scodoc import sco_etud from app.scodoc import sco_formsemestre from app.scodoc import sco_pdf from app.scodoc import sco_preferences -from app.scodoc import sco_etud -import sco_version from app.scodoc.sco_logos import find_logo +from app.scodoc.sco_parcours_dut import SituationEtudParcours from app.scodoc.sco_pdf import SU +import sco_version LOGO_FOOTER_ASPECT = scu.CONFIG.LOGO_FOOTER_ASPECT # XXX A AUTOMATISER LOGO_FOOTER_HEIGHT = scu.CONFIG.LOGO_FOOTER_HEIGHT * mm @@ -62,7 +63,7 @@ LOGO_HEADER_HEIGHT = scu.CONFIG.LOGO_HEADER_HEIGHT * mm LOGO_HEADER_WIDTH = LOGO_HEADER_HEIGHT * scu.CONFIG.LOGO_HEADER_ASPECT -def pageFooter(canvas, doc, logo, preferences, with_page_numbers=True): +def page_footer(canvas, doc, logo, preferences, with_page_numbers=True): "Add footer on page" width = doc.pagesize[0] # - doc.pageTemplate.left_p - doc.pageTemplate.right_p foot = Frame( @@ -78,24 +79,24 @@ def pageFooter(canvas, doc, logo, preferences, with_page_numbers=True): showBoundary=0, ) - LeftFootStyle = reportlab.lib.styles.ParagraphStyle({}) - LeftFootStyle.fontName = preferences["SCOLAR_FONT"] - LeftFootStyle.fontSize = preferences["SCOLAR_FONT_SIZE_FOOT"] - LeftFootStyle.leftIndent = 0 - LeftFootStyle.firstLineIndent = 0 - LeftFootStyle.alignment = TA_RIGHT - RightFootStyle = reportlab.lib.styles.ParagraphStyle({}) - RightFootStyle.fontName = preferences["SCOLAR_FONT"] - RightFootStyle.fontSize = preferences["SCOLAR_FONT_SIZE_FOOT"] - RightFootStyle.alignment = TA_RIGHT + left_foot_style = reportlab.lib.styles.ParagraphStyle({}) + left_foot_style.fontName = preferences["SCOLAR_FONT"] + left_foot_style.fontSize = preferences["SCOLAR_FONT_SIZE_FOOT"] + left_foot_style.leftIndent = 0 + left_foot_style.firstLineIndent = 0 + left_foot_style.alignment = TA_RIGHT + right_foot_style = reportlab.lib.styles.ParagraphStyle({}) + right_foot_style.fontName = preferences["SCOLAR_FONT"] + right_foot_style.fontSize = preferences["SCOLAR_FONT_SIZE_FOOT"] + right_foot_style.alignment = TA_RIGHT p = sco_pdf.makeParas( - """