diff --git a/app/scodoc/notes_table.py b/app/scodoc/notes_table.py index b620220d3c..528c2c85b5 100644 --- a/app/scodoc/notes_table.py +++ b/app/scodoc/notes_table.py @@ -1205,7 +1205,7 @@ class NotesTable: and moy_ue_cap >= self.parcours.NOTES_BARRE_VALID_UE ): if not cnx: - cnx = self.context.GetDBConnexion(autocommit=False) + cnx = ndb.GetDBConnexion(autocommit=False) sco_parcours_dut.do_formsemestre_validate_ue( cnx, nt_cap, diff --git a/app/scodoc/sco_abs.py b/app/scodoc/sco_abs.py index 520820f79b..7090f0766e 100644 --- a/app/scodoc/sco_abs.py +++ b/app/scodoc/sco_abs.py @@ -437,7 +437,7 @@ def GetAbsDescription(context, a, cursor=None): if a["moduleimpl_id"] and a["moduleimpl_id"] != "NULL": # Trouver le nom du module Mlist = sco_moduleimpl.do_moduleimpl_withmodule_list( - context.Notes, moduleimpl_id=a["moduleimpl_id"] + context, moduleimpl_id=a["moduleimpl_id"] ) if Mlist: M = Mlist[0] @@ -1055,8 +1055,8 @@ def invalidateAbsEtudDate(context, etudid, date): True # efface toujours le PDF car il affiche en général les absences ) - context.Notes._inval_cache( - pdfonly=pdfonly, formsemestre_id=sem["formsemestre_id"] + sco_core.inval_cache( + context, pdfonly=pdfonly, formsemestre_id=sem["formsemestre_id"] ) # Inval cache compteurs absences: diff --git a/app/scodoc/sco_abs_notification.py b/app/scodoc/sco_abs_notification.py index 1f49812180..272bbd4675 100644 --- a/app/scodoc/sco_abs_notification.py +++ b/app/scodoc/sco_abs_notification.py @@ -62,7 +62,7 @@ def abs_notify(context, etudid, date): debut_sem = ndb.DateDMYtoISO(sem["date_debut"]) fin_sem = ndb.DateDMYtoISO(sem["date_fin"]) nbabs = sco_abs.CountAbs(context, etudid, debut=debut_sem, fin=fin_sem) - nbabsjust = context.CountAbsJust(etudid, debut=debut_sem, fin=fin_sem) + nbabsjust = sco_abs.CountAbsJust(context, etudid, debut=debut_sem, fin=fin_sem) do_abs_notify(context, sem, etudid, date, nbabs, nbabsjust) diff --git a/app/scodoc/sco_abs_views.py b/app/scodoc/sco_abs_views.py index baa84096d0..e42aa9c067 100644 --- a/app/scodoc/sco_abs_views.py +++ b/app/scodoc/sco_abs_views.py @@ -737,7 +737,7 @@ def CalAbs(context, REQUEST=None): # etud implied datedebut = str(anneescolaire) + "-08-31" datefin = str(anneescolaire + 1) + "-07-31" nbabs = sco_abs.CountAbs(context, etudid=etudid, debut=datedebut, fin=datefin) - nbabsjust = context.CountAbsJust(etudid=etudid, debut=datedebut, fin=datefin) + nbabsjust = sco_abs.CountAbsJust(context, etudid=etudid, debut=datedebut, fin=datefin) events = [] for a in sco_abs.ListeAbsJust(context, etudid=etudid, datedebut=datedebut): events.append( diff --git a/app/scodoc/sco_formsemestre.py b/app/scodoc/sco_formsemestre.py index 92379bcc92..0c173b3d39 100644 --- a/app/scodoc/sco_formsemestre.py +++ b/app/scodoc/sco_formsemestre.py @@ -360,7 +360,7 @@ def _write_formsemestre_aux(context, sem, fieldname, valuename): # uniquify values = set([str(x) for x in sem[fieldname]]) - cnx = context.GetDBConnexion(autocommit=False) + cnx = ndb.GetDBConnexion(autocommit=False) cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor) tablename = "notes_formsemestre_" + fieldname try: diff --git a/app/scodoc/sco_formsemestre_validation.py b/app/scodoc/sco_formsemestre_validation.py index 9f54f2ca73..072c15b8bb 100644 --- a/app/scodoc/sco_formsemestre_validation.py +++ b/app/scodoc/sco_formsemestre_validation.py @@ -968,7 +968,7 @@ def formsemestre_fix_validation_ues(context, formsemestre_id, REQUEST=None): ) # > get_etudids, get_etud_decision_sem, get_ues, get_etud_decision_ues, get_etud_ue_status etudids = nt.get_etudids() modifs = [] # liste d'étudiants modifiés - cnx = context.GetDBConnexion(autocommit=False) + cnx = ndb.GetDBConnexion(autocommit=False) for etudid in etudids: etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0] Se = sco_parcours_dut.SituationEtudParcours(context, etud, formsemestre_id) @@ -1046,7 +1046,7 @@ def formsemestre_fix_validation_ues(context, formsemestre_id, REQUEST=None): def formsemestre_validation_suppress_etud(context, formsemestre_id, etudid): """Suppression des decisions de jury pour un etudiant.""" log("formsemestre_validation_suppress_etud( %s, %s)" % (formsemestre_id, etudid)) - cnx = context.GetDBConnexion(autocommit=False) + cnx = ndb.GetDBConnexion(autocommit=False) cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor) args = {"formsemestre_id": formsemestre_id, "etudid": etudid} try: @@ -1228,7 +1228,7 @@ def do_formsemestre_validate_previous_ue( cette UE (utile seulement pour les semestres extérieurs). """ sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) - cnx = context.GetDBConnexion(autocommit=False) + cnx = ndb.GetDBConnexion(autocommit=False) nt = sco_core.get_notes_cache(context).get_NotesTable( context, formsemestre_id ) # > get_etud_ue_status diff --git a/app/scodoc/sco_import_etuds.py b/app/scodoc/sco_import_etuds.py index ae1a52239f..448d679704 100644 --- a/app/scodoc/sco_import_etuds.py +++ b/app/scodoc/sco_import_etuds.py @@ -269,7 +269,7 @@ def scolars_import_excel_file( et les inscrit dans le semestre indiqué (et à TOUS ses modules) """ log("scolars_import_excel_file: formsemestre_id=%s" % formsemestre_id) - cnx = context.GetDBConnexion(autocommit=False) + cnx = ndb.GetDBConnexion(autocommit=False) cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor) annee_courante = time.localtime()[0] always_require_ine = sco_preferences.get_preference(context, "always_require_ine") @@ -495,6 +495,35 @@ def scolars_import_excel_file( return diag +def students_import_admission( + context, csvfile, type_admission="", REQUEST=None, formsemestre_id=None +): + "import donnees admission from Excel file (v2016)" + diag = scolars_import_admission( + csvfile, + context, + REQUEST, + formsemestre_id=formsemestre_id, + type_admission=type_admission, + ) + if REQUEST: + H = [ + html_sco_header.sco_header( + context, REQUEST, page_title="Import données admissions" + ) + ] + H.append("
Import terminé !
") + H.append( + '' + % "formsemestre_status?formsemestre_id=%s" + % formsemestre_id + ) + if diag: + H.append("Diagnostic: