From ca286288bc796bd1ab826a89a850e82c068b608d Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 27 Mar 2022 23:00:26 +0200 Subject: [PATCH] =?UTF-8?q?M=C3=A9nage:=20supprime=20ancien=20code=20entre?= =?UTF-8?q?prises?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_dept.py | 5 - app/scodoc/sco_entreprises.py | 324 --------- app/scodoc/sco_etud.py | 1 - app/static/css/scodoc.css | 102 --- app/views/entreprises.py | 1251 --------------------------------- app/views/scolar.py | 1 - misc/change_etudid.py | 1 - misc/createtables.sql | 683 ------------------ tools/anonymize_db.py | 21 - 9 files changed, 2389 deletions(-) delete mode 100644 app/scodoc/sco_entreprises.py delete mode 100644 app/views/entreprises.py delete mode 100644 misc/createtables.sql diff --git a/app/scodoc/sco_dept.py b/app/scodoc/sco_dept.py index c8dcc914..453aa2f6 100644 --- a/app/scodoc/sco_dept.py +++ b/app/scodoc/sco_dept.py @@ -293,7 +293,6 @@ def delete_dept(dept_id: int): "create temp table formsemestres_temp as select id from notes_formsemestre where dept_id = %(dept_id)s", "create temp table moduleimpls_temp as select id from notes_moduleimpl where formsemestre_id in (select id from formsemestres_temp)", "create temp table formations_temp as select id from notes_formations where dept_id = %(dept_id)s", - "create temp table entreprises_temp as select id from entreprises where dept_id = %(dept_id)s", "create temp table tags_temp as select id from notes_tags where dept_id = %(dept_id)s", ] for r in reqs: @@ -345,13 +344,9 @@ def delete_dept(dept_id: int): "delete from notes_formsemestre where dept_id = %(dept_id)s", "delete from scolar_news where dept_id = %(dept_id)s", "delete from notes_semset where dept_id = %(dept_id)s", - "delete from entreprise_contact where entreprise_id in (select id from entreprises_temp) ", - "delete from entreprise_correspondant where entreprise_id in (select id from entreprises_temp) ", - "delete from entreprises where dept_id = %(dept_id)s", "delete from notes_formations where dept_id = %(dept_id)s", "delete from departement where id = %(dept_id)s", "drop table tags_temp", - "drop table entreprises_temp", "drop table formations_temp", "drop table moduleimpls_temp", "drop table etudids_temp", diff --git a/app/scodoc/sco_entreprises.py b/app/scodoc/sco_entreprises.py deleted file mode 100644 index 6c9b887f..00000000 --- a/app/scodoc/sco_entreprises.py +++ /dev/null @@ -1,324 +0,0 @@ -# -*- mode: python -*- -# -*- coding: utf-8 -*- - -############################################################################## -# -# Gestion scolarite IUT -# -# Copyright (c) 1999 - 2022 Emmanuel Viennet. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Emmanuel Viennet emmanuel.viennet@viennet.net -# -############################################################################## - -"""Fonctions sur les entreprises -""" -# codes anciens déplacés de ZEntreprise -import datetime -from operator import itemgetter - -import app.scodoc.sco_utils as scu -import app.scodoc.notesdb as ndb -from app.scodoc.notesdb import ScoDocCursor, EditableTable, DateISOtoDMY, DateDMYtoISO - - -def _format_nom(nom): - "formatte nom (filtre en entree db) d'une entreprise" - if not nom: - return nom - return nom[0].upper() + nom[1:] - - -class EntreprisesEditor(EditableTable): - def delete(self, cnx, oid): - "delete correspondants and contacts, then self" - # first, delete all correspondants and contacts - cursor = cnx.cursor(cursor_factory=ScoDocCursor) - cursor.execute( - "delete from entreprise_contact where entreprise_id=%(entreprise_id)s", - {"entreprise_id": oid}, - ) - cursor.execute( - "delete from entreprise_correspondant where entreprise_id=%(entreprise_id)s", - {"entreprise_id": oid}, - ) - cnx.commit() - EditableTable.delete(self, cnx, oid) - - def list( - self, - cnx, - args={}, - operator="and", - test="=", - sortkey=None, - sort_on_contact=False, - limit="", - offset="", - ): - # list, then sort on date of last contact - R = EditableTable.list( - self, - cnx, - args=args, - operator=operator, - test=test, - sortkey=sortkey, - limit=limit, - offset=offset, - ) - if sort_on_contact: - for r in R: - c = do_entreprise_contact_list( - args={"entreprise_id": r["entreprise_id"]}, - disable_formatting=True, - ) - if c: - r["date"] = max([x["date"] or datetime.date.min for x in c]) - else: - r["date"] = datetime.date.min - # sort - R.sort(key=itemgetter("date")) - for r in R: - r["date"] = DateISOtoDMY(r["date"]) - return R - - def list_by_etud( - self, cnx, args={}, sort_on_contact=False, disable_formatting=False - ): - "cherche rentreprise ayant eu contact avec etudiant" - cursor = cnx.cursor(cursor_factory=ScoDocCursor) - cursor.execute( - "select E.*, I.nom as etud_nom, I.prenom as etud_prenom, C.date from entreprises E, entreprise_contact C, identite I where C.entreprise_id = E.entreprise_id and C.etudid = I.etudid and I.nom ~* %(etud_nom)s ORDER BY E.nom", - args, - ) - _, res = [x[0] for x in cursor.description], cursor.dictfetchall() - R = [] - for r in res: - r["etud_prenom"] = r["etud_prenom"] or "" - d = {} - for key in r: - v = r[key] - # format value - if not disable_formatting and key in self.output_formators: - v = self.output_formators[key](v) - d[key] = v - R.append(d) - # sort - if sort_on_contact: - R.sort(key=lambda x: (x["date"] or datetime.date.min)) - - for r in R: - r["date"] = DateISOtoDMY(r["date"] or datetime.date.min) - return R - - -_entreprisesEditor = EntreprisesEditor( - "entreprises", - "entreprise_id", - ( - "entreprise_id", - "nom", - "adresse", - "ville", - "codepostal", - "pays", - "contact_origine", - "secteur", - "privee", - "localisation", - "qualite_relation", - "plus10salaries", - "note", - "date_creation", - ), - filter_dept=True, - sortkey="nom", - input_formators={ - "nom": _format_nom, - "plus10salaries": bool, - }, -) - -# ----------- Correspondants -_entreprise_correspEditor = EditableTable( - "entreprise_correspondant", - "entreprise_corresp_id", - ( - "entreprise_corresp_id", - "entreprise_id", - "civilite", - "nom", - "prenom", - "fonction", - "phone1", - "phone2", - "mobile", - "fax", - "mail1", - "mail2", - "note", - ), - sortkey="nom", -) - - -# ----------- Contacts -_entreprise_contactEditor = EditableTable( - "entreprise_contact", - "entreprise_contact_id", - ( - "entreprise_contact_id", - "date", - "type_contact", - "entreprise_id", - "entreprise_corresp_id", - "etudid", - "description", - "enseignant", - ), - sortkey="date", - output_formators={"date": DateISOtoDMY}, - input_formators={"date": DateDMYtoISO}, -) - - -def do_entreprise_create(args): - "entreprise_create" - cnx = ndb.GetDBConnexion() - r = _entreprisesEditor.create(cnx, args) - return r - - -def do_entreprise_delete(oid): - "entreprise_delete" - cnx = ndb.GetDBConnexion() - _entreprisesEditor.delete(cnx, oid) - - -def do_entreprise_list(**kw): - "entreprise_list" - cnx = ndb.GetDBConnexion() - return _entreprisesEditor.list(cnx, **kw) - - -def do_entreprise_list_by_etud(**kw): - "entreprise_list_by_etud" - cnx = ndb.GetDBConnexion() - return _entreprisesEditor.list_by_etud(cnx, **kw) - - -def do_entreprise_edit(*args, **kw): - "entreprise_edit" - cnx = ndb.GetDBConnexion() - _entreprisesEditor.edit(cnx, *args, **kw) - - -def do_entreprise_correspondant_create(args): - "entreprise_correspondant_create" - cnx = ndb.GetDBConnexion() - r = _entreprise_correspEditor.create(cnx, args) - return r - - -def do_entreprise_correspondant_delete(oid): - "entreprise_correspondant_delete" - cnx = ndb.GetDBConnexion() - _entreprise_correspEditor.delete(cnx, oid) - - -def do_entreprise_correspondant_list(**kw): - "entreprise_correspondant_list" - cnx = ndb.GetDBConnexion() - return _entreprise_correspEditor.list(cnx, **kw) - - -def do_entreprise_correspondant_edit(*args, **kw): - "entreprise_correspondant_edit" - cnx = ndb.GetDBConnexion() - _entreprise_correspEditor.edit(cnx, *args, **kw) - - -def do_entreprise_correspondant_listnames(args={}): - "-> liste des noms des correspondants (pour affichage menu)" - C = do_entreprise_correspondant_list(args=args) - return [(x["prenom"] + " " + x["nom"], str(x["entreprise_corresp_id"])) for x in C] - - -def do_entreprise_contact_delete(oid): - "entreprise_contact_delete" - cnx = ndb.GetDBConnexion() - _entreprise_contactEditor.delete(cnx, oid) - - -def do_entreprise_contact_list(**kw): - "entreprise_contact_list" - cnx = ndb.GetDBConnexion() - return _entreprise_contactEditor.list(cnx, **kw) - - -def do_entreprise_contact_edit(*args, **kw): - "entreprise_contact_edit" - cnx = ndb.GetDBConnexion() - _entreprise_contactEditor.edit(cnx, *args, **kw) - - -def do_entreprise_contact_create(args): - "entreprise_contact_create" - cnx = ndb.GetDBConnexion() - r = _entreprise_contactEditor.create(cnx, args) - return r - - -def do_entreprise_check_etudiant(etudiant): - """Si etudiant est vide, ou un ETUDID valide, ou un nom unique, - retourne (1, ETUDID). - Sinon, retourne (0, 'message explicatif') - """ - etudiant = etudiant.strip().translate( - str.maketrans("", "", "'()") - ) # suppress parens and quote from name - if not etudiant: - return 1, None - cnx = ndb.GetDBConnexion() - cursor = cnx.cursor(cursor_factory=ScoDocCursor) - cursor.execute( - "select etudid, nom, prenom from identite where upper(nom) ~ upper(%(etudiant)s) or etudid=%(etudiant)s", - {"etudiant": etudiant}, - ) - r = cursor.fetchall() - if len(r) < 1: - return 0, 'Aucun etudiant ne correspond à "%s"' % etudiant - elif len(r) > 10: - return ( - 0, - "%d etudiants correspondent à ce nom (utilisez le code)" % len(r), - ) - elif len(r) > 1: - e = ['") - return ( - 0, - "Les étudiants suivants correspondent: préciser le nom complet ou le code\n" - + "\n".join(e), - ) - else: # une seule reponse ! - return 1, r[0][0].strip() \ No newline at end of file diff --git a/app/scodoc/sco_etud.py b/app/scodoc/sco_etud.py index 48c6b82b..710f85bc 100644 --- a/app/scodoc/sco_etud.py +++ b/app/scodoc/sco_etud.py @@ -449,7 +449,6 @@ _adresseEditor = ndb.EditableTable( "telephonemobile", "fax", "typeadresse", - "entreprise_id", "description", ), convert_null_outputs_to_empty=True, diff --git a/app/static/css/scodoc.css b/app/static/css/scodoc.css index 1250b2e1..b345bf42 100644 --- a/app/static/css/scodoc.css +++ b/app/static/css/scodoc.css @@ -2362,29 +2362,6 @@ td.fvs_tit_chk { font-weight: bold; } -/* ----- Entreprises ------- */ - -table.entreprise_list, table.corr_list, table.contact_list { - width : 100%; - border-width: 0px; - /* border-style: solid; */ - border-spacing: 0px 0px; - padding: 0px; - margin-left: 0px; -} - -table.entreprise_list td.nbcorr a, table.entreprise_list td.nbcontact a, table.contact_list td.etudnom a, table.contact_list td a { - color: navy; - text-decoration: underline; -} - -tr.entreprise_list_even, tr.corr_list_even, tr.contact_list_even { - background-color: rgb(85%,85%,95%); -} -tr.entreprise_list_odd, tr.corr_list_odd, tr.contact_list_odd { - background-color: rgb(90%,90%, 90%); -} - span.table_nav_mid { flex-grow: 1; /* Set the middle element to grow and stretch */ } @@ -2398,82 +2375,6 @@ div.table_nav { justify-content: space-between; } -td.entreprise_descr, td.corr_descr, td.contact_descr { - padding-left: 2em; -} -td.entreprise_descr_link { - padding-left: 2em; - white-space: nowrap; -} -td.entreprise_descr_name { white-space: nowrap; } - -a.entreprise_delete { color: black; text-decoration: underline; } -a.entreprise_delete:visited { color: black; } - -a.entreprise_edit { - text-decoration: underline; - color : rgb(0,0,204); - font-weight: normal; -} -a.entreprise_edit:visited { color : rgb(0,0,204); } -a.entreprise_edit:hover { - color: rgb(153,51,51); - text-decoration: underline; -} - -p.entreprise_create { padding-top: 2em; } -a.entreprise_create { color : black; font-weight: bold; } -a.entreprise_create:visited { color : black; } - -table.entreprise_list_title { - width: 100%; - border-top: 1px solid rgb(51,102,204); - border-spacing: 0px 0px; - padding: 0px; -} -tr.entreprise_list_title { - background-color: rgb(229,236,249); - font-weight: bold; -} -td.entreprise_list_title { - padding-left: 1em; -} -td.entreprise_list_title_res { - font-weight: normal; - text-align : right; -} - -h2.entreprise { - color: rgb(6,102,18); - border: 1px solid blue; -} - -h2.entreprise_contact:before { - content: url(/ScoDoc/static/icons/contact_img.png); - vertical-align: -80%; - padding-right: 1em; -} -h2.entreprise_correspondant:before { - content: url(/ScoDoc/static/icons/correspondant_img.png); - vertical-align: -80%; - padding-right: 1em; -} - -h2.entreprise_new:before { - content: url(/ScoDoc/static/icons/entreprise_img.png); - vertical-align: -80%; - padding-right: 2em; -} - -p.entreprise_warning, p.gtr_warning, p.gtr_interdit, p.gtr_devel { - color: red; - font-style: italic; - margin-top: -1em; -} -P.entreprise_warning:before { - content: url(/ScoDoc/static/icons/warning_img.png); - vertical-align: -80%; -} P.gtr_interdit:before { content: url(/ScoDoc/static/icons/interdit_img.png); vertical-align: -80%; @@ -2482,9 +2383,6 @@ P.gtr_devel:before { content: url(/ScoDoc/static/icons/devel_img.png); vertical-align: -80%; } -div.entreprise-insidebar { - border: 1px solid blue; -} /* ---- Sortable tables --- */ /* Sortable tables */ diff --git a/app/views/entreprises.py b/app/views/entreprises.py deleted file mode 100644 index 8b09e05d..00000000 --- a/app/views/entreprises.py +++ /dev/null @@ -1,1251 +0,0 @@ -# -*- mode: python -*- -# -*- coding: utf-8 -*- - -############################################################################## -# -# Gestion scolarite IUT -# -# Copyright (c) 1999 - 2022 Emmanuel Viennet. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Emmanuel Viennet emmanuel.viennet@viennet.net -# -############################################################################## - -""" Gestion des relations avec les entreprises - -Note: Code très ancien, porté de Zope/DTML, peu utilisable - -=> Voir si des départements utilisent encore ce module et envisager de le supprimer. - -""" - - -import time -import urllib - -from flask import request -from flask_login import current_user - -from app.scodoc import sco_utils as scu - -# MIGRATION EN COURS => MODULE DESACTIVE ! - -# A REVOIR -# from sco_permissions import ScoEntrepriseView, ScoEntrepriseChange -# from app import log -# from scolog import logdb -# from sco_utils import SCO_ENCODING -# import app.scodoc.sco_utils as scu -# import html_sidebar -# from app.scodoc.gen_tables import GenTable -# from app.scodoc.TrivialFormulator import TrivialFormulator, TF -# import sco_etud -# import sco_entreprises - - -def entreprise_header(page_title=""): - "common header for all Entreprises pages" - return html_sco_header.sco_header(page_title=page_title) - - -def entreprise_footer(): - "common entreprise footer" - return html_sco_header.sco_footer() - - -security.declareProtected(ScoEntrepriseView, "sidebar") - - -def sidebar(): - "barre gauche (overide std sco sidebar)" - # rewritten from legacy DTML code - # XXX rare cas restant d'utilisation de l'acquisition Zope2: à revoir - params = {"ScoURL": scu.ScoURL()} - H = [ - """ """) - return "".join(H) - - -# -------------------------------------------------------------------- -# -# Entreprises : Vues -# -# -------------------------------------------------------------------- -security.declareProtected(ScoEntrepriseView, "index_html") - - -def index_html(etud_nom=None, limit=50, offset="", format="html"): - """Accueil module entreprises""" - # Traduit du DTML - utilise table standard - if limit: - limit = int(limit) - if offset: - offset = int(offset or 0) - vals = scu.get_request_args() - if etud_nom: - entreprises = sco_entreprises.do_entreprise_list_by_etud( - args=vals, sort_on_contact=True - ) - table_navigation = "" - else: - entreprises = sco_entreprises.do_entreprise_list( - args=vals, - test="~*", - sort_on_contact=True, - limit=limit, - offset=offset, - ) - # Liens navigation précédent/suivant - webparams = {"limit": limit} - if offset: - webparams["offset"] = max((offset or 0) - limit, 0) - prev_lnk = 'précédentes' % ( - request.base_url + "?" + urllib.parse.urlencode(webparams) - ) - else: - prev_lnk = "" - if len(entreprises) >= limit: - webparams["offset"] = (offset or 0) + limit - next_lnk = 'suivantes' % ( - request.base_url + "?" + urllib.parse.urlencode(webparams) - ) - else: - next_lnk = "" - table_navigation = ( - '
' - + prev_lnk - + '' - + next_lnk - + "
" - ) - # Ajout des liens sur la table: - for e in entreprises: - e["_nom_target"] = "entreprise_edit?entreprise_id=%(entreprise_id)s" % e - e["correspondants"] = sco_entreprises.do_entreprise_correspondant_list( - args={"entreprise_id": e["entreprise_id"]} - ) - e["nbcorr"] = "%d corr." % len(e["correspondants"]) - e["_nbcorr_target"] = ( - "entreprise_correspondant_list?entreprise_id=%(entreprise_id)s" % e - ) - e["contacts"] = sco_entreprises.do_entreprise_contact_list( - args={"entreprise_id": e["entreprise_id"]} - ) - e["nbcontact"] = "%d contacts." % len(e["contacts"]) - e["_nbcontact_target"] = ( - "entreprise_contact_list?entreprise_id=%(entreprise_id)s" % e - ) - tab = GenTable( - rows=entreprises, - columns_ids=("nom", "ville", "secteur", "nbcorr", "nbcontact"), - titles={ - "nom": "Entreprise", - "ville": "Ville", - "secteur": "Secteur", - "nbcorr": "Corresp.", - "contacts": "Contacts", - }, - origin="Généré par %s le " % sco_version.SCONAME + scu.timedate_human_repr(), - filename=scu.make_filename( - "entreprises_%s" % context.get_preference("DeptName") - ), - caption="Entreprises du département %s" % context.get_preference("DeptName"), - html_sortable=True, - html_class="entreprise_list table_leftalign", - html_with_td_classes=True, - html_next_section=table_navigation, - base_url=request.base_url + "?", - preferences=context.get_preferences(), - ) - if format != "html": - return tab.make_page(format=format) - else: - H = [ - entreprise_header(page_title="Suivi entreprises"), - """

