From 295ff983a155d98e3d537270bb00f4c7f40410e5 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 3 May 2021 11:45:00 +0200 Subject: [PATCH 1/2] getEtudInfo: add format arg --- ZScolar.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ZScolar.py b/ZScolar.py index ad1672963..687520b88 100644 --- a/ZScolar.py +++ b/ZScolar.py @@ -780,7 +780,7 @@ REQUEST.URL0=%s
# -------------------------- INFOS SUR ETUDIANTS -------------------------- security.declareProtected(ScoView, "getEtudInfo") - def getEtudInfo(self, etudid=False, code_nip=False, filled=False, REQUEST=None): + def getEtudInfo(self, etudid=False, code_nip=False, filled=False, REQUEST=None, format=None): """infos sur un etudiant pour utilisation en Zope DTML On peut specifier etudid ou bien cherche dans REQUEST.form: etudid, code_nip, code_ine @@ -791,9 +791,13 @@ REQUEST.URL0=%s
cnx = self.GetDBConnexion() args = make_etud_args(etudid=etudid, code_nip=code_nip, REQUEST=REQUEST) etud = scolars.etudident_list(cnx, args=args) + if filled: self.fillEtudsInfo(etud) - return etud + if format is None: + return etud + else: + return scu.sendResult(REQUEST, etud, name="etud", format=format) security.declareProtected(ScoView, "search_etud_in_dept") search_etud_in_dept = sco_find_etud.search_etud_in_dept From 13ea7aaa9ea1dd620edbeb9c68a13abffeff8f93 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 3 May 2021 11:56:41 +0200 Subject: [PATCH 2/2] Fix type demijournee --- sco_abs_views.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/sco_abs_views.py b/sco_abs_views.py index 70ada694f..59aced2cd 100644 --- a/sco_abs_views.py +++ b/sco_abs_views.py @@ -76,8 +76,9 @@ def doSignaleAbsence( description_abs = description dates = sco_abs.DateRangeISO(context, datedebut, datefin) nbadded = 0 + demijournee = int(demijournee) for jour in dates: - if demijournee == "2": + if demijournee == 2: context._AddAbsence( etudid, jour, False, estjust, REQUEST, description_abs, moduleimpl_id ) @@ -86,9 +87,8 @@ def doSignaleAbsence( ) nbadded += 2 else: - matin = int(demijournee) context._AddAbsence( - etudid, jour, matin, estjust, REQUEST, description_abs, moduleimpl_id + etudid, jour, demijournee, estjust, REQUEST, description_abs, moduleimpl_id ) nbadded += 1 # @@ -281,8 +281,9 @@ def doJustifAbsence( description_abs = description dates = sco_abs.DateRangeISO(context, datedebut, datefin) nbadded = 0 + demijournee = int(demijournee) for jour in dates: - if demijournee == "2": + if demijournee == 2: context._AddJustif( etudid=etudid, jour=jour, @@ -299,11 +300,10 @@ def doJustifAbsence( ) nbadded += 2 else: - matin = int(demijournee) context._AddJustif( etudid=etudid, jour=jour, - matin=matin, + matin=demijournee, REQUEST=REQUEST, description=description_abs, ) @@ -404,14 +404,14 @@ def doAnnuleAbsence( dates = sco_abs.DateRangeISO(context, datedebut, datefin) nbadded = 0 + demijournee = int(demijournee) for jour in dates: - if demijournee == "2": + if demijournee == 2: context._AnnuleAbsence(etudid, jour, False, REQUEST=REQUEST) context._AnnuleAbsence(etudid, jour, True, REQUEST=REQUEST) nbadded += 2 else: - matin = int(demijournee) - context._AnnuleAbsence(etudid, jour, matin, REQUEST=REQUEST) + context._AnnuleAbsence(etudid, jour, demijournee, REQUEST=REQUEST) nbadded += 1 # H = [ @@ -539,15 +539,15 @@ def doAnnuleJustif( etudid = etud["etudid"] dates = sco_abs.DateRangeISO(context, datedebut0, datefin0) nbadded = 0 + demijournee = int(demijournee) for jour in dates: # Attention: supprime matin et après-midi - if demijournee == "2": + if demijournee == 2: context._AnnuleJustif(etudid, jour, False, REQUEST=REQUEST) context._AnnuleJustif(etudid, jour, True, REQUEST=REQUEST) nbadded += 2 else: - matin = int(demijournee) - context._AnnuleJustif(etudid, jour, matin, REQUEST=REQUEST) + context._AnnuleJustif(etudid, jour, demijournee, REQUEST=REQUEST) nbadded += 1 # H = [ @@ -720,7 +720,7 @@ def ListeAbsEtud( ): """Liste des absences d'un étudiant sur l'année en cours En format 'html': page avec deux tableaux (non justifiées et justifiées). - En format xls ou pdf: l'un ou l'autre des table, suivant absjust_only. + En format json, xml, xls ou pdf: l'un ou l'autre des table, suivant absjust_only. En format 'text': texte avec liste d'absences (pour mails). """ absjust_only = int(absjust_only) # si vrai, table absjust seule (export xls ou pdf) @@ -732,7 +732,6 @@ def ListeAbsEtud( titles, columns_ids, absnonjust, absjust = context.Absences._TablesAbsEtud( etudid, datedebut, with_evals=with_evals, format=format ) - if REQUEST: base_url_nj = "%s?etudid=%s&absjust_only=0" % (REQUEST.URL0, etudid) base_url_j = "%s?etudid=%s&absjust_only=1" % (REQUEST.URL0, etudid)