diff --git a/app/scodoc/ImportScolars.py b/app/scodoc/ImportScolars.py
index 908782a1..92e53e98 100644
--- a/app/scodoc/ImportScolars.py
+++ b/app/scodoc/ImportScolars.py
@@ -239,7 +239,7 @@ def students_import_excel(
if formsemestre_id:
dest = "formsemestre_status?formsemestre_id=%s" % formsemestre_id
else:
- dest = context.NotesURL()
+ dest = scu.NotesURL()
H = [
html_sco_header.sco_header(context, REQUEST, page_title="Import etudiants")
]
diff --git a/app/scodoc/ZAbsences.py b/app/scodoc/ZAbsences.py
index 9e7ae813..58d8046c 100644
--- a/app/scodoc/ZAbsences.py
+++ b/app/scodoc/ZAbsences.py
@@ -133,7 +133,7 @@ class ZAbsences(
# --------------------------------------------------------------------
# used to view content of the object
security.declareProtected(ScoView, "index_html")
- index_html = sco_abs_views.absences_index_html
+ index_html = sco_abs_views.index_html
security.declareProtected(ScoView, "EtatAbsences")
EtatAbsences = sco_abs_views.EtatAbsences
diff --git a/app/scodoc/ZEntreprises.py b/app/scodoc/ZEntreprises.py
deleted file mode 100644
index 9a70012f..00000000
--- a/app/scodoc/ZEntreprises.py
+++ /dev/null
@@ -1,1315 +0,0 @@
-# -*- mode: python -*-
-# -*- coding: utf-8 -*-
-
-##############################################################################
-#
-# Gestion scolarite IUT
-#
-# Copyright (c) 1999 - 2021 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 urllib
-import string
-import re
-import time
-import calendar
-
-from sco_zope import * # pylint: disable=unused-wildcard-import
-
-from sco_permissions import ScoEntrepriseView, ScoEntrepriseChange
-from notes_log import log
-from scolog import logdb
-from sco_utils import SCO_ENCODING
-import sco_utils as scu
-import html_sidebar
-import VERSION
-from gen_tables import GenTable
-from TrivialFormulator import TrivialFormulator, TF
-import scolars
-import sco_entreprises
-
-
-def entreprise_header(context, REQUEST=None, page_title=""):
- "common header for all Entreprises pages"
- return html_sco_header.sco_header(context, REQUEST, container=context, page_title=page_title)
-
-
-def entreprise_footer(context, REQUEST):
- "common entreprise footer"
- return html_sco_header.sco_footer(context, REQUEST)
-
-
-class ZEntreprises(
- ObjectManager, PropertyManager, RoleManager, Item, Persistent, Implicit
-):
-
- "ZEntreprises object"
-
- meta_type = "ZEntreprises"
- security = ClassSecurityInfo()
-
- # This is the list of the methods associated to 'tabs' in the ZMI
- # Be aware that The first in the list is the one shown by default, so if
- # the 'View' tab is the first, you will never see your tabs by cliquing
- # on the object.
- manage_options = (
- ({"label": "Contents", "action": "manage_main"},)
- + PropertyManager.manage_options # add the 'Properties' tab
- + (
- # this line is kept as an example with the files :
- # dtml/manage_editZScolarForm.dtml
- # html/ZScolar-edit.stx
- # {'label': 'Properties', 'action': 'manage_editForm',},
- {"label": "View", "action": "index_html"},
- )
- + Item.manage_options # add the 'Undo' & 'Owner' tab
- + RoleManager.manage_options # add the 'Security' tab
- )
-
- # no permissions, only called from python
- def __init__(self, id, title):
- "initialise a new instance"
- self.id = id
- self.title = title
-
- security.declareProtected(ScoEntrepriseView, "sidebar")
-
- def sidebar(self, REQUEST):
- "barre gauche (overide std sco sidebar)"
- # rewritten from legacy DTML code
- # XXX rare cas restant d'utilisation de l'acquisition Zope2: à revoir
- params = {"ScoURL": self.ScoURL()}
- H = [
- """
""")
- return "".join(H)
-
- # --------------------------------------------------------------------
- #
- # Entreprises : Vues
- #
- # --------------------------------------------------------------------
- security.declareProtected(ScoEntrepriseView, "index_html")
-
- def index_html(
- self, REQUEST=None, 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)
-
- if etud_nom:
- entreprises = sco_entreprises.do_entreprise_list_by_etud(
- self, args=REQUEST.form, sort_on_contact=True
- )
- table_navigation = ""
- else:
- entreprises = sco_entreprises.do_entreprise_list(
- self,
- args=REQUEST.form,
- 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.URL0 + "?" + urllib.urlencode(webparams)
- )
- else:
- prev_lnk = ""
- if len(entreprises) >= limit:
- webparams["offset"] = (offset or 0) + limit
- next_lnk = 'suivantes' % (
- REQUEST.URL0 + "?" + urllib.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(
- self, 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(
- self, 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 " % VERSION.SCONAME + scu.timedate_human_repr(),
- filename=scu.make_filename(
- "entreprises_%s" % self.get_preference("DeptName")
- ),
- caption="Entreprises du département %s" % self.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.URL0 + "?",
- preferences=self.get_preferences(),
- )
- if format != "html":
- return tab.make_page(self, format=format, REQUEST=REQUEST)
- else:
- H = [
- entreprise_header(
- self, REQUEST=REQUEST, page_title="Suivi entreprises"
- ),
- """Suivi relations entreprises
""",
- """""",
- tab.html(),
- """
""",
- entreprise_footer(self, REQUEST),
- ]
- return "\n".join(H)
-
- security.declareProtected(ScoEntrepriseView, "entreprise_contact_list")
-
- def entreprise_contact_list(self, entreprise_id=None, format="html", REQUEST=None):
- """Liste des contacts de l'entreprise"""
- H = [entreprise_header(self, REQUEST=REQUEST, page_title="Suivi entreprises")]
- if entreprise_id:
- E = sco_entreprises.do_entreprise_list(
- self, args={"entreprise_id": entreprise_id}
- )[0]
- C = sco_entreprises.do_entreprise_contact_list(
- self, args={"entreprise_id": entreprise_id}
- )
- H.append(
- """
- """
- % E
- )
- else:
- C = sco_entreprises.do_entreprise_contact_list(self, args={})
- H.append(
- """
- """
- )
- for c in C:
- c[
- "_date_target"
- ] = "%s/entreprise_contact_edit?entreprise_contact_id=%s" % (
- self.EntreprisesURL(),
- c["entreprise_contact_id"],
- )
- c["entreprise"] = sco_entreprises.do_entreprise_list(
- self, args={"entreprise_id": c["entreprise_id"]}
- )[0]
- if c["etudid"]:
- c["etud"] = self.getEtudInfo(etudid=c["etudid"], filled=1)[0]
- c["etudnom"] = c["etud"]["nomprenom"]
- c["_etudnom_target"] = "%s/ficheEtud?etudid=%s" % (
- self.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 " % VERSION.SCONAME + scu.timedate_human_repr(),
- filename=scu.make_filename("contacts_%s" % self.get_preference("DeptName")),
- caption="",
- html_sortable=True,
- html_class="contact_list table_leftalign",
- html_with_td_classes=True,
- base_url=REQUEST.URL0 + "?",
- preferences=self.get_preferences(),
- )
- if format != "html":
- return tab.make_page(self, format=format, REQUEST=REQUEST)
-
- H.append(tab.html())
-
- if REQUEST.AUTHENTICATED_USER.has_permission(
- Permission.ScoEntrepriseChange, self
- ):
- if entreprise_id:
- H.append(
- """nouveau "contact"
- """
- % E
- )
-
- H.append(entreprise_footer(self, REQUEST))
- return "\n".join(H)
-
- security.declareProtected(ScoEntrepriseView, "entreprise_correspondant_list")
-
- def entreprise_correspondant_list(
- self,
- entreprise_id=None,
- format="html",
- REQUEST=None,
- ):
- """Liste des correspondants de l'entreprise"""
- E = sco_entreprises.do_entreprise_list(
- self, args={"entreprise_id": entreprise_id}
- )[0]
- H = [
- entreprise_header(self, REQUEST=REQUEST, page_title="Suivi entreprises"),
- """
- Listes des correspondants dans l'entreprise %(nom)s
- """
- % E,
- ]
- correspondants = sco_entreprises.do_entreprise_correspondant_list(
- self, 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" % (
- self.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 " % VERSION.SCONAME + scu.timedate_human_repr(),
- filename=scu.make_filename(
- "correspondants_%s_%s" % (E["nom"], self.get_preference("DeptName"))
- ),
- caption="",
- html_sortable=True,
- html_class="contact_list table_leftalign",
- html_with_td_classes=True,
- base_url=REQUEST.URL0 + "?",
- preferences=self.get_preferences(),
- )
- if format != "html":
- return tab.make_page(self, format=format, REQUEST=REQUEST)
-
- H.append(tab.html())
-
- if REQUEST.AUTHENTICATED_USER.has_permission(
- Permission.ScoEntrepriseChange, self
- ):
- H.append(
- """Ajouter un correspondant dans l'entreprise %(nom)s
- """
- % E
- )
-
- H.append(entreprise_footer(self, REQUEST))
- return "\n".join(H)
-
- security.declareProtected(ScoEntrepriseView, "entreprise_contact_edit")
-
- def entreprise_contact_edit(self, entreprise_contact_id, REQUEST=None):
- """Form edit contact"""
- c = sco_entreprises.do_entreprise_contact_list(
- self, args={"entreprise_contact_id": entreprise_contact_id}
- )[0]
- link_create_corr = (
- 'créer un nouveau correspondant'
- % (self.EntreprisesURL(), c["entreprise_id"])
- )
- E = sco_entreprises.do_entreprise_list(
- self, args={"entreprise_id": c["entreprise_id"]}
- )[0]
- correspondants = sco_entreprises.do_entreprise_correspondant_listnames(
- self, args={"entreprise_id": c["entreprise_id"]}
- ) + [("inconnu", "")]
-
- H = [
- entreprise_header(self, REQUEST=REQUEST, page_title="Suivi entreprises"),
- """
- Contact avec entreprise %(nom)s
"""
- % E,
- ]
- tf = TrivialFormulator(
- REQUEST.URL0,
- REQUEST.form,
- (
- (
- "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 REQUEST.AUTHENTICATED_USER.has_permission(
- ScoEntrepriseChange, self
- ),
- )
-
- if tf[0] == 0:
- H.append(tf[1])
- if REQUEST.AUTHENTICATED_USER.has_permission(
- Permission.ScoEntrepriseChange, self
- ):
- H.append(
- """Supprimer ce contact
"""
- % entreprise_contact_id
- )
- elif tf[0] == -1:
- return REQUEST.RESPONSE.redirect(self.EntreprisesURL())
- else:
- etudok = sco_entreprises.do_entreprise_check_etudiant(
- self, 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(self, tf[2])
- return REQUEST.RESPONSE.redirect(
- self.EntreprisesURL()
- + "/entreprise_contact_list?entreprise_id="
- + str(c["entreprise_id"])
- )
- H.append(entreprise_footer(self, REQUEST))
- return "\n".join(H)
-
- security.declareProtected(ScoEntrepriseView, "entreprise_correspondant_edit")
-
- def entreprise_correspondant_edit(self, entreprise_corresp_id, REQUEST=None):
- """Form édition d'un correspondant"""
- c = sco_entreprises.do_entreprise_correspondant_list(
- self, args={"entreprise_corresp_id": entreprise_corresp_id}
- )[0]
- H = [
- entreprise_header(self, REQUEST=REQUEST, page_title="Suivi entreprises"),
- """Édition contact entreprise
""",
- ]
- tf = TrivialFormulator(
- REQUEST.URL0,
- REQUEST.form,
- (
- (
- "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 REQUEST.AUTHENTICATED_USER.has_permission(
- ScoEntrepriseChange, self
- ),
- )
- if tf[0] == 0:
- H.append(tf[1])
- elif tf[0] == -1:
- return REQUEST.RESPONSE.redirect(
- "%s/entreprise_correspondant_list?entreprise_id=%s"
- % (self.EntreprisesURL(), c["entreprise_id"])
- )
- else:
- sco_entreprises.do_entreprise_correspondant_edit(self, tf[2])
- return REQUEST.RESPONSE.redirect(
- "%s/entreprise_correspondant_list?entreprise_id=%s"
- % (self.EntreprisesURL(), c["entreprise_id"])
- )
- H.append(entreprise_footer(self, REQUEST))
- return "\n".join(H)
-
- security.declareProtected(ScoEntrepriseChange, "entreprise_contact_create")
-
- def entreprise_contact_create(self, entreprise_id, REQUEST=None):
- """Form création contact"""
- E = sco_entreprises.do_entreprise_list(
- self, args={"entreprise_id": entreprise_id}
- )[0]
- correspondants = sco_entreprises.do_entreprise_correspondant_listnames(
- self, args={"entreprise_id": entreprise_id}
- )
- if not correspondants:
- correspondants = [("inconnu", "")]
- curtime = time.strftime("%d/%m/%Y")
- link_create_corr = (
- 'créer un nouveau correspondant'
- % (self.EntreprisesURL(), entreprise_id)
- )
- H = [
- entreprise_header(self, REQUEST=REQUEST, page_title="Suivi entreprises"),
- """"""
- % E,
- ]
- tf = TrivialFormulator(
- REQUEST.URL0,
- REQUEST.form,
- (
- ("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 REQUEST.AUTHENTICATED_USER.has_permission(
- ScoEntrepriseChange, self
- ),
- )
- if tf[0] == 0:
- H.append(tf[1])
- elif tf[0] == -1:
- return REQUEST.RESPONSE.redirect(self.EntreprisesURL())
- else:
- etudok = sco_entreprises.do_entreprise_check_etudiant(
- self, 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(self, tf[2])
- return REQUEST.RESPONSE.redirect(self.EntreprisesURL())
- H.append(entreprise_footer(self, REQUEST))
- return "\n".join(H)
-
- security.declareProtected(ScoEntrepriseChange, "entreprise_contact_delete")
-
- def entreprise_contact_delete(self, entreprise_contact_id, REQUEST=None):
- """Form delete contact"""
- c = sco_entreprises.do_entreprise_contact_list(
- self, args={"entreprise_contact_id": entreprise_contact_id}
- )[0]
- H = [
- entreprise_header(self, REQUEST=REQUEST, page_title="Suivi entreprises"),
- """Suppression du contact
""",
- ]
- tf = TrivialFormulator(
- REQUEST.URL0,
- REQUEST.form,
- (("entreprise_contact_id", {"input_type": "hidden"}),),
- initvalues=c,
- submitlabel="Confirmer la suppression",
- cancelbutton="Annuler",
- readonly=not REQUEST.AUTHENTICATED_USER.has_permission(
- ScoEntrepriseChange, self
- ),
- )
- if tf[0] == 0:
- H.append(tf[1])
- elif tf[0] == -1:
- return REQUEST.RESPONSE.redirect(self.EntreprisesURL())
- else:
- sco_entreprises.do_entreprise_contact_delete(
- self, c["entreprise_contact_id"]
- )
- return REQUEST.RESPONSE.redirect(self.EntreprisesURL())
- H.append(entreprise_footer(self, REQUEST))
- return "\n".join(H)
-
- security.declareProtected(ScoEntrepriseChange, "entreprise_correspondant_create")
-
- def entreprise_correspondant_create(self, entreprise_id, REQUEST=None):
- """Form création correspondant"""
- E = sco_entreprises.do_entreprise_list(
- self, args={"entreprise_id": entreprise_id}
- )[0]
- H = [
- entreprise_header(self, REQUEST=REQUEST, page_title="Suivi entreprises"),
- """"""
- % E,
- ]
- tf = TrivialFormulator(
- REQUEST.URL0,
- REQUEST.form,
- (
- ("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 REQUEST.AUTHENTICATED_USER.has_permission(
- ScoEntrepriseChange, self
- ),
- )
- if tf[0] == 0:
- H.append(tf[1])
- elif tf[0] == -1:
- return REQUEST.RESPONSE.redirect(self.EntreprisesURL())
- else:
- sco_entreprises.do_entreprise_correspondant_create(self, tf[2])
- return REQUEST.RESPONSE.redirect(self.EntreprisesURL())
- H.append(entreprise_footer(self, REQUEST))
- return "\n".join(H)
-
- security.declareProtected(ScoEntrepriseChange, "entreprise_correspondant_delete")
-
- def entreprise_correspondant_delete(self, entreprise_corresp_id, REQUEST=None):
- """Form delete correspondant"""
- c = sco_entreprises.do_entreprise_correspondant_list(
- self, args={"entreprise_corresp_id": entreprise_corresp_id}
- )[0]
- H = [
- entreprise_header(self, REQUEST=REQUEST, page_title="Suivi entreprises"),
- """Suppression du correspondant %(nom)s %(prenom)s
""" % c,
- ]
- tf = TrivialFormulator(
- REQUEST.URL0,
- REQUEST.form,
- (("entreprise_corresp_id", {"input_type": "hidden"}),),
- initvalues=c,
- submitlabel="Confirmer la suppression",
- cancelbutton="Annuler",
- readonly=not REQUEST.AUTHENTICATED_USER.has_permission(
- ScoEntrepriseChange, self
- ),
- )
- if tf[0] == 0:
- H.append(tf[1])
- elif tf[0] == -1:
- return REQUEST.RESPONSE.redirect(self.EntreprisesURL())
- else:
- sco_entreprises.do_entreprise_correspondant_delete(
- self, c["entreprise_corresp_id"]
- )
- return REQUEST.RESPONSE.redirect(self.EntreprisesURL())
- H.append(entreprise_footer(self, REQUEST))
- return "\n".join(H)
-
- security.declareProtected(ScoEntrepriseChange, "entreprise_delete")
-
- def entreprise_delete(self, entreprise_id, REQUEST=None):
- """Form delete entreprise"""
- E = sco_entreprises.do_entreprise_list(
- self, args={"entreprise_id": entreprise_id}
- )[0]
- H = [
- entreprise_header(self, REQUEST=REQUEST, 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(
- self, args={"entreprise_id": entreprise_id}
- )
- if Cl:
- H.append(
- """Correspondants dans l'entreprise qui seront supprimés:
"""
- )
- for c in Cl:
- H.append("""- %(nom)s %(prenom)s (%(fonction)s)
""" % c)
- H.append("""
""")
-
- Cts = sco_entreprises.do_entreprise_contact_list(
- self, args={"entreprise_id": entreprise_id}
- )
- if Cts:
- H.append(
- """Contacts avec l'entreprise qui seront supprimés:
"""
- )
- for c in Cts:
- H.append("""- %(date)s %(description)s
""" % c)
- H.append("""
""")
- tf = self.TrivialFormulator(
- REQUEST.URL0,
- REQUEST.form,
- (("entreprise_id", {"input_type": "hidden"}),),
- initvalues=E,
- submitlabel="Confirmer la suppression",
- cancelbutton="Annuler",
- readonly=not REQUEST.AUTHENTICATED_USER.has_permission(
- ScoEntrepriseChange, self
- ),
- )
- if tf[0] == 0:
- H.append(tf[1])
- elif tf[0] == -1:
- return REQUEST.RESPONSE.redirect(self.EntreprisesURL())
- else:
- sco_entreprises.do_entreprise_delete(self, E["entreprise_id"])
- return REQUEST.RESPONSE.redirect(self.EntreprisesURL())
- H.append(entreprise_footer(self, REQUEST))
- return "\n".join(H)
-
- # -------- Formulaires: traductions du DTML
- security.declareProtected(ScoEntrepriseChange, "entreprise_create")
-
- def entreprise_create(self, REQUEST=None):
- """Form. création entreprise"""
- H = [
- entreprise_header(self, REQUEST, page_title="Création d'une entreprise"),
- """Création d'une entreprise
""",
- ]
- tf = TrivialFormulator(
- REQUEST.URL0,
- REQUEST.form,
- (
- ("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 REQUEST.AUTHENTICATED_USER.has_permission(
- ScoEntrepriseChange, self
- ),
- )
- if tf[0] == 0:
- return "\n".join(H) + tf[1] + entreprise_footer(self, REQUEST)
- elif tf[0] == -1:
- return REQUEST.RESPONSE.redirect(self.EntreprisesURL())
- else:
- sco_entreprises.do_entreprise_create(self, tf[2])
- return REQUEST.RESPONSE.redirect(self.EntreprisesURL())
-
- security.declareProtected(ScoEntrepriseView, "entreprise_edit")
-
- def entreprise_edit(self, entreprise_id, REQUEST=None, start=1):
- """Form. edit entreprise"""
- authuser = REQUEST.AUTHENTICATED_USER
- readonly = not authuser.has_permission(Permission.ScoEntrepriseChange, self)
- F = sco_entreprises.do_entreprise_list(
- self, args={"entreprise_id": entreprise_id}
- )[0]
- H = [
- entreprise_header(self, REQUEST, page_title="Entreprise"),
- """%(nom)s
""" % F,
- ]
- tf = TrivialFormulator(
- REQUEST.URL0,
- REQUEST.form,
- (
- ("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(
- self, args={"entreprise_id": F["entreprise_id"]}
- )
- Cts = sco_entreprises.do_entreprise_contact_list(
- self, 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) :
"""
- % (len(Cts), F["nom"], F["entreprise_id"])
- )
- for c in Cts:
- H.append(
- """- %s """
- % (c["entreprise_contact_id"], c["date"])
- )
- if c["type_contact"]:
- H.append(c["type_contact"])
- if c["etudid"]:
- etud = self.getEtudInfo(etudid=c["etudid"], filled=1)
- if etud:
- etud = etud[0]
- H.append(
- """%s"""
- % (self.ScoURL(), c["etudid"], etud["nomprenom"])
- )
- if c["description"]:
- H.append("(%s)" % c["description"])
- H.append("
")
- H.append("
")
- return "\n".join(H) + entreprise_footer(self, REQUEST)
- elif tf[0] == -1:
- return REQUEST.RESPONSE.redirect(self.EntreprisesURL() + "?start=" + start)
- else:
- sco_entreprises.do_entreprise_edit(self, tf[2])
- return REQUEST.RESPONSE.redirect(self.EntreprisesURL() + "?start=" + start)
diff --git a/app/scodoc/debug.py b/app/scodoc/debug.py
index c1e9f6c7..48e992b7 100644
--- a/app/scodoc/debug.py
+++ b/app/scodoc/debug.py
@@ -60,7 +60,7 @@ import sco_bulletins_xml
def go(app, n=0, verbose=True):
context = app.ScoDoc.objectValues("Folder")[n].Scolarite
if verbose:
- print("context in dept ", sco_core.get_dept_id())
+ print("context in dept ", scu.get_dept_id())
return context
@@ -72,9 +72,9 @@ def go_dept(app, dept, verbose=True):
except AttributeError:
# ignore other folders, like old "icons"
continue
- if sco_core.get_dept_id() == dept:
+ if scu.get_dept_id() == dept:
if verbose:
- print("context in dept ", sco_core.get_dept_id())
+ print("context in dept ", scu.get_dept_id())
return context
raise ValueError("dep %s not found" % dept)
diff --git a/app/scodoc/html_sco_header.py b/app/scodoc/html_sco_header.py
index be8cc334..c45b25bb 100644
--- a/app/scodoc/html_sco_header.py
+++ b/app/scodoc/html_sco_header.py
@@ -28,6 +28,7 @@
import cgi
import sco_utils as scu
+import html_sidebar
import VERSION
"""
@@ -169,7 +170,7 @@ def sco_header(
params = {
"page_title": page_title or VERSION.SCONAME,
"no_side_bar": no_side_bar,
- "ScoURL": context.ScoURL(),
+ "ScoURL": scu.ScoURL(),
"encoding": scu.SCO_ENCODING,
"titrebandeau_mkup": "" + titrebandeau + " | ",
"authuser": str(REQUEST.AUTHENTICATED_USER),
@@ -319,7 +320,7 @@ def sco_header(
Vous avez reçu un mot de passe temporaire.
Vous devez le changer: cliquez ici
"""
- % (context.ScoURL(), str(authuser))
+ % (scu.ScoURL(), str(authuser))
)
#
if head_message:
diff --git a/app/scodoc/html_sidebar.py b/app/scodoc/html_sidebar.py
index d3fe1224..49569cc8 100644
--- a/app/scodoc/html_sidebar.py
+++ b/app/scodoc/html_sidebar.py
@@ -26,6 +26,7 @@
##############################################################################
import sco_utils as scu
+import sco_preferences
from sco_abs import getAbsSemEtud
from sco_permissions import (
ScoUsersAdmin,
@@ -43,10 +44,10 @@ def sidebar_common(context, REQUEST=None):
"partie commune a toutes les sidebar"
authuser = REQUEST.AUTHENTICATED_USER
params = {
- "ScoURL": context.ScoURL(),
- "UsersURL": context.UsersURL(),
- "NotesURL": context.NotesURL(),
- "AbsencesURL": context.AbsencesURL(),
+ "ScoURL": scu.ScoURL(),
+ "UsersURL": scu.UsersURL(),
+ "NotesURL": scu.NotesURL(),
+ "AbsencesURL": scu.AbsencesURL(),
"authuser": str(authuser),
}
H = [
@@ -81,7 +82,7 @@ def sidebar_common(context, REQUEST=None):
def sidebar(context, REQUEST=None):
"Main HTML page sidebar"
# rewritten from legacy DTML code
- params = {"ScoURL": context.ScoURL(), "SCO_USER_MANUAL": scu.SCO_USER_MANUAL}
+ params = {"ScoURL": scu.ScoURL(), "SCO_USER_MANUAL": scu.SCO_USER_MANUAL}
H = ['