Suivi relations entreprises

""", - """
""", - tab.html(), - """
""", - entreprise_footer(), - ] - return "\n".join(H) - - -security.declareProtected(ScoEntrepriseView, "entreprise_contact_list") - - -def entreprise_contact_list(entreprise_id=None, format="html"): - """Liste des contacts de l'entreprise""" - H = [entreprise_header(page_title="Suivi entreprises")] - if entreprise_id: - E = sco_entreprises.do_entreprise_list(args={"entreprise_id": entreprise_id})[0] - C = sco_entreprises.do_entreprise_contact_list( - args={"entreprise_id": entreprise_id} - ) - H.append( - """

Listes des contacts avec l'entreprise %(nom)s

- """ - % E - ) - else: - C = sco_entreprises.do_entreprise_contact_list(args={}) - H.append( - """

Listes des contacts

- """ - ) - for c in C: - c["_date_target"] = "%s/entreprise_contact_edit?entreprise_contact_id=%s" % ( - scu.EntreprisesURL(), - c["entreprise_contact_id"], - ) - c["entreprise"] = sco_entreprises.do_entreprise_list( - args={"entreprise_id": c["entreprise_id"]} - )[0] - if c["etudid"]: - c["etud"] = context.getEtudInfo(etudid=c["etudid"], filled=1)[0] - c["etudnom"] = c["etud"]["nomprenom"] - c["_etudnom_target"] = "%s/ficheEtud?etudid=%s" % ( - scu.ScoURL(), - c["etudid"], - ) - else: - c["etud"] = None - c["etudnom"] = "" - - tab = GenTable( - rows=C, - columns_ids=("date", "type_contact", "etudnom", "description"), - titles={ - "date": "Date", - "type_contact": "Object", - "etudnom": "Étudiant", - "description": "Description", - }, - origin="Généré par %s le " % sco_version.SCONAME + scu.timedate_human_repr(), - filename=scu.make_filename("contacts_%s" % context.get_preference("DeptName")), - caption="", - html_sortable=True, - html_class="contact_list table_leftalign", - html_with_td_classes=True, - base_url=request.base_url + "?", - preferences=context.get_preferences(), - ) - if format != "html": - return tab.make_page(format=format) - - H.append(tab.html()) - - if current_user.has_permission(Permission.ScoEntrepriseChange): - if entreprise_id: - H.append( - """

