From 851f64f38a686c4112cc226f346b39fd64219a38 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 23 Sep 2024 22:52:21 +0200 Subject: [PATCH] =?UTF-8?q?PV=20jury:=20indique=20d=C3=A9mission=20en=20BU?= =?UTF-8?q?T=20(oubli)=20et=20nouvelle=20pref.=20pour=20signature=20de=20g?= =?UTF-8?q?auche?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/but/jury_but_pv.py | 10 ++++++- app/scodoc/sco_preferences.py | 13 ++++++++++ app/scodoc/sco_pv_pdf.py | 49 ++++++++++++++++++++++++----------- app/scodoc/sco_utils.py | 5 ++++ 4 files changed, 61 insertions(+), 16 deletions(-) diff --git a/app/but/jury_but_pv.py b/app/but/jury_but_pv.py index 80f1b1131..49b21c383 100644 --- a/app/but/jury_but_pv.py +++ b/app/but/jury_but_pv.py @@ -198,7 +198,15 @@ def pvjury_table_but( "niveaux": ( deca.descr_niveaux_validation(line_sep=line_sep) if deca else "-" ), - "decision_but": deca.code_valide if deca else "", + "decision_but": ( + ( + scu.ETATS_INSCRIPTION_SHORT.get(deca.inscription_etat) + if deca.inscription_etat != scu.INSCRIT + else deca.code_valide + ) + if deca + else "" + ), "devenir": ( "Diplôme obtenu" if has_diplome diff --git a/app/scodoc/sco_preferences.py b/app/scodoc/sco_preferences.py index 6e0cfdeb9..626b5dd28 100644 --- a/app/scodoc/sco_preferences.py +++ b/app/scodoc/sco_preferences.py @@ -1031,6 +1031,19 @@ class BasePreferences: "category": "pvpdf", }, ), + ( + "PV_SIGNATURE_LEFT", + { + "initvalue": "", + "title": "Texte signature PV gauche", + "explanation": """texte optionnel placé sous la table + du PV de jury, à gauche de la signature""", + "input_type": "textarea", + "rows": 1, + "cols": 64, + "category": "pvpdf", + }, + ), ( "ChiefDeptName", { diff --git a/app/scodoc/sco_pv_pdf.py b/app/scodoc/sco_pv_pdf.py index a9d482795..8a4811a77 100644 --- a/app/scodoc/sco_pv_pdf.py +++ b/app/scodoc/sco_pv_pdf.py @@ -31,13 +31,8 @@ import io import reportlab from reportlab.lib.units import cm, mm -from reportlab.lib.enums import TA_JUSTIFY -from reportlab.platypus import ( - Paragraph, - Spacer, - PageBreak, - Table, -) +from reportlab.lib.enums import TA_JUSTIFY, TA_LEFT, TA_RIGHT +from reportlab.platypus import Paragraph, Spacer, PageBreak, Table, TableStyle from reportlab.platypus.doctemplate import BaseDocTemplate from reportlab.lib.pagesizes import A4, landscape from reportlab.lib import styles @@ -179,7 +174,7 @@ def _pvjury_pdf_type( ) -> tuple[list, bool]: """Objets platypus PDF récapitulant les décisions de jury pour un type de jury (passage ou delivrance). - Ramene: liste d'onj platypus, et un boolen indiquant si au moins un étudiant est diplômé. + Ramene: liste d'obj platypus, et un booléen indiquant si au moins un étudiant est diplômé. """ from app.scodoc import sco_pv_forms from app.but import jury_but_pv @@ -325,15 +320,39 @@ def _pvjury_pdf_type( Table(table_cells, repeatRows=1, colWidths=widths, style=table_style) ) - # Signature du directeur - objects += sco_pdf.make_paras( - f"""{ - sco_preferences.get_preference("DirectorName", formsemestre.id) or "" - }, { - sco_preferences.get_preference("DirectorTitle", formsemestre.id) or "" - }""", + # Table sous la table avec signatures + # Create paragraphs + left_para = sco_pdf.make_paras( + f"""{ + sco_preferences.get_preference("PV_SIGNATURE_LEFT", formsemestre.id) or "" + }""", style, ) + # Signature du directeur + right_para = sco_pdf.make_paras( + f"""{ + sco_preferences.get_preference("DirectorName", formsemestre.id) or "" + }, { + sco_preferences.get_preference("DirectorTitle", formsemestre.id) or "" + }""", + style, + ) + # Create a table with two cells + data = [[left_para, right_para]] + # Create the table + table_signatures = Table(data) + # Apply table style to remove borders + table_signatures.setStyle( + TableStyle( + [ + ("BOX", (0, 0), (-1, -1), 0, "white"), # No border for the table + ("INNERGRID", (0, 0), (-1, -1), 0, "white"), # No inner grid lines + ("VALIGN", (0, 0), (-1, -1), "TOP"), # Align content to the top + ] + ) + ) + objects.append(Spacer(0, 6 * mm)) + objects.append(table_signatures) # Légende des codes codes = list(codes_cursus.CODES_EXPL.keys()) diff --git a/app/scodoc/sco_utils.py b/app/scodoc/sco_utils.py index c88e2e04b..d4c710cc3 100644 --- a/app/scodoc/sco_utils.py +++ b/app/scodoc/sco_utils.py @@ -109,6 +109,11 @@ ETATS_INSCRIPTION = { DEMISSION: "Démission", DEF: "Défaillant", } +ETATS_INSCRIPTION_SHORT = { + INSCRIT: "I", + DEMISSION: "DEM", + DEF: "DEF", +} def convert_fr_date(