This commit is contained in:
root 2021-05-05 11:44:48 +02:00
commit 87f136d6b9
2 changed files with 19 additions and 16 deletions

View File

@ -780,7 +780,7 @@ REQUEST.URL0=%s<br/>
# -------------------------- INFOS SUR ETUDIANTS -------------------------- # -------------------------- INFOS SUR ETUDIANTS --------------------------
security.declareProtected(ScoView, "getEtudInfo") 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 """infos sur un etudiant pour utilisation en Zope DTML
On peut specifier etudid On peut specifier etudid
ou bien cherche dans REQUEST.form: etudid, code_nip, code_ine ou bien cherche dans REQUEST.form: etudid, code_nip, code_ine
@ -791,9 +791,13 @@ REQUEST.URL0=%s<br/>
cnx = self.GetDBConnexion() cnx = self.GetDBConnexion()
args = make_etud_args(etudid=etudid, code_nip=code_nip, REQUEST=REQUEST) args = make_etud_args(etudid=etudid, code_nip=code_nip, REQUEST=REQUEST)
etud = scolars.etudident_list(cnx, args=args) etud = scolars.etudident_list(cnx, args=args)
if filled: if filled:
self.fillEtudsInfo(etud) 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") security.declareProtected(ScoView, "search_etud_in_dept")
search_etud_in_dept = sco_find_etud.search_etud_in_dept search_etud_in_dept = sco_find_etud.search_etud_in_dept

View File

@ -76,8 +76,9 @@ def doSignaleAbsence(
description_abs = description description_abs = description
dates = sco_abs.DateRangeISO(context, datedebut, datefin) dates = sco_abs.DateRangeISO(context, datedebut, datefin)
nbadded = 0 nbadded = 0
demijournee = int(demijournee)
for jour in dates: for jour in dates:
if demijournee == "2": if demijournee == 2:
context._AddAbsence( context._AddAbsence(
etudid, jour, False, estjust, REQUEST, description_abs, moduleimpl_id etudid, jour, False, estjust, REQUEST, description_abs, moduleimpl_id
) )
@ -86,9 +87,8 @@ def doSignaleAbsence(
) )
nbadded += 2 nbadded += 2
else: else:
matin = int(demijournee)
context._AddAbsence( context._AddAbsence(
etudid, jour, matin, estjust, REQUEST, description_abs, moduleimpl_id etudid, jour, demijournee, estjust, REQUEST, description_abs, moduleimpl_id
) )
nbadded += 1 nbadded += 1
# #
@ -281,8 +281,9 @@ def doJustifAbsence(
description_abs = description description_abs = description
dates = sco_abs.DateRangeISO(context, datedebut, datefin) dates = sco_abs.DateRangeISO(context, datedebut, datefin)
nbadded = 0 nbadded = 0
demijournee = int(demijournee)
for jour in dates: for jour in dates:
if demijournee == "2": if demijournee == 2:
context._AddJustif( context._AddJustif(
etudid=etudid, etudid=etudid,
jour=jour, jour=jour,
@ -299,11 +300,10 @@ def doJustifAbsence(
) )
nbadded += 2 nbadded += 2
else: else:
matin = int(demijournee)
context._AddJustif( context._AddJustif(
etudid=etudid, etudid=etudid,
jour=jour, jour=jour,
matin=matin, matin=demijournee,
REQUEST=REQUEST, REQUEST=REQUEST,
description=description_abs, description=description_abs,
) )
@ -404,14 +404,14 @@ def doAnnuleAbsence(
dates = sco_abs.DateRangeISO(context, datedebut, datefin) dates = sco_abs.DateRangeISO(context, datedebut, datefin)
nbadded = 0 nbadded = 0
demijournee = int(demijournee)
for jour in dates: for jour in dates:
if demijournee == "2": if demijournee == 2:
context._AnnuleAbsence(etudid, jour, False, REQUEST=REQUEST) context._AnnuleAbsence(etudid, jour, False, REQUEST=REQUEST)
context._AnnuleAbsence(etudid, jour, True, REQUEST=REQUEST) context._AnnuleAbsence(etudid, jour, True, REQUEST=REQUEST)
nbadded += 2 nbadded += 2
else: else:
matin = int(demijournee) context._AnnuleAbsence(etudid, jour, demijournee, REQUEST=REQUEST)
context._AnnuleAbsence(etudid, jour, matin, REQUEST=REQUEST)
nbadded += 1 nbadded += 1
# #
H = [ H = [
@ -539,15 +539,15 @@ def doAnnuleJustif(
etudid = etud["etudid"] etudid = etud["etudid"]
dates = sco_abs.DateRangeISO(context, datedebut0, datefin0) dates = sco_abs.DateRangeISO(context, datedebut0, datefin0)
nbadded = 0 nbadded = 0
demijournee = int(demijournee)
for jour in dates: for jour in dates:
# Attention: supprime matin et après-midi # Attention: supprime matin et après-midi
if demijournee == "2": if demijournee == 2:
context._AnnuleJustif(etudid, jour, False, REQUEST=REQUEST) context._AnnuleJustif(etudid, jour, False, REQUEST=REQUEST)
context._AnnuleJustif(etudid, jour, True, REQUEST=REQUEST) context._AnnuleJustif(etudid, jour, True, REQUEST=REQUEST)
nbadded += 2 nbadded += 2
else: else:
matin = int(demijournee) context._AnnuleJustif(etudid, jour, demijournee, REQUEST=REQUEST)
context._AnnuleJustif(etudid, jour, matin, REQUEST=REQUEST)
nbadded += 1 nbadded += 1
# #
H = [ H = [
@ -720,7 +720,7 @@ def ListeAbsEtud(
): ):
"""Liste des absences d'un étudiant sur l'année en cours """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 '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). En format 'text': texte avec liste d'absences (pour mails).
""" """
absjust_only = int(absjust_only) # si vrai, table absjust seule (export xls ou pdf) 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( titles, columns_ids, absnonjust, absjust = context.Absences._TablesAbsEtud(
etudid, datedebut, with_evals=with_evals, format=format etudid, datedebut, with_evals=with_evals, format=format
) )
if REQUEST: if REQUEST:
base_url_nj = "%s?etudid=%s&amp;absjust_only=0" % (REQUEST.URL0, etudid) base_url_nj = "%s?etudid=%s&amp;absjust_only=0" % (REQUEST.URL0, etudid)
base_url_j = "%s?etudid=%s&amp;absjust_only=1" % (REQUEST.URL0, etudid) base_url_j = "%s?etudid=%s&amp;absjust_only=1" % (REQUEST.URL0, etudid)