nouveau "contact"

- """ - % E - ) - - H.append(entreprise_footer()) - return "\n".join(H) - - -security.declareProtected(ScoEntrepriseView, "entreprise_correspondant_list") - - -def entreprise_correspondant_list( - entreprise_id=None, - format="html", -): - """Liste des correspondants de l'entreprise""" - E = sco_entreprises.do_entreprise_list(args={"entreprise_id": entreprise_id})[0] - H = [ - entreprise_header(page_title="Suivi entreprises"), - """ -

Listes des correspondants dans l'entreprise %(nom)s

- """ - % E, - ] - correspondants = sco_entreprises.do_entreprise_correspondant_list( - args={"entreprise_id": entreprise_id} - ) - for c in correspondants: - c["nomprenom"] = c["nom"].upper() + " " + c["nom"].capitalize() - c[ - "_nomprenom_target" - ] = "%s/entreprise_correspondant_edit?entreprise_corresp_id=%s" % ( - scu.EntreprisesURL(), - c["entreprise_corresp_id"], - ) - - c["nom_entreprise"] = E["nom"] - l = [] - if c["phone1"]: - l.append(c["phone1"]) - if c["phone2"]: - l.append(c["phone2"]) - if c["mobile"]: - l.append(c["mobile"]) - c["telephones"] = " / ".join(l) - c["mails"] = " ".join( - [ - '%s' % (c["mail1"], c["mail1"]) - if c["mail1"] - else "", - '%s' % (c["mail2"], c["mail2"]) - if c["mail2"] - else "", - ] - ) - c["modifier"] = ( - 'modifier' - % c["entreprise_corresp_id"] - ) - c["supprimer"] = ( - 'supprimer' - % c["entreprise_corresp_id"] - ) - tab = GenTable( - rows=correspondants, - columns_ids=( - "nomprenom", - "nom_entreprise", - "fonction", - "telephones", - "mails", - "note", - "modifier", - "supprimer", - ), - titles={ - "nomprenom": "Nom", - "nom_entreprise": "Entreprise", - "fonction": "Fonction", - "telephones": "Téléphone", - "mails": "Mail", - "note": "Note", - "modifier": "", - "supprimer": "", - }, - origin="Généré par %s le " % sco_version.SCONAME + scu.timedate_human_repr(), - filename=scu.make_filename( - "correspondants_%s_%s" % (E["nom"], context.get_preference("DeptName")) - ), - caption="", - html_sortable=True, - html_class="contact_list table_leftalign", - html_with_td_classes=True, - base_url=request.base_url + "?", - preferences=context.get_preferences(), - ) - if format != "html": - return tab.make_page(format=format) - - H.append(tab.html()) - - if current_user.has_permission(Permission.ScoEntrepriseChange): - H.append( - """

Ajouter un correspondant dans l'entreprise %(nom)s

- """ - % E - ) - - H.append(entreprise_footer()) - return "\n".join(H) - - -security.declareProtected(ScoEntrepriseView, "entreprise_contact_edit") - - -def entreprise_contact_edit(entreprise_contact_id): - """Form edit contact""" - c = sco_entreprises.do_entreprise_contact_list( - args={"entreprise_contact_id": entreprise_contact_id} - )[0] - link_create_corr = ( - 'créer un nouveau correspondant' - % (scu.EntreprisesURL(), c["entreprise_id"]) - ) - E = sco_entreprises.do_entreprise_list(args={"entreprise_id": c["entreprise_id"]})[ - 0 - ] - correspondants = sco_entreprises.do_entreprise_correspondant_listnames( - args={"entreprise_id": c["entreprise_id"]} - ) + [("inconnu", "")] - - H = [ - entreprise_header(page_title="Suivi entreprises"), - """

Suivi entreprises

-

Contact avec entreprise %(nom)s

""" - % E, - ] - tf = TrivialFormulator( - request.base_url, - scu.get_request_args(), - ( - ( - "entreprise_contact_id", - {"default": entreprise_contact_id, "input_type": "hidden"}, - ), - ( - "entreprise_id", - {"input_type": "hidden", "default": c["entreprise_id"]}, - ), - ( - "type_contact", - { - "input_type": "menu", - "title": "Objet", - "allowed_values": ( - "Prospection", - "Stage étudiant", - "Contrat Apprentissage", - "Projet", - "Autre", - ), - }, - ), - ( - "date", - { - "size": 12, - "title": "Date du contact (j/m/a)", - "allow_null": False, - }, - ), - ( - "entreprise_corresp_id", - { - "input_type": "menu", - "title": "Correspondant entreprise", - "explanation": link_create_corr, - "allow_null": True, - "labels": [x[0] for x in correspondants], - "allowed_values": [x[1] for x in correspondants], - }, - ), - ( - "etudiant", - { - "size": 16, - "title": "Etudiant concerné", - "allow_null": True, - "default": c["etudid"], - "explanation": "nom (si pas ambigu) ou code", - }, - ), - ( - "enseignant", - {"size": 16, "title": "Enseignant (tuteur)", "allow_null": True}, - ), - ( - "description", - { - "input_type": "textarea", - "rows": 3, - "cols": 40, - "title": "Description", - }, - ), - ), - cancelbutton="Annuler", - initvalues=c, - submitlabel="Modifier les valeurs", - readonly=not current_user.has_permission(Permission.ScoEntrepriseChange), - ) - - if tf[0] == 0: - H.append(tf[1]) - if current_user.has_permission( - Permission.ScoEntrepriseChange, - ): - H.append( - """

Supprimer ce contact

""" - % entreprise_contact_id - ) - elif tf[0] == -1: - return flask.redirect(scu.EntreprisesURL(context)) - else: - etudok = sco_entreprises.do_entreprise_check_etudiant(tf[2]["etudiant"]) - if etudok[0] == 0: - H.append("""

%s

""" % etudok[1]) - else: - tf[2].update({"etudid": etudok[1]}) - sco_entreprises.do_entreprise_contact_edit(tf[2]) - return flask.redirect( - scu.EntreprisesURL() - + "/entreprise_contact_list?entreprise_id=" - + str(c["entreprise_id"]) - ) - H.append(entreprise_footer()) - return "\n".join(H) - - -security.declareProtected(ScoEntrepriseView, "entreprise_correspondant_edit") - - -def entreprise_correspondant_edit(entreprise_corresp_id): - """Form édition d'un correspondant""" - c = sco_entreprises.do_entreprise_correspondant_list( - args={"entreprise_corresp_id": entreprise_corresp_id} - )[0] - H = [ - entreprise_header(page_title="Suivi entreprises"), - """

Édition contact entreprise

""", - ] - tf = TrivialFormulator( - request.base_url, - scu.get_request_args(), - ( - ( - "entreprise_corresp_id", - {"default": entreprise_corresp_id, "input_type": "hidden"}, - ), - ( - "civilite", - { - "input_type": "menu", - "labels": ["M.", "Mme"], - "allowed_values": ["M.", "Mme"], - }, - ), - ("nom", {"size": 25, "title": "Nom", "allow_null": False}), - ("prenom", {"size": 25, "title": "Prénom"}), - ( - "fonction", - { - "input_type": "menu", - "allowed_values": ( - "Directeur", - "RH", - "Resp. Administratif", - "Tuteur", - "Autre", - ), - "explanation": "fonction via à vis de l'IUT", - }, - ), - ( - "phone1", - { - "size": 14, - "title": "Téléphone 1", - }, - ), - ( - "phone2", - { - "size": 14, - "title": "Téléphone 2", - }, - ), - ( - "mobile", - { - "size": 14, - "title": "Tél. mobile", - }, - ), - ( - "fax", - { - "size": 14, - "title": "Fax", - }, - ), - ( - "mail1", - { - "size": 25, - "title": "e-mail", - }, - ), - ( - "mail2", - { - "size": 25, - "title": "e-mail 2", - }, - ), - ( - "note", - {"input_type": "textarea", "rows": 3, "cols": 40, "title": "Note"}, - ), - ), - cancelbutton="Annuler", - initvalues=c, - submitlabel="Modifier les valeurs", - readonly=not current_user.has_permission(Permission.ScoEntrepriseChange), - ) - if tf[0] == 0: - H.append(tf[1]) - elif tf[0] == -1: - return flask.redirect( - "%s/entreprise_correspondant_list?entreprise_id=%s" - % (scu.EntreprisesURL(), c["entreprise_id"]) - ) - else: - sco_entreprises.do_entreprise_correspondant_edit(tf[2]) - return flask.redirect( - "%s/entreprise_correspondant_list?entreprise_id=%s" - % (scu.EntreprisesURL(), c["entreprise_id"]) - ) - H.append(entreprise_footer()) - return "\n".join(H) - - -security.declareProtected(ScoEntrepriseChange, "entreprise_contact_create") - - -def entreprise_contact_create(entreprise_id): - """Form création contact""" - E = sco_entreprises.do_entreprise_list(args={"entreprise_id": entreprise_id})[0] - correspondants = sco_entreprises.do_entreprise_correspondant_listnames( - args={"entreprise_id": entreprise_id} - ) - if not correspondants: - correspondants = [("inconnu", "")] - curtime = time.strftime("%d/%m/%Y") - link_create_corr = ( - 'créer un nouveau correspondant' - % (scu.EntreprisesURL(), entreprise_id) - ) - H = [ - entreprise_header(page_title="Suivi entreprises"), - """

Nouveau "contact" avec l'entreprise %(nom)s

""" - % E, - ] - tf = TrivialFormulator( - request.base_url, - scu.get_request_args(), - ( - ("entreprise_id", {"input_type": "hidden", "default": entreprise_id}), - ( - "type_contact", - { - "input_type": "menu", - "title": "Objet", - "allowed_values": ( - "Prospection", - "Stage étudiant", - "Contrat Apprentissage DUT GTR1", - "Contrat Apprentissage DUT GTR2", - "Contrat Apprentissage Licence SQRT", - "Projet", - "Autre", - ), - "default": "Stage étudiant", - }, - ), - ( - "date", - { - "size": 12, - "title": "Date du contact (j/m/a)", - "allow_null": False, - "default": curtime, - }, - ), - ( - "entreprise_corresp_id", - { - "input_type": "menu", - "title": "Correspondant entreprise", - "explanation": link_create_corr, - "allow_null": True, - "labels": [x[0] for x in correspondants], - "allowed_values": [x[1] for x in correspondants], - }, - ), - ( - "etudiant", - { - "size": 16, - "title": "Etudiant concerné", - "allow_null": True, - "explanation": "nom (si pas ambigu) ou code", - }, - ), - ( - "enseignant", - {"size": 16, "title": "Enseignant (tuteur)", "allow_null": True}, - ), - ( - "description", - { - "input_type": "textarea", - "rows": 3, - "cols": 40, - "title": "Description", - }, - ), - ), - cancelbutton="Annuler", - submitlabel="Ajouter ce contact", - readonly=not current_user.has_permission(Permission.ScoEntrepriseChange), - ) - if tf[0] == 0: - H.append(tf[1]) - elif tf[0] == -1: - return flask.redirect(scu.EntreprisesURL(context)) - else: - etudok = sco_entreprises.do_entreprise_check_etudiant(tf[2]["etudiant"]) - if etudok[0] == 0: - H.append("""

%s

""" % etudok[1]) - else: - tf[2].update({"etudid": etudok[1]}) - sco_entreprises.do_entreprise_contact_create(tf[2]) - return flask.redirect(scu.EntreprisesURL()) - H.append(entreprise_footer()) - return "\n".join(H) - - -security.declareProtected(ScoEntrepriseChange, "entreprise_contact_delete") - - -def entreprise_contact_delete(entreprise_contact_id): - """Form delete contact""" - c = sco_entreprises.do_entreprise_contact_list( - args={"entreprise_contact_id": entreprise_contact_id} - )[0] - H = [ - entreprise_header(page_title="Suivi entreprises"), - """

Suppression du contact

""", - ] - tf = TrivialFormulator( - request.base_url, - scu.get_request_args(), - (("entreprise_contact_id", {"input_type": "hidden"}),), - initvalues=c, - submitlabel="Confirmer la suppression", - cancelbutton="Annuler", - readonly=not current_user.has_permission(ScoEntrepriseChange), - ) - if tf[0] == 0: - H.append(tf[1]) - elif tf[0] == -1: - return flask.redirect(scu.EntreprisesURL(context)) - else: - sco_entreprises.do_entreprise_contact_delete(c["entreprise_contact_id"]) - return flask.redirect(scu.EntreprisesURL(context)) - H.append(entreprise_footer()) - return "\n".join(H) - - -security.declareProtected(ScoEntrepriseChange, "entreprise_correspondant_create") - - -def entreprise_correspondant_create(entreprise_id): - """Form création correspondant""" - E = sco_entreprises.do_entreprise_list(args={"entreprise_id": entreprise_id})[0] - H = [ - entreprise_header(page_title="Suivi entreprises"), - """

Nouveau correspondant l'entreprise %(nom)s

""" - % E, - ] - tf = TrivialFormulator( - request.base_url, - scu.get_request_args(), - ( - ("entreprise_id", {"input_type": "hidden", "default": entreprise_id}), - ( - "civilite", - { - "input_type": "menu", - "labels": ["M.", "Mme"], - "allowed_values": ["M.", "Mme"], - }, - ), - ("nom", {"size": 25, "title": "Nom", "allow_null": False}), - ("prenom", {"size": 25, "title": "Prénom"}), - ( - "fonction", - { - "input_type": "menu", - "allowed_values": ( - "Directeur", - "RH", - "Resp. Administratif", - "Tuteur", - "Autre", - ), - "default": "Tuteur", - "explanation": "fonction via à vis de l'IUT", - }, - ), - ( - "phone1", - { - "size": 14, - "title": "Téléphone 1", - }, - ), - ( - "phone2", - { - "size": 14, - "title": "Téléphone 2", - }, - ), - ( - "mobile", - { - "size": 14, - "title": "Tél. mobile", - }, - ), - ( - "fax", - { - "size": 14, - "title": "Fax", - }, - ), - ( - "mail1", - { - "size": 25, - "title": "e-mail", - }, - ), - ( - "mail2", - { - "size": 25, - "title": "e-mail 2", - }, - ), - ( - "note", - {"input_type": "textarea", "rows": 3, "cols": 40, "title": "Note"}, - ), - ), - cancelbutton="Annuler", - submitlabel="Ajouter ce correspondant", - readonly=not current_user.has_permission(Permission.ScoEntrepriseChange), - ) - if tf[0] == 0: - H.append(tf[1]) - elif tf[0] == -1: - return flask.redirect(scu.EntreprisesURL(context)) - else: - sco_entreprises.do_entreprise_correspondant_create(tf[2]) - return flask.redirect(scu.EntreprisesURL(context)) - H.append(entreprise_footer()) - return "\n".join(H) - - -security.declareProtected(ScoEntrepriseChange, "entreprise_correspondant_delete") - - -def entreprise_correspondant_delete(entreprise_corresp_id): - """Form delete correspondant""" - c = sco_entreprises.do_entreprise_correspondant_list( - args={"entreprise_corresp_id": entreprise_corresp_id} - )[0] - H = [ - entreprise_header(page_title="Suivi entreprises"), - """

Suppression du correspondant %(nom)s %(prenom)s

""" % c, - ] - tf = TrivialFormulator( - request.base_url, - scu.get_request_args(), - (("entreprise_corresp_id", {"input_type": "hidden"}),), - initvalues=c, - submitlabel="Confirmer la suppression", - cancelbutton="Annuler", - readonly=not current_user.has_permission(Permission.ScoEntrepriseChange), - ) - if tf[0] == 0: - H.append(tf[1]) - elif tf[0] == -1: - return flask.redirect(scu.EntreprisesURL()) - else: - sco_entreprises.do_entreprise_correspondant_delete(c["entreprise_corresp_id"]) - return flask.redirect(scu.EntreprisesURL()) - H.append(entreprise_footer()) - return "\n".join(H) - - -security.declareProtected(ScoEntrepriseChange, "entreprise_delete") - - -def entreprise_delete(entreprise_id): - """Form delete entreprise""" - E = sco_entreprises.do_entreprise_list(args={"entreprise_id": entreprise_id})[0] - H = [ - entreprise_header(page_title="Suivi entreprises"), - """

Suppression de l'entreprise %(nom)s

-

Attention: supression définitive de l'entreprise, de ses correspondants et contacts. -

""" - % E, - ] - Cl = sco_entreprises.do_entreprise_correspondant_list( - args={"entreprise_id": entreprise_id} - ) - if Cl: - H.append( - """

Correspondants dans l'entreprise qui seront supprimés:

""") - - Cts = sco_entreprises.do_entreprise_contact_list( - args={"entreprise_id": entreprise_id} - ) - if Cts: - H.append( - """

Contacts avec l'entreprise qui seront supprimés:

""") - tf = TrivialFormulator( - request.base_url, - scu.get_request_args(), - (("entreprise_id", {"input_type": "hidden"}),), - initvalues=E, - submitlabel="Confirmer la suppression", - cancelbutton="Annuler", - readonly=not current_user.has_permission(Permission.ScoEntrepriseChange), - ) - if tf[0] == 0: - H.append(tf[1]) - elif tf[0] == -1: - return flask.redirect(scu.EntreprisesURL()) - else: - sco_entreprises.do_entreprise_delete(E["entreprise_id"]) - return flask.redirect(scu.EntreprisesURL()) - H.append(entreprise_footer()) - return "\n".join(H) - - -# -------- Formulaires: traductions du DTML -security.declareProtected(ScoEntrepriseChange, "entreprise_create") - - -def entreprise_create(): - """Form. création entreprise""" - H = [ - entreprise_header(page_title="Création d'une entreprise"), - """

Création d'une entreprise

""", - ] - tf = TrivialFormulator( - request.base_url, - scu.get_request_args(), - ( - ("nom", {"size": 25, "title": "Nom de l'entreprise"}), - ( - "adresse", - {"size": 30, "title": "Adresse", "explanation": "(numéro, rue)"}, - ), - ("codepostal", {"size": 8, "title": "Code Postal"}), - ("ville", {"size": 30, "title": "Ville"}), - ("pays", {"size": 30, "title": "Pays", "default": "France"}), - ( - "localisation", - { - "input_type": "menu", - "labels": ["Ile de France", "Province", "Etranger"], - "allowed_values": ["IDF", "Province", "Etranger"], - }, - ), - ("secteur", {"size": 30, "title": "Secteur d'activités"}), - ( - "privee", - { - "input_type": "menu", - "title": "Statut", - "labels": [ - "Entreprise privee", - "Entreprise Publique", - "Association", - ], - "allowed_values": ["privee", "publique", "association"], - }, - ), - ( - "plus10salaries", - { - "title": "Masse salariale", - "type": "integer", - "input_type": "menu", - "labels": [ - "10 salariés ou plus", - "Moins de 10 salariés", - "Inconnue", - ], - "allowed_values": [1, 0, -1], - }, - ), - ( - "qualite_relation", - { - "title": "Qualité relation IUT/Entreprise", - "input_type": "menu", - "default": "-1", - "labels": [ - "Très bonne", - "Bonne", - "Moyenne", - "Mauvaise", - "Inconnue", - ], - "allowed_values": ["100", "75", "50", "25", "-1"], - }, - ), - ("contact_origine", {"size": 30, "title": "Origine du contact"}), - ( - "note", - {"input_type": "textarea", "rows": 3, "cols": 40, "title": "Note"}, - ), - ), - cancelbutton="Annuler", - submitlabel="Ajouter cette entreprise", - readonly=not current_user.has_permission(Permission.ScoEntrepriseChange), - ) - if tf[0] == 0: - return "\n".join(H) + tf[1] + entreprise_footer() - elif tf[0] == -1: - return flask.redirect(scu.EntreprisesURL()) - else: - sco_entreprises.do_entreprise_create(tf[2]) - return flask.redirect(scu.EntreprisesURL()) - - -security.declareProtected(ScoEntrepriseView, "entreprise_edit") - - -def entreprise_edit(entreprise_id, start=1): - """Form. edit entreprise""" - authuser = current_user - readonly = not authuser.has_permission(Permission.ScoEntrepriseChange) - F = sco_entreprises.do_entreprise_list(args={"entreprise_id": entreprise_id})[0] - H = [ - entreprise_header(page_title="Entreprise"), - """

%(nom)s

""" % F, - ] - tf = TrivialFormulator( - request.base_url, - scu.get_request_args(), - ( - ("entreprise_id", {"default": entreprise_id, "input_type": "hidden"}), - ("start", {"default": 1, "input_type": "hidden"}), - ( - "date_creation", - {"default": time.strftime("%Y-%m-%d"), "input_type": "hidden"}, - ), - ("nom", {"size": 25, "title": "Nom de l'entreprise"}), - ( - "adresse", - {"size": 30, "title": "Adresse", "explanation": "(numéro, rue)"}, - ), - ("codepostal", {"size": 8, "title": "Code Postal"}), - ("ville", {"size": 30, "title": "Ville"}), - ("pays", {"size": 30, "title": "Pays", "default": "France"}), - ( - "localisation", - { - "input_type": "menu", - "labels": ["Ile de France", "Province", "Etranger"], - "allowed_values": ["IDF", "Province", "Etranger"], - }, - ), - ("secteur", {"size": 30, "title": "Secteur d'activités"}), - ( - "privee", - { - "input_type": "menu", - "title": "Statut", - "labels": [ - "Entreprise privee", - "Entreprise Publique", - "Association", - ], - "allowed_values": ["privee", "publique", "association"], - }, - ), - ( - "plus10salaries", - { - "title": "Masse salariale", - "input_type": "menu", - "labels": [ - "10 salariés ou plus", - "Moins de 10 salariés", - "Inconnue", - ], - "allowed_values": ["1", "0", "-1"], - }, - ), - ( - "qualite_relation", - { - "title": "Qualité relation IUT/Entreprise", - "input_type": "menu", - "labels": [ - "Très bonne", - "Bonne", - "Moyenne", - "Mauvaise", - "Inconnue", - ], - "allowed_values": ["100", "75", "50", "25", "-1"], - }, - ), - ("contact_origine", {"size": 30, "title": "Origine du contact"}), - ( - "note", - {"input_type": "textarea", "rows": 3, "cols": 40, "title": "Note"}, - ), - ), - cancelbutton="Annuler", - initvalues=F, - submitlabel="Modifier les valeurs", - readonly=readonly, - ) - - if tf[0] == 0: - H.append(tf[1]) - Cl = sco_entreprises.do_entreprise_correspondant_list( - args={"entreprise_id": F["entreprise_id"]} - ) - Cts = sco_entreprises.do_entreprise_contact_list( - args={"entreprise_id": F["entreprise_id"]} - ) - if not readonly: - H.append( - """

%s Supprimer cette entreprise

""" - % ( - scu.icontag("delete_img", title="delete", border="0"), - F["entreprise_id"], - ) - ) - if len(Cl): - H.append( - """

%d correspondants dans l'entreprise %s (liste complète) :

-") - if len(Cts): - H.append( - """

%d contacts avec l'entreprise %s (liste complète) :

") - return "\n".join(H) + entreprise_footer() - elif tf[0] == -1: - return flask.redirect(scu.EntreprisesURL() + "?start=" + str(start)) - else: - sco_entreprises.do_entreprise_edit(tf[2]) - return flask.redirect(scu.EntreprisesURL() + "?start=" + str(start)) diff --git a/app/views/scolar.py b/app/views/scolar.py index a25994bd..1b88575e 100644 --- a/app/views/scolar.py +++ b/app/views/scolar.py @@ -1665,7 +1665,6 @@ def etudident_delete(etudid, dialog_confirmed=False): "notes_moduleimpl_inscription", "notes_formsemestre_inscription", "group_membership", - "entreprise_contact", "etud_annotations", "scolog", "admissions", diff --git a/misc/change_etudid.py b/misc/change_etudid.py index f157e3c0..43084c3d 100644 --- a/misc/change_etudid.py +++ b/misc/change_etudid.py @@ -53,7 +53,6 @@ tables = ( "billet_absence", "scolog", "etud_annotations", - "entreprise_contact", "notes_formsemestre_inscription", "notes_moduleimpl_inscription", "notes_notes", diff --git a/misc/createtables.sql b/misc/createtables.sql deleted file mode 100644 index 06001b3a..00000000 --- a/misc/createtables.sql +++ /dev/null @@ -1,683 +0,0 @@ - --- Creation des tables pour gestion notes ScoDoc 7 (OBSOLETE !) --- E. Viennet, Sep 2005 - - - --- creation de la base: utiliser le script config/create_dept.sh --- --- ou pour tester: en tant qu'utilisateur postgres --- createuser --pwprompt scogea --- createdb -E UTF-8 -O scogea SCOGEA "scolarite GEA" --- --- - --- generation des id -CREATE SEQUENCE serial; -CREATE SEQUENCE notes_idgen; - -CREATE FUNCTION notes_newid( text ) returns text as ' - select $1 || to_char( nextval(''notes_idgen''), ''FM999999999'' ) - as result; - ' language SQL; - -CREATE SEQUENCE notes_idgen2; - -CREATE FUNCTION notes_newid2( text ) returns text as ' - select $1 || to_char( nextval(''notes_idgen2''), ''FM999999999'' ) - as result; - ' language SQL; - -CREATE SEQUENCE notes_idgen_etud; - -CREATE FUNCTION notes_newid_etud( text ) returns text as ' - select $1 || to_char( nextval(''notes_idgen_etud''), ''FM999999999'' ) - as result; - ' language SQL; - --- Fonction pour anonymisation: --- inspirée par https://www.simononsoftware.com/random-string-in-postgresql/ -CREATE FUNCTION random_text_md5( integer ) returns text - LANGUAGE SQL - AS $$ - select upper( substring( (SELECT string_agg(md5(random()::TEXT), '') - FROM generate_series( - 1, - CEIL($1 / 32.)::integer) - ), 1, $1) ); - $$; - --- Preferences -CREATE TABLE sco_prefs ( - pref_id text DEFAULT notes_newid('PREF'::text) UNIQUE NOT NULL, - name text NOT NULL, - value text, - formsemestre_id text default NULL, - UNIQUE(name,formsemestre_id) -) WITH OIDS; - - -CREATE TABLE identite ( - etudid text DEFAULT notes_newid_etud('EID'::text) UNIQUE NOT NULL, - nom text, - prenom text, - civilite text NOT NULL CHECK (civilite IN ('M', 'F', 'X')), - date_naissance date, -- new: date en texte - lieu_naissance text, - dept_naissance text, - nationalite text, - statut text, -- NULL ou 'SALARIE' - foto text, -- deprecated - photo_filename text, - code_nip text UNIQUE, -- code NIP Apogee (may be null) - code_ine text UNIQUE, -- code INE Apogee (may be null) - nom_usuel text, -- optionnel (si present, affiché à la place du nom) - boursier text -- 'O' (capital o) si boursier -) WITH OIDS; - -CREATE TABLE adresse ( - adresse_id text DEFAULT notes_newid_etud('ADR'::text) NOT NULL, - etudid text NOT NULL, - email text, -- email institutionnel - emailperso text, -- email personnel (exterieur) - domicile text, - codepostaldomicile text, - villedomicile text, - paysdomicile text, - telephone text, - telephonemobile text, - fax text, - typeadresse text DEFAULT 'domicile'::text NOT NULL, - entreprise_id integer, - description text -) WITH OIDS; - -CREATE TABLE admissions ( - adm_id text DEFAULT notes_newid_etud('ADM'::text) NOT NULL, - etudid text NOT NULL, - annee integer, - bac text, - specialite text, - annee_bac integer, - math real, - physique real, - anglais real, - francais real, - rang integer, -- dans les voeux du candidat (inconnu avec APB) - qualite real, - rapporteur text, - decision text, - score real, - commentaire text, - nomlycee text, - villelycee text, - codepostallycee text, - codelycee text, - debouche text, -- OBSOLETE UNUSED situation APRES etre passe par chez nous (texte libre) - type_admission text, -- 'APB', 'APC-PC', 'CEF', 'Direct', '?' (autre) - boursier_prec integer default NULL, -- etait boursier dans le cycle precedent (lycee) ? - classement integer default NULL, -- classement par le jury d'admission (1 à N), global (pas celui d'APB si il y a des groupes) - apb_groupe text, -- code du groupe APB - apb_classement_gr integer default NULL -- classement (1..Ngr) par le jury dans le groupe APB -) WITH OIDS; - - -CREATE TABLE itemsuivi ( - itemsuivi_id text DEFAULT notes_newid('SUI'::text) PRIMARY KEY, - etudid text NOT NULL, - item_date date DEFAULT now(), -- date de l'observation - situation text -- situation à cette date (champ libre) -) WITH OIDS; - -CREATE TABLE itemsuivi_tags ( - tag_id text DEFAULT notes_newid('TG') PRIMARY KEY, - title text UNIQUE NOT NULL -) WITH OIDS; - -CREATE TABLE itemsuivi_tags_assoc ( - tag_id text REFERENCES itemsuivi_tags(tag_id) ON DELETE CASCADE, - itemsuivi_id text REFERENCES itemsuivi(itemsuivi_id) ON DELETE CASCADE, - PRIMARY KEY (tag_id, itemsuivi_id) -) WITH OIDS; - - -CREATE TABLE absences ( - etudid text NOT NULL, - jour date, -- jour de l'absence - estabs boolean, -- vrai si absent - estjust boolean, -- vrai si justifie - matin boolean, -- vrai si concerne le matin, faux si apres midi - description text, -- "raison" de l'absence - entry_date timestamp with time zone DEFAULT now(), - moduleimpl_id text -- moduleimpid concerne (optionnel) -) WITH OIDS; - -CREATE TABLE absences_notifications ( - etudid text NOT NULL, - notification_date timestamp with time zone DEFAULT now(), - email text NOT NULL, - nbabs integer, - nbabsjust integer, - formsemestre_id text -- semestre concerne par cette notification -) WITH OIDS; - -CREATE SEQUENCE notes_idgen_billets; -CREATE FUNCTION notes_newid_billet( text ) returns text as ' - select $1 || to_char( nextval(''notes_idgen_billets''), ''FM999999999'' ) - as result; - ' language SQL; - -CREATE TABLE billet_absence ( - billet_id text DEFAULT notes_newid_billet('B'::text) NOT NULL, - etudid text NOT NULL, - abs_begin timestamp with time zone, - abs_end timestamp with time zone, - description text, -- "raison" de l'absence - etat integer default 0, -- 0 new, 1 processed - entry_date timestamp with time zone DEFAULT now(), - justified integer default 0 -- 1 si l'absence pourrait etre justifiée -) WITH OIDS; - - --- --- Log des actions (journal modif etudiants) -CREATE TABLE scolog ( - date timestamp without time zone DEFAULT now(), - authenticated_user text, - remote_addr text, - remote_host text, - method text, - etudid character(32), - msg text -) WITH OIDS; - - -CREATE TABLE etud_annotations ( - id integer DEFAULT nextval('serial'::text) NOT NULL, - date timestamp without time zone DEFAULT now(), - etudid character(32), - author text, -- now unused - comment text, - zope_authenticated_user text, -- should be author - zope_remote_addr text -) WITH OIDS; - --- ------------ Nouvelle gestion des absences ------------ --- CREATE SEQUENCE abs_idgen; --- CREATE FUNCTION abs_newid( text ) returns text as ' --- select $1 || to_char( nextval(''abs_idgen''), ''FM999999999'' ) --- as result; --- ' language SQL; - --- CREATE TABLE abs_absences ( --- absid text default abs_newid('AB') PRIMARY KEY, --- etudid character(32), --- abs_begin timestamp with time zone, --- abs_end timestamp with time zone --- ) WITH OIDS; - --- CREATE TABLE abs_presences ( --- absid text default abs_newid('PR') PRIMARY KEY, --- etudid character(32), --- abs_begin timestamp with time zone, --- abs_end timestamp with time zone --- ) WITH OIDS; - --- CREATE TABLE abs_justifs ( --- absid text default abs_newid('JU') PRIMARY KEY, --- etudid character(32), --- abs_begin timestamp with time zone, --- abs_end timestamp with time zone, --- category text, --- description text --- ) WITH OIDS; - - - --- ------------ ENTREPRISES ------------ - -CREATE TABLE entreprises ( - entreprise_id serial NOT NULL, - nom text, - adresse text, - ville text, - codepostal text, - pays text, - contact_origine text, - secteur text, - note text, - privee text, - localisation text, - qualite_relation integer, -- -1 inconnue, 0, 25, 50, 75, 100 - plus10salaries integer, - date_creation timestamp without time zone DEFAULT now() -) WITH OIDS; - - -CREATE TABLE entreprise_correspondant ( - entreprise_corresp_id serial NOT NULL, - nom text, - prenom text, - fonction text, - phone1 text, - phone2 text, - mobile text, - mail1 text, - mail2 text, - note text, - entreprise_id integer, - civilite text, - fax text -) WITH OIDS; - - --- --- - -CREATE TABLE entreprise_contact ( - entreprise_contact_id serial NOT NULL, - date date, - type_contact text, - entreprise_id integer, - entreprise_corresp_id integer, - etudid text, - description text, - enseignant text -) WITH OIDS; - - --- ------------ NOTES ------------ - - --- Description generique d'un module (eg infos du PPN) -CREATE SEQUENCE notes_idgen_fcod; -CREATE FUNCTION notes_newid_fcod( text ) returns text as ' - select $1 || to_char( nextval(''notes_idgen_fcod''), ''FM999999999'' ) - as result; - ' language SQL; - -CREATE TABLE notes_formations ( - formation_id text default notes_newid('FORM') PRIMARY KEY, - acronyme text NOT NULL, -- 'DUT R&T', 'LPSQRT', ... - titre text NOT NULL, -- titre complet - titre_officiel text NOT NULL, -- "DUT Gestion des Entreprises et Admininistration" - version integer default 1, -- version de la formation - formation_code text default notes_newid_fcod('FCOD') NOT NULL, - type_parcours int DEFAULT 0, -- 0 DUT, 100 Lic Pro - code_specialite text default NULL, - UNIQUE(acronyme,titre,version) -) WITH OIDS; - -CREATE TABLE notes_ue ( - ue_id text default notes_newid('UE') PRIMARY KEY, - formation_id text REFERENCES notes_formations(formation_id), - acronyme text NOT NULL, - numero int, -- ordre de presentation - titre text, - type int DEFAULT 0, -- 0 normal ("fondamentale"), 1 "sport", 2 "projet et stage (LP)", 4 "élective" - ue_code text default notes_newid_fcod('UCOD') NOT NULL, - ects real, -- nombre de credits ECTS - is_external integer default 0, -- si UE effectuee dans le cursus d'un autre etablissement - code_apogee text, -- id de l'element pedagogique Apogee correspondant - coefficient real -- coef UE, utilise seulement si l'option use_ue_coefs est activée -) WITH OIDS; - -CREATE TABLE notes_matieres ( - matiere_id text default notes_newid('MAT') PRIMARY KEY, - ue_id text REFERENCES notes_ue(ue_id), - titre text, - numero int, -- ordre de presentation - UNIQUE(ue_id,titre) -) WITH OIDS; - -CREATE TABLE notes_semestres ( - -- une bete table 1,2,3,...,8 pour l'instant fera l'affaire... - semestre_id int PRIMARY KEY -) WITH OIDS; -INSERT INTO notes_semestres (semestre_id) VALUES (-1); -- denote qu'il n'y a pas de semestres dans ce diplome -INSERT INTO notes_semestres (semestre_id) VALUES (1); -INSERT INTO notes_semestres (semestre_id) VALUES (2); -INSERT INTO notes_semestres (semestre_id) VALUES (3); -INSERT INTO notes_semestres (semestre_id) VALUES (4); -INSERT INTO notes_semestres (semestre_id) VALUES (5); -INSERT INTO notes_semestres (semestre_id) VALUES (6); -INSERT INTO notes_semestres (semestre_id) VALUES (7); -INSERT INTO notes_semestres (semestre_id) VALUES (8); - -CREATE TABLE notes_modules ( - module_id text default notes_newid('MOD') PRIMARY KEY, - titre text, - code text NOT NULL, - heures_cours real, - heures_td real, - heures_tp real, - coefficient real, -- coef PPN - ue_id text REFERENCES notes_ue(ue_id), - formation_id text REFERENCES notes_formations(formation_id), - matiere_id text REFERENCES notes_matieres(matiere_id), - semestre_id integer REFERENCES notes_semestres(semestre_id), - numero int, -- ordre de presentation - abbrev text, -- nom court - ects real, -- nombre de credits ECTS (NON UTILISES) - code_apogee text, -- id de l'element pedagogique Apogee correspondant - module_type int -- NULL ou 0:defaut, 1: malus (NOTES_MALUS) -) WITH OIDS; - -CREATE TABLE notes_tags ( - tag_id text default notes_newid('TAG') PRIMARY KEY, - title text UNIQUE NOT NULL -) WITH OIDS; - -CREATE TABLE notes_modules_tags ( - tag_id text REFERENCES notes_tags(tag_id) ON DELETE CASCADE, - module_id text REFERENCES notes_modules(module_id) ON DELETE CASCADE, - PRIMARY KEY (tag_id, module_id) -) WITH OIDS; - - --- Mise en oeuvre d'un semestre de formation -CREATE TABLE notes_formsemestre ( - formsemestre_id text default notes_newid('SEM') PRIMARY KEY, - formation_id text REFERENCES notes_formations(formation_id), - semestre_id int REFERENCES notes_semestres(semestre_id), - titre text, - date_debut date, - date_fin date, - -- responsable_id text, - -- gestion_absence integer default 1, -- XXX obsolete - -- bul_show_decision integer default 1, -- XXX obsolete - -- bul_show_uevalid integer default 1, -- XXX obsolete - etat integer default 1, -- 1 ouvert, 0 ferme (verrouille) - -- nomgroupetd text default 'TD', -- XXX obsolete - -- nomgroupetp text default 'TP', -- XXX obsolete - -- nomgroupeta text default 'langues', -- XXX obsolete - -- bul_show_codemodules integer default 1, -- XXX obsolete - -- bul_show_rangs integer default 1, -- XXX obsolete - -- bul_show_ue_rangs integer default 1, -- XXX obsolete - -- bul_show_mod_rangs integer default 1, -- XXX obsolete - gestion_compensation integer default 0, -- gestion compensation sem DUT - bul_hide_xml integer default 0, -- ne publie pas le bulletin XML - gestion_semestrielle integer default 0, -- semestres decales (pour gestion jurys) - bul_bgcolor text default 'white', -- couleur fond bulletins HTML - modalite text, -- FI, FC, APP, '' - resp_can_edit integer default 0, -- autorise resp. a modifier semestre - resp_can_change_ens integer default 1, -- autorise resp. a modifier slt les enseignants - ens_can_edit_eval int default 0, -- autorise les ens a creer des evals - elt_sem_apo text, -- code element semestre Apogee, eg VRTW1 ou V2INCS4,V2INLS4 - elt_annee_apo text -- code element annee Apogee, eg VRT1A ou V2INLA,V2INCA -) WITH OIDS; - --- id des utilisateurs responsables (aka directeurs des etudes) du semestre: -CREATE TABLE notes_formsemestre_responsables ( - formsemestre_id text REFERENCES notes_formsemestre(formsemestre_id) ON DELETE CASCADE, - responsable_id text NOT NULL, - UNIQUE(formsemestre_id, responsable_id) -) WITH OIDS; - --- Etape Apogee associes au semestre: -CREATE TABLE notes_formsemestre_etapes ( - formsemestre_id text REFERENCES notes_formsemestre(formsemestre_id) ON DELETE CASCADE, - etape_apo text NOT NULL -) WITH OIDS; - -CREATE TABLE notes_form_modalites ( - form_modalite_id text default notes_newid('Md') PRIMARY KEY, - modalite text, -- la clef dans notes_formsemestre - titre text, -- le nom complet de la modalite pour les documents scodoc - numero SERIAL -- integer, ordre de presentation -); -INSERT INTO notes_form_modalites (modalite, titre) VALUES ('', 'Autres formations'); -INSERT INTO notes_form_modalites (modalite, titre) VALUES ('FI', 'Formation Initiale'); -INSERT INTO notes_form_modalites (modalite, titre) VALUES ('FC', 'Formation Continue'); -INSERT INTO notes_form_modalites (modalite, titre) VALUES ('FAP', 'Apprentissage'); -INSERT INTO notes_form_modalites (modalite, titre) VALUES ('DEC', 'Formation Décalées'); -INSERT INTO notes_form_modalites (modalite, titre) VALUES ('LIC', 'Licence'); -INSERT INTO notes_form_modalites (modalite, titre) VALUES ('CP', 'Contrats de Professionnalisation'); -INSERT INTO notes_form_modalites (modalite, titre) VALUES ('EXT', 'Extérieur'); - --- semsets -CREATE TABLE notes_semset ( - semset_id text default notes_newid('NSS') PRIMARY KEY, - title text, - annee_scolaire int default NULL, -- 2016 - sem_id int default NULL -- periode: 0 (année), 1 (Simpair), 2 (Spair) -) WITH OIDS; - -CREATE TABLE notes_semset_formsemestre ( - formsemestre_id text REFERENCES notes_formsemestre(formsemestre_id) ON DELETE CASCADE, - semset_id text REFERENCES notes_semset (semset_id) ON DELETE CASCADE, - PRIMARY KEY (formsemestre_id, semset_id) -) WITH OIDS; - --- Coef des UE capitalisees arrivant dans ce semestre: -CREATE TABLE notes_formsemestre_uecoef ( - formsemestre_uecoef_id text default notes_newid('SEM') PRIMARY KEY, - formsemestre_id text REFERENCES notes_formsemestre(formsemestre_id), - ue_id text REFERENCES notes_ue(ue_id), - coefficient real NOT NULL, - UNIQUE(formsemestre_id, ue_id) -) WITH OIDS; - - --- Formules utilisateurs pour calcul moyenne UE -CREATE TABLE notes_formsemestre_ue_computation_expr ( - notes_formsemestre_ue_computation_expr_id text default notes_newid('UEXPR') PRIMARY KEY, - formsemestre_id text REFERENCES notes_formsemestre(formsemestre_id), - ue_id text REFERENCES notes_ue(ue_id), - computation_expr text, -- formule de calcul moyenne - UNIQUE(formsemestre_id, ue_id) -) WITH OIDS; - --- Menu custom associe au semestre -CREATE TABLE notes_formsemestre_custommenu ( - custommenu_id text default notes_newid('CMENU') PRIMARY KEY, - formsemestre_id text REFERENCES notes_formsemestre(formsemestre_id), - title text, - url text, - idx integer default 0 -- rang dans le menu -) WITH OIDS; - --- Mise en oeuvre d'un module pour une annee/semestre -CREATE TABLE notes_moduleimpl ( - moduleimpl_id text default notes_newid('MIP') PRIMARY KEY, - module_id text REFERENCES notes_modules(module_id), - formsemestre_id text REFERENCES notes_formsemestre(formsemestre_id), - responsable_id text, - computation_expr text, -- formule de calcul moyenne - UNIQUE(module_id,formsemestre_id) -- ajoute -) WITH OIDS; - --- Enseignants (chargés de TD ou TP) d'un moduleimpl -CREATE TABLE notes_modules_enseignants ( - modules_enseignants_id text default notes_newid('ENS') PRIMARY KEY, - moduleimpl_id text REFERENCES notes_moduleimpl(moduleimpl_id), - ens_id text -- est le user_name de sco_users (de la base SCOUSERS) -) WITH OIDS; - --- Inscription a un semestre de formation -CREATE TABLE notes_formsemestre_inscription ( - formsemestre_inscription_id text default notes_newid2('SI') PRIMARY KEY, - etudid text REFERENCES identite(etudid), - formsemestre_id text REFERENCES notes_formsemestre(formsemestre_id), - etat text, -- I inscrit, D demission en cours de semestre, DEF si "defaillant" - etape text, -- etape apogee d'inscription (experimental 2020) - UNIQUE(formsemestre_id, etudid) -) WITH OIDS; - --- Inscription a un module (etudiants,moduleimpl) -CREATE TABLE notes_moduleimpl_inscription ( - moduleimpl_inscription_id text default notes_newid2('MI') PRIMARY KEY, - moduleimpl_id text REFERENCES notes_moduleimpl(moduleimpl_id), - etudid text REFERENCES identite(etudid), - UNIQUE( moduleimpl_id, etudid) -) WITH OIDS; - - -CREATE TABLE partition( - partition_id text default notes_newid2('P') PRIMARY KEY, - formsemestre_id text REFERENCES notes_formsemestre(formsemestre_id), - partition_name text, -- "TD", "TP", ... (NULL for 'all') - compute_ranks integer default 1, -- calcul rang etudiants dans les groupes (currently unused) - numero SERIAL, -- ordre de presentation - bul_show_rank integer default 0, - show_in_lists integer default 1, -- montre dans les noms de groupes - UNIQUE(formsemestre_id,partition_name) -) WITH OIDS; - -CREATE TABLE group_descr ( - group_id text default notes_newid2('G') PRIMARY KEY, - partition_id text REFERENCES partition(partition_id), - group_name text, -- "A", "C2", ... (NULL for 'all') - UNIQUE(partition_id, group_name) -) WITH OIDS; - -CREATE TABLE group_membership( - group_membership_id text default notes_newid2('GM') PRIMARY KEY, - etudid text REFERENCES identite(etudid), - group_id text REFERENCES group_descr(group_id), - UNIQUE(etudid, group_id) -) WITH OIDS; - --- Evaluations (controles, examens, ...) -CREATE TABLE notes_evaluation ( - evaluation_id text default notes_newid('EVAL') PRIMARY KEY, - moduleimpl_id text REFERENCES notes_moduleimpl(moduleimpl_id), - jour date, - heure_debut time, - heure_fin time, - description text, - note_max real, - coefficient real, - visibulletin integer default 1, - publish_incomplete integer default 0, -- prise en compte meme si incomplete - evaluation_type integer default 0, -- type d'evaluation: 0 normale, 1 rattrapage - numero int -- ordre de presentation (le plus petit numero est normalement la plus ancienne eval) -) WITH OIDS; - --- Les notes... -CREATE TABLE notes_notes ( - etudid text REFERENCES identite(etudid), - evaluation_id text REFERENCES notes_evaluation(evaluation_id), - value real, -- null si absent, voir valeurs speciales dans notes_table.py - UNIQUE(etudid,evaluation_id), - -- infos sur saisie de cette note: - comment text, - date timestamp default now(), - uid text -) WITH OIDS; -CREATE INDEX notes_notes_evaluation_id_idx ON notes_notes (evaluation_id); - --- Historique des modifs sur notes (anciennes entrees de notes_notes) -CREATE TABLE notes_notes_log ( - id SERIAL PRIMARY KEY, - etudid text REFERENCES identite(etudid), - evaluation_id text, -- REFERENCES notes_evaluation(evaluation_id), - value real, - comment text, - date timestamp, - uid text - -- pas de foreign key, sinon bug lors supression notes (et on - -- veut garder le log) - -- FOREIGN KEY (etudid,evaluation_id) REFERENCES notes_notes(etudid,evaluation_id) -) WITH OIDS; - - ---------------------------------------------------------------------- --- Parcours d'un etudiant --- --- etat: INSCRIPTION inscr. de l'etud dans ce semestre --- DEM l'etud demissionne EN COURS DE SEMESTRE --- DIPLOME en fin semestre, attribution du diplome correspondant --- (ou plutot, validation du semestre) --- AUT_RED en fin semestre, autorise a redoubler ce semestre --- EXCLUS exclus (== non autorise a redoubler) --- VALID_SEM obtention semestre après jury terminal --- VALID_UE obtention UE après jury terminal --- ECHEC_SEM echec a ce semestre --- UTIL_COMPENSATION utilise formsemestre_id pour compenser et valider --- comp_formsemestre_id -CREATE TABLE scolar_events ( - event_id text default notes_newid('EVT') PRIMARY KEY, - etudid text, - event_date timestamp default now(), - formsemestre_id text REFERENCES notes_formsemestre(formsemestre_id), - ue_id text REFERENCES notes_ue(ue_id), - event_type text, -- 'CREATION', 'INSCRIPTION', 'DEMISSION', - -- 'AUT_RED', 'EXCLUS', 'VALID_UE', 'VALID_SEM' - -- 'ECHEC_SEM' - -- 'UTIL_COMPENSATION' - comp_formsemestre_id text REFERENCES notes_formsemestre(formsemestre_id) - -- semestre compense par formsemestre_id -) WITH OIDS; - --- Stockage des codes d'etat apres jury -CREATE SEQUENCE notes_idgen_svalid; - -CREATE FUNCTION notes_newidsvalid( text ) returns text as ' - select $1 || to_char( nextval(''notes_idgen_svalid''), ''FM999999999'' ) - as result; - ' language SQL; - -CREATE TABLE scolar_formsemestre_validation ( - formsemestre_validation_id text default notes_newidsvalid('VAL') PRIMARY KEY, - etudid text NOT NULL, - formsemestre_id text REFERENCES notes_formsemestre(formsemestre_id), -- anciennement (<2015-03-17) NULL si external - ue_id text REFERENCES notes_ue(ue_id), -- NULL si validation de semestre - code text NOT NULL, - assidu integer, -- NULL pour les UE, 0|1 pour les semestres - event_date timestamp default now(), - compense_formsemestre_id text, -- null sauf si compense un semestre - moy_ue real, -- moyenne UE capitalisee (/20, NULL si non calculee) - semestre_id int, -- (normalement NULL) indice du semestre, utile seulement pour UE "antérieures" et si la formation définit des UE utilisées dans plusieurs semestres (cas R&T IUTV v2) - is_external integer default 0, -- si UE validée dans le cursus d'un autre etablissement - UNIQUE(etudid,formsemestre_id,ue_id) -- une seule decision -) WITH OIDS; - -CREATE TABLE scolar_autorisation_inscription ( - autorisation_inscription_id text default notes_newidsvalid('AUT') PRIMARY KEY, - etudid text NOT NULL, - formation_code text NOT NULL, - semestre_id int REFERENCES notes_semestres(semestre_id), -- semestre ou on peut s'inscrire - date timestamp default now(), - origin_formsemestre_id text REFERENCES notes_formsemestre(formsemestre_id) -) WITH OIDS; - ---------------------------------------------------------------------- --- NOUVELLES (pour page d'accueil et flux rss associe) --- -CREATE TABLE scolar_news ( - news_id text default notes_newid('NEWS') PRIMARY KEY, - date timestamp default now(), - authenticated_user text, - type text, -- 'INSCR', 'NOTES', 'FORM', 'SEM', 'MISC' - object text, -- moduleimpl_id, formation_id, formsemestre_id, - text text, -- free text - url text -- optional URL -) WITH OIDS; - --- Appreciations sur bulletins -CREATE TABLE notes_appreciations ( - id integer DEFAULT nextval('serial'::text) NOT NULL, - date timestamp without time zone DEFAULT now(), - etudid text REFERENCES identite(etudid), - formsemestre_id text REFERENCES notes_formsemestre(formsemestre_id), - author text, - comment text, - zope_authenticated_user text, - zope_remote_addr text -) WITH OIDS; - - - -CREATE OR REPLACE FUNCTION truncate_tables(username IN VARCHAR) RETURNS void AS $$ -DECLARE - statements CURSOR FOR - SELECT tablename FROM pg_tables - WHERE tableowner = username AND schemaname = 'public' - AND tablename <> 'notes_semestres' - AND tablename <> 'notes_form_modalites'; -BEGIN - FOR stmt IN statements LOOP - EXECUTE 'TRUNCATE TABLE ' || quote_ident(stmt.tablename) || ' CASCADE;'; - END LOOP; -END; -$$ LANGUAGE plpgsql; \ No newline at end of file diff --git a/tools/anonymize_db.py b/tools/anonymize_db.py index d76edb3e..34543fe4 100755 --- a/tools/anonymize_db.py +++ b/tools/anonymize_db.py @@ -92,27 +92,6 @@ ANONYMIZED_FIELDS = { "admissions.nomlycee": anonymize_name, "billet_absence.description": anonymize_null, "etud_annotations.comment": anonymize_name, - # "entreprises.nom": anonymize_name, - # "entreprises.adresse": anonymize_null, - # "entreprises.ville": anonymize_null, - # "entreprises.codepostal": anonymize_null, - # "entreprises.pays": anonymize_null, - # "entreprises.contact_origine": anonymize_null, - # "entreprises.secteur": anonymize_null, - # "entreprises.note": anonymize_null, - # "entreprises.privee": anonymize_null, - # "entreprises.localisation": anonymize_null, - # "entreprise_correspondant.nom": anonymize_name, - # "entreprise_correspondant.prenom": anonymize_name, - # "entreprise_correspondant.phone1": anonymize_null, - # "entreprise_correspondant.phone2": anonymize_null, - # "entreprise_correspondant.mobile": anonymize_null, - # "entreprise_correspondant.mail1": anonymize_null, - # "entreprise_correspondant.mail2": anonymize_null, - # "entreprise_correspondant.note": anonymize_null, - # "entreprise_correspondant.fax": anonymize_null, - # "entreprise_contact.description": anonymize_null, - # "entreprise_contact.enseignant": anonymize_null, "notes_appreciations.comment": anonymize_name, }