forked from ScoDoc/ScoDoc
Compare commits
No commits in common. "aba6330065c1691c2cbcd057175648f3ba36bad9" and "6e72f353343254ccf715cedabce5a6ee41dbf8fb" have entirely different histories.
aba6330065
...
6e72f35334
@ -93,7 +93,7 @@ def absences_just(etudid: int = None, nip: int = None, ine: int = None):
|
||||
"jour": "Fri, 15 Apr 2022 00:00:00 GMT",
|
||||
"matin": false,
|
||||
"estabs": true,
|
||||
"estjust": true,
|
||||
"estjust": false,
|
||||
"description": "",
|
||||
"begin": "2022-04-15 12:00:00",
|
||||
"end": "2022-04-15 17:59:59"
|
||||
@ -120,11 +120,7 @@ def absences_just(etudid: int = None, nip: int = None, ine: int = None):
|
||||
|
||||
|
||||
@bp.route(
|
||||
"/absences/abs_group_etat/<int:group_id>",
|
||||
methods=["GET"],
|
||||
)
|
||||
@bp.route(
|
||||
"/absences/abs_group_etat/group_id/<int:group_id>/date_debut/<string:date_debut>/date_fin/<string:date_fin>",
|
||||
"/absences/abs_group_etat/?group_id=<int:group_id>&date_debut=date_debut&date_fin=date_fin",
|
||||
methods=["GET"],
|
||||
)
|
||||
@token_permission_required(Permission.APIView)
|
||||
|
@ -12,12 +12,12 @@ from app.models import FormSemestreInscription, FormSemestre, Identite
|
||||
from app.scodoc import sco_bulletins
|
||||
from app.scodoc import sco_groups
|
||||
from app.scodoc.sco_permissions import Permission
|
||||
from app.scodoc import notesdb as ndb
|
||||
|
||||
|
||||
@bp.route("/etudiants/courant", defaults={"long": False})
|
||||
@bp.route("/etudiants/courant/long", defaults={"long": True})
|
||||
@bp.route("/etudiants/courant", methods=["GET"])
|
||||
@token_permission_required(Permission.APIView)
|
||||
def etudiants_courant(long=False):
|
||||
def etudiants_courant():
|
||||
"""
|
||||
Retourne la liste des étudiants courant
|
||||
|
||||
@ -55,11 +55,9 @@ def etudiants_courant(long=False):
|
||||
FormSemestre.date_debut <= app.db.func.now(),
|
||||
FormSemestre.date_fin >= app.db.func.now(),
|
||||
)
|
||||
if long:
|
||||
data = [etud.to_dict_bul(include_urls=False) for etud in etuds]
|
||||
else:
|
||||
data = [etud.to_dict_short() for etud in etuds]
|
||||
print(jsonify(data))
|
||||
|
||||
data = [etu.to_dict_bul(include_urls=False) for etu in etuds]
|
||||
|
||||
return jsonify(data)
|
||||
|
||||
|
||||
|
@ -62,27 +62,27 @@ def evaluation_notes(evaluation_id: int):
|
||||
evaluation_id : l'id d'une évaluation
|
||||
|
||||
Exemple de résultat :
|
||||
{
|
||||
"1": {
|
||||
"id": 1,
|
||||
"etudid": 10,
|
||||
"evaluation_id": 1,
|
||||
"value": 15.0,
|
||||
"comment": "",
|
||||
"date": "Wed, 20 Apr 2022 06:49:05 GMT",
|
||||
"uid": 2
|
||||
},
|
||||
"2": {
|
||||
"id": 2,
|
||||
"etudid": 1,
|
||||
"evaluation_id": 1,
|
||||
"value": 12.0,
|
||||
"comment": "",
|
||||
"date": "Wed, 20 Apr 2022 06:49:06 GMT",
|
||||
"uid": 2
|
||||
},
|
||||
...
|
||||
}
|
||||
{
|
||||
"1": {
|
||||
"id": 1,
|
||||
"etudid": 10,
|
||||
"evaluation_id": 1,
|
||||
"value": 15.0,
|
||||
"comment": "",
|
||||
"date": "Wed, 20 Apr 2022 06:49:05 GMT",
|
||||
"uid": 2
|
||||
},
|
||||
"2": {
|
||||
"id": 2,
|
||||
"etudid": 1,
|
||||
"evaluation_id": 1,
|
||||
"value": 12.0,
|
||||
"comment": "",
|
||||
"date": "Wed, 20 Apr 2022 06:49:06 GMT",
|
||||
"uid": 2
|
||||
},
|
||||
...
|
||||
}
|
||||
"""
|
||||
# Fonction utilisée : app.scodoc.sco_evaluation_db.do_evaluation_get_all_notes()
|
||||
|
||||
|
@ -177,7 +177,7 @@ def formation_export_by_formation_id(formation_id: int, export_ids=False):
|
||||
|
||||
try:
|
||||
# Utilisation de la fonction formation_export
|
||||
data = formation_export(formation_id, export_ids)
|
||||
data = formation_export(formation_id)
|
||||
except ValueError:
|
||||
return error_response(
|
||||
409,
|
||||
@ -192,15 +192,15 @@ def formation_export_by_formation_id(formation_id: int, export_ids=False):
|
||||
@token_permission_required(Permission.APIView)
|
||||
def moduleimpls(moduleimpl_id: int):
|
||||
"""
|
||||
Retourne un module moduleimpl en fonction de son id
|
||||
Retourne la liste des moduleimpl
|
||||
|
||||
moduleimpl_id : l'id d'un moduleimpl
|
||||
"""
|
||||
# Récupération des tous les moduleimpl
|
||||
moduleimpl = models.ModuleImpl.query.filter_by(id=moduleimpl_id).first_or_404()
|
||||
list_moduleimpls = models.ModuleImpl.query.filter_by(id=moduleimpl_id)
|
||||
|
||||
# Mise en forme des données
|
||||
data = moduleimpl.to_dict()
|
||||
data = [moduleimpl.to_dict() for moduleimpl in list_moduleimpls]
|
||||
|
||||
return jsonify(data)
|
||||
|
||||
@ -208,7 +208,7 @@ def moduleimpls(moduleimpl_id: int):
|
||||
@bp.route(
|
||||
"/formations/moduleimpl/formsemestre/<int:formsemestre_id>/liste",
|
||||
methods=["GET"],
|
||||
)
|
||||
) # XXX TODO penser à changer la route sur la doc
|
||||
@token_permission_required(Permission.APIView)
|
||||
def moduleimpls_sem(formsemestre_id: int):
|
||||
"""
|
||||
|
@ -68,35 +68,6 @@ def formsemestre_apo(etape_apo: str):
|
||||
Retourne les informations sur les formsemestres
|
||||
|
||||
etape_apo : l'id d'une étape apogée
|
||||
|
||||
Exemple de résultat :
|
||||
{
|
||||
"date_fin": "31/08/2022",
|
||||
"resp_can_edit": false,
|
||||
"dept_id": 1,
|
||||
"etat": true,
|
||||
"resp_can_change_ens": true,
|
||||
"id": 1,
|
||||
"modalite": "FI",
|
||||
"ens_can_edit_eval": false,
|
||||
"formation_id": 1,
|
||||
"gestion_compensation": false,
|
||||
"elt_sem_apo": null,
|
||||
"semestre_id": 1,
|
||||
"bul_hide_xml": false,
|
||||
"elt_annee_apo": null,
|
||||
"titre": "Semestre test",
|
||||
"block_moyennes": false,
|
||||
"scodoc7_id": null,
|
||||
"date_debut": "01/09/2021",
|
||||
"gestion_semestrielle": false,
|
||||
"bul_bgcolor": "white",
|
||||
"formsemestre_id": 1,
|
||||
"titre_num": "Semestre test semestre 1",
|
||||
"date_debut_iso": "2021-09-01",
|
||||
"date_fin_iso": "2022-08-31",
|
||||
"responsables": []
|
||||
}
|
||||
"""
|
||||
formsemestres = FormSemestre.query.filter(
|
||||
FormSemestreEtape.etape_apo == etape_apo,
|
||||
|
@ -121,13 +121,13 @@ def etud_in_group(group_id: int, etat=None):
|
||||
|
||||
|
||||
@bp.route(
|
||||
"/partitions/set_groups/partition/<int:partition_id>/groups/<string:groups_id>/delete/<string:groups_to_delete>"
|
||||
"/create/<string:groups_to_create>",
|
||||
"/partitions/set_groups?partition_id=<int:partition_id>&groups_lists=<int:groups_lists>&"
|
||||
"groups_to_create=<int:groups_to_create>&groups_to_delete=<int:groups_to_delete>",
|
||||
methods=["POST"],
|
||||
)
|
||||
@token_permission_required(Permission.APIEtudChangeGroups)
|
||||
def set_groups(
|
||||
partition_id: int, groups_lists: str, groups_to_delete: str, groups_to_create: str
|
||||
partition_id: int, groups_lists: int, groups_to_delete: int, groups_to_create: int
|
||||
):
|
||||
"""
|
||||
Set les groups
|
||||
|
@ -39,12 +39,4 @@ def get_dept_acronym(id):
|
||||
return dept.acronym
|
||||
|
||||
|
||||
@bp.app_template_filter()
|
||||
def get_civilité(civ):
|
||||
if civ == "H":
|
||||
return "Monsieur"
|
||||
else:
|
||||
return "Madame"
|
||||
|
||||
|
||||
from app.entreprises import routes
|
||||
|
@ -131,46 +131,38 @@ def send_email_notifications_entreprise(subject, entreprise: Entreprise):
|
||||
def verif_correspondant_data(correspondant_data):
|
||||
"""
|
||||
Verifie les données d'une ligne Excel (correspondant)
|
||||
correspondant_data[0]: civilite
|
||||
correspondant_data[1]: nom
|
||||
correspondant_data[2]: prenom
|
||||
correspondant_data[3]: telephone
|
||||
correspondant_data[4]: mail
|
||||
correspondant_data[5]: poste
|
||||
correspondant_data[6]: service
|
||||
correspondant_data[7]: origine
|
||||
correspondant_data[8]: notes
|
||||
correspondant_data[9]: entreprise_siret
|
||||
correspondant_data[0]: nom
|
||||
correspondant_data[1]: prenom
|
||||
correspondant_data[2]: telephone
|
||||
correspondant_data[3]: mail
|
||||
correspondant_data[4]: poste
|
||||
correspondant_data[5]: service
|
||||
correspondant_data[6]: entreprise_id
|
||||
"""
|
||||
# champs obligatoires
|
||||
if (
|
||||
correspondant_data[0].strip() == ""
|
||||
or correspondant_data[1].strip() == ""
|
||||
or correspondant_data[2].strip() == ""
|
||||
or correspondant_data[9].strip() == ""
|
||||
or correspondant_data[6].strip() == ""
|
||||
):
|
||||
return False
|
||||
|
||||
# civilite entre H ou F
|
||||
if correspondant_data[0].strip() not in ["H", "F"]:
|
||||
return False
|
||||
|
||||
# entreprise_id existant
|
||||
entreprise = Entreprise.query.filter_by(siret=correspondant_data[9].strip()).first()
|
||||
entreprise = Entreprise.query.filter_by(siret=correspondant_data[6].strip()).first()
|
||||
if entreprise is None:
|
||||
return False
|
||||
|
||||
# correspondant possède le meme nom et prénom dans la meme entreprise
|
||||
correspondant = EntrepriseCorrespondant.query.filter_by(
|
||||
nom=correspondant_data[1].strip(),
|
||||
prenom=correspondant_data[2].strip(),
|
||||
nom=correspondant_data[0].strip(),
|
||||
prenom=correspondant_data[1].strip(),
|
||||
entreprise_id=entreprise.id,
|
||||
).first()
|
||||
if correspondant is not None:
|
||||
return False
|
||||
|
||||
if (
|
||||
correspondant_data[3].strip() == "" and correspondant_data[4].strip() == ""
|
||||
correspondant_data[2].strip() == "" and correspondant_data[3].strip() == ""
|
||||
): # 1 moyen de contact
|
||||
return False
|
||||
|
||||
@ -190,7 +182,7 @@ def verif_entreprise_data(entreprise_data):
|
||||
if data.strip() == "":
|
||||
return False
|
||||
if EntreprisePreferences.get_check_siret():
|
||||
siret = entreprise_data[0].strip().replace(" ", "") # vérification sur le siret
|
||||
siret = entreprise_data[0].replace(" ", "") # vérification sur le siret
|
||||
if re.match("^\d{14}$", siret) is None:
|
||||
return False
|
||||
try:
|
||||
|
@ -80,11 +80,6 @@ class EntrepriseCreationForm(FlaskForm):
|
||||
ville = _build_string_field("Ville de l'entreprise (*)")
|
||||
pays = _build_string_field("Pays de l'entreprise", required=False)
|
||||
|
||||
civilite = SelectField(
|
||||
"Civilité du correspondant",
|
||||
choices=[("M", "Monsieur"), ("F", "Madame")],
|
||||
validators=[DataRequired(message=CHAMP_REQUIS)],
|
||||
)
|
||||
nom_correspondant = _build_string_field("Nom du correspondant", required=False)
|
||||
prenom_correspondant = _build_string_field(
|
||||
"Prénom du correspondant", required=False
|
||||
@ -96,8 +91,6 @@ class EntrepriseCreationForm(FlaskForm):
|
||||
)
|
||||
poste = _build_string_field("Poste du correspondant", required=False)
|
||||
service = _build_string_field("Service du correspondant", required=False)
|
||||
origine = _build_string_field("Origine du correspondant", required=False)
|
||||
notes = _build_string_field("Notes sur le correspondant", required=False)
|
||||
|
||||
submit = SubmitField("Envoyer", render_kw=SUBMIT_MARGE)
|
||||
|
||||
@ -113,8 +106,6 @@ class EntrepriseCreationForm(FlaskForm):
|
||||
or self.mail.data.strip()
|
||||
or self.poste.data.strip()
|
||||
or self.service.data.strip()
|
||||
or self.origine.data.strip()
|
||||
or self.notes.data.strip()
|
||||
):
|
||||
if not self.nom_correspondant.data.strip():
|
||||
self.nom_correspondant.errors.append("Ce champ est requis")
|
||||
@ -123,16 +114,19 @@ class EntrepriseCreationForm(FlaskForm):
|
||||
self.prenom_correspondant.errors.append("Ce champ est requis")
|
||||
validate = False
|
||||
if not self.telephone.data.strip() and not self.mail.data.strip():
|
||||
msg = "Saisir un moyen de contact (mail ou téléphone)"
|
||||
self.telephone.errors.append(msg)
|
||||
self.mail.errors.append(msg)
|
||||
self.telephone.errors.append(
|
||||
"Saisir un moyen de contact (mail ou téléphone)"
|
||||
)
|
||||
self.mail.errors.append(
|
||||
"Saisir un moyen de contact (mail ou téléphone)"
|
||||
)
|
||||
validate = False
|
||||
|
||||
return validate
|
||||
|
||||
def validate_siret(self, siret):
|
||||
if EntreprisePreferences.get_check_siret():
|
||||
siret_data = siret.data.strip().replace(" ", "")
|
||||
siret_data = siret.data.replace(" ", "")
|
||||
self.siret.data = siret_data
|
||||
if re.match("^\d{14}$", siret_data) is None:
|
||||
raise ValidationError("Format incorrect")
|
||||
@ -170,15 +164,6 @@ class EntrepriseModificationForm(FlaskForm):
|
||||
}
|
||||
|
||||
|
||||
class SiteCreationForm(FlaskForm):
|
||||
nom = _build_string_field("Nom du site (*)")
|
||||
adresse = _build_string_field("Adresse (*)")
|
||||
codepostal = _build_string_field("Code postal (*)")
|
||||
ville = _build_string_field("Ville (*)")
|
||||
pays = _build_string_field("Pays", required=False)
|
||||
submit = SubmitField("Envoyer", render_kw=SUBMIT_MARGE)
|
||||
|
||||
|
||||
class MultiCheckboxField(SelectMultipleField):
|
||||
widget = ListWidget(prefix_label=False)
|
||||
option_widget = CheckboxInput()
|
||||
@ -199,11 +184,11 @@ class OffreCreationForm(FlaskForm):
|
||||
"Missions (*)", validators=[DataRequired(message=CHAMP_REQUIS)]
|
||||
)
|
||||
duree = _build_string_field("Durée (*)")
|
||||
depts = MultiCheckboxField("Départements (*)", validators=[Optional()], coerce=int)
|
||||
depts = MultiCheckboxField("Départements", validators=[Optional()], coerce=int)
|
||||
expiration_date = DateField("Date expiration", validators=[Optional()])
|
||||
correspondant = SelectField("Correspondant à contacté", validators=[Optional()])
|
||||
fichier = FileField(
|
||||
"Fichier",
|
||||
"Fichier (*)",
|
||||
validators=[
|
||||
Optional(),
|
||||
FileAllowed(["pdf", "docx"], "Fichier .pdf ou .docx uniquement"),
|
||||
@ -252,7 +237,7 @@ class OffreModificationForm(FlaskForm):
|
||||
"Missions (*)", validators=[DataRequired(message=CHAMP_REQUIS)]
|
||||
)
|
||||
duree = _build_string_field("Durée (*)")
|
||||
depts = MultiCheckboxField("Départements (*)", validators=[Optional()], coerce=int)
|
||||
depts = MultiCheckboxField("Départements", validators=[Optional()], coerce=int)
|
||||
expiration_date = DateField("Date expiration", validators=[Optional()])
|
||||
correspondant = SelectField("Correspondant à contacté", validators=[Optional()])
|
||||
submit = SubmitField("Modifier", render_kw=SUBMIT_MARGE)
|
||||
@ -284,12 +269,6 @@ class OffreModificationForm(FlaskForm):
|
||||
|
||||
|
||||
class CorrespondantCreationForm(FlaskForm):
|
||||
civilite = SelectField(
|
||||
"Civilité (*)",
|
||||
choices=[("H", "Monsieur"), ("F", "Madame")],
|
||||
validators=[DataRequired(message=CHAMP_REQUIS)],
|
||||
render_kw={"class": "form-control"},
|
||||
)
|
||||
nom = _build_string_field("Nom (*)", render_kw={"class": "form-control"})
|
||||
prenom = _build_string_field("Prénom (*)", render_kw={"class": "form-control"})
|
||||
telephone = _build_string_field(
|
||||
@ -306,12 +285,14 @@ class CorrespondantCreationForm(FlaskForm):
|
||||
service = _build_string_field(
|
||||
"Service", required=False, render_kw={"class": "form-control"}
|
||||
)
|
||||
origine = _build_string_field(
|
||||
"Origine", required=False, render_kw={"class": "form-control"}
|
||||
)
|
||||
notes = _build_string_field(
|
||||
"Notes", required=False, render_kw={"class": "form-control"}
|
||||
)
|
||||
# depts = MultiCheckboxField("Départements", validators=[Optional()], coerce=int)
|
||||
|
||||
# def __init__(self, *args, **kwargs):
|
||||
# super().__init__(*args, **kwargs)
|
||||
|
||||
# self.depts.choices = [
|
||||
# (dept.id, dept.acronym) for dept in Departement.query.all()
|
||||
# ]
|
||||
|
||||
def validate(self):
|
||||
validate = True
|
||||
@ -319,9 +300,10 @@ class CorrespondantCreationForm(FlaskForm):
|
||||
validate = False
|
||||
|
||||
if not self.telephone.data and not self.mail.data:
|
||||
msg = "Saisir un moyen de contact (mail ou téléphone)"
|
||||
self.telephone.errors.append(msg)
|
||||
self.mail.errors.append(msg)
|
||||
self.telephone.errors.append(
|
||||
"Saisir un moyen de contact (mail ou téléphone)"
|
||||
)
|
||||
self.mail.errors.append("Saisir un moyen de contact (mail ou téléphone)")
|
||||
validate = False
|
||||
|
||||
return validate
|
||||
@ -339,7 +321,7 @@ class CorrespondantsCreationForm(FlaskForm):
|
||||
|
||||
correspondant_list = []
|
||||
for entry in self.correspondants.entries:
|
||||
if entry.nom.data and entry.prenom.data:
|
||||
if entry.nom.data.strip() and entry.prenom.data.strip():
|
||||
if (
|
||||
entry.nom.data.strip(),
|
||||
entry.prenom.data.strip(),
|
||||
@ -369,11 +351,6 @@ class CorrespondantsCreationForm(FlaskForm):
|
||||
class CorrespondantModificationForm(FlaskForm):
|
||||
hidden_correspondant_id = HiddenField()
|
||||
hidden_entreprise_id = HiddenField()
|
||||
civilite = SelectField(
|
||||
"Civilité (*)",
|
||||
choices=[("H", "Monsieur"), ("F", "Madame")],
|
||||
validators=[DataRequired(message=CHAMP_REQUIS)],
|
||||
)
|
||||
nom = _build_string_field("Nom (*)")
|
||||
prenom = _build_string_field("Prénom (*)")
|
||||
telephone = _build_string_field("Téléphone (*)", required=False)
|
||||
@ -383,10 +360,16 @@ class CorrespondantModificationForm(FlaskForm):
|
||||
)
|
||||
poste = _build_string_field("Poste", required=False)
|
||||
service = _build_string_field("Service", required=False)
|
||||
origine = _build_string_field("Origine", required=False)
|
||||
notes = _build_string_field("Notes", required=False)
|
||||
# depts = MultiCheckboxField("Départements", validators=[Optional()], coerce=int)
|
||||
submit = SubmitField("Modifier", render_kw=SUBMIT_MARGE)
|
||||
|
||||
# def __init__(self, *args, **kwargs):
|
||||
# super().__init__(*args, **kwargs)
|
||||
|
||||
# self.depts.choices = [
|
||||
# (dept.id, dept.acronym) for dept in Departement.query.all()
|
||||
# ]
|
||||
|
||||
def validate(self):
|
||||
validate = True
|
||||
if not FlaskForm.validate(self):
|
||||
@ -404,9 +387,10 @@ class CorrespondantModificationForm(FlaskForm):
|
||||
validate = False
|
||||
|
||||
if not self.telephone.data and not self.mail.data:
|
||||
msg = "Saisir un moyen de contact (mail ou téléphone)"
|
||||
self.telephone.errors.append(msg)
|
||||
self.mail.errors.append(msg)
|
||||
self.telephone.errors.append(
|
||||
"Saisir un moyen de contact (mail ou téléphone)"
|
||||
)
|
||||
self.mail.errors.append("Saisir un moyen de contact (mail ou téléphone)")
|
||||
validate = False
|
||||
|
||||
return validate
|
||||
@ -609,11 +593,6 @@ class SuppressionConfirmationForm(FlaskForm):
|
||||
submit = SubmitField("Supprimer", render_kw=SUBMIT_MARGE)
|
||||
|
||||
|
||||
class DesactivationConfirmationForm(FlaskForm):
|
||||
notes_active = TextAreaField("Notes sur la désactivation", validators=[Optional()])
|
||||
submit = SubmitField("Désactiver", render_kw=SUBMIT_MARGE)
|
||||
|
||||
|
||||
class ValidationConfirmationForm(FlaskForm):
|
||||
submit = SubmitField("Valider", render_kw=SUBMIT_MARGE)
|
||||
|
||||
|
@ -9,18 +9,14 @@ class Entreprise(db.Model):
|
||||
adresse = db.Column(db.Text)
|
||||
codepostal = db.Column(db.Text)
|
||||
ville = db.Column(db.Text)
|
||||
pays = db.Column(db.Text)
|
||||
pays = db.Column(db.Text, default="FRANCE")
|
||||
visible = db.Column(db.Boolean, default=False)
|
||||
active = db.Column(db.Boolean, default=True)
|
||||
notes_active = db.Column(db.Text)
|
||||
|
||||
sites = db.relationship(
|
||||
"EntrepriseSite",
|
||||
correspondants = db.relationship(
|
||||
"EntrepriseCorrespondant",
|
||||
backref="entreprise",
|
||||
lazy="dynamic",
|
||||
cascade="all, delete-orphan",
|
||||
)
|
||||
|
||||
offres = db.relationship(
|
||||
"EntrepriseOffre",
|
||||
backref="entreprise",
|
||||
@ -39,24 +35,13 @@ class Entreprise(db.Model):
|
||||
}
|
||||
|
||||
|
||||
class EntrepriseSite(db.Model):
|
||||
__tablename__ = "are_sites"
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
entreprise_id = db.Column(
|
||||
db.Integer, db.ForeignKey("are_entreprises.id", ondelete="cascade")
|
||||
)
|
||||
nom = db.Column(db.Text)
|
||||
adresse = db.Column(db.Text)
|
||||
codepostal = db.Column(db.Text)
|
||||
ville = db.Column(db.Text)
|
||||
pays = db.Column(db.Text)
|
||||
|
||||
correspondants = db.relationship(
|
||||
"EntrepriseCorrespondant",
|
||||
backref="site",
|
||||
lazy="dynamic",
|
||||
cascade="all, delete-orphan",
|
||||
)
|
||||
# class EntrepriseSite(db.Model):
|
||||
# __tablename__ = "are_sites"
|
||||
# id = db.Column(db.Integer, primary_key=True)
|
||||
# entreprise_id = db.Column(
|
||||
# db.Integer, db.ForeignKey("are_entreprises.id", ondelete="cascade")
|
||||
# )
|
||||
# nom = db.Column(db.Text)
|
||||
|
||||
|
||||
class EntrepriseCorrespondant(db.Model):
|
||||
@ -65,29 +50,23 @@ class EntrepriseCorrespondant(db.Model):
|
||||
entreprise_id = db.Column(
|
||||
db.Integer, db.ForeignKey("are_entreprises.id", ondelete="cascade")
|
||||
)
|
||||
site_id = db.Column(db.Integer, db.ForeignKey("are_sites.id", ondelete="cascade"))
|
||||
civilite = db.Column(db.String(1))
|
||||
# site_id = db.Column(db.Integer, db.ForeignKey("are_sites.id", ondelete="cascade"))
|
||||
nom = db.Column(db.Text)
|
||||
prenom = db.Column(db.Text)
|
||||
telephone = db.Column(db.Text)
|
||||
mail = db.Column(db.Text)
|
||||
poste = db.Column(db.Text)
|
||||
service = db.Column(db.Text)
|
||||
origine = db.Column(db.Text)
|
||||
notes = db.Column(db.Text)
|
||||
|
||||
def to_dict(self):
|
||||
entreprise = Entreprise.query.filter_by(id=self.entreprise_id).first()
|
||||
return {
|
||||
"civilite": self.civilite,
|
||||
"nom": self.nom,
|
||||
"prenom": self.prenom,
|
||||
"telephone": self.telephone,
|
||||
"mail": self.mail,
|
||||
"poste": self.poste,
|
||||
"service": self.service,
|
||||
"origine": self.origine,
|
||||
"notes": self.notes,
|
||||
"entreprise_siret": entreprise.siret,
|
||||
}
|
||||
|
||||
@ -182,6 +161,15 @@ class EntrepriseOffreDepartement(db.Model):
|
||||
dept_id = db.Column(db.Integer, db.ForeignKey("departement.id", ondelete="cascade"))
|
||||
|
||||
|
||||
# class EntrepriseCorrespondantDepartement(db.Model):
|
||||
# __tablename__ = "are_correspondant_departement"
|
||||
# id = db.Column(db.Integer, primary_key=True)
|
||||
# correspondant_id = db.Column(
|
||||
# db.Integer, db.ForeignKey("are_correspondants.id", ondelete="cascade")
|
||||
# )
|
||||
# dept_id = db.Column(db.Integer, db.ForeignKey("departement.id", ondelete="cascade"))
|
||||
|
||||
|
||||
class EntreprisePreferences(db.Model):
|
||||
__tablename__ = "are_preferences"
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
|
@ -13,10 +13,8 @@ from app.decorators import permission_required
|
||||
from app.entreprises import LOGS_LEN
|
||||
from app.entreprises.forms import (
|
||||
CorrespondantsCreationForm,
|
||||
DesactivationConfirmationForm,
|
||||
EntrepriseCreationForm,
|
||||
EntrepriseModificationForm,
|
||||
SiteCreationForm,
|
||||
SuppressionConfirmationForm,
|
||||
OffreCreationForm,
|
||||
OffreModificationForm,
|
||||
@ -38,7 +36,6 @@ from app.entreprises.models import (
|
||||
EntrepriseCorrespondant,
|
||||
EntrepriseLog,
|
||||
EntrepriseContact,
|
||||
EntrepriseSite,
|
||||
EntrepriseStageApprentissage,
|
||||
EntrepriseEnvoiOffre,
|
||||
EntrepriseOffreDepartement,
|
||||
@ -62,7 +59,7 @@ def index():
|
||||
"""
|
||||
Permet d'afficher une page avec la liste des entreprises (visible) et une liste des dernières opérations
|
||||
"""
|
||||
entreprises = Entreprise.query.filter_by(visible=True, active=True)
|
||||
entreprises = Entreprise.query.filter_by(visible=True)
|
||||
logs = EntrepriseLog.query.order_by(EntrepriseLog.date.desc()).limit(LOGS_LEN).all()
|
||||
return render_template(
|
||||
"entreprises/entreprises.html",
|
||||
@ -104,7 +101,7 @@ def validation():
|
||||
|
||||
|
||||
@bp.route("/correspondants", methods=["GET"])
|
||||
@permission_required(Permission.RelationsEntreprisesCorrespondants)
|
||||
@permission_required(Permission.RelationsEntreprisesView)
|
||||
def correspondants():
|
||||
"""
|
||||
Permet d'afficher une page avec la liste des correspondants des entreprises visibles et une liste des dernières opérations
|
||||
@ -112,7 +109,7 @@ def correspondants():
|
||||
correspondants = (
|
||||
db.session.query(EntrepriseCorrespondant, Entreprise)
|
||||
.join(Entreprise, EntrepriseCorrespondant.entreprise_id == Entreprise.id)
|
||||
.filter_by(visible=True, active=True)
|
||||
.filter_by(visible=True)
|
||||
)
|
||||
logs = EntrepriseLog.query.order_by(EntrepriseLog.date.desc()).limit(LOGS_LEN).all()
|
||||
return render_template(
|
||||
@ -132,9 +129,9 @@ def fiche_entreprise(id):
|
||||
La fiche entreprise comporte les informations de l'entreprise, les correspondants de l'entreprise et
|
||||
les offres de l'entreprise.
|
||||
"""
|
||||
entreprise = Entreprise.query.filter_by(
|
||||
id=id, visible=True, active=True
|
||||
).first_or_404(description=f"fiche entreprise {id} inconnue")
|
||||
entreprise = Entreprise.query.filter_by(id=id, visible=True).first_or_404(
|
||||
description=f"fiche entreprise {id} inconnue"
|
||||
)
|
||||
offres_with_files = []
|
||||
depts = are.get_depts()
|
||||
for offre in entreprise.offres:
|
||||
@ -148,7 +145,7 @@ def fiche_entreprise(id):
|
||||
offre_with_files = are.get_offre_files_and_depts(offre, depts)
|
||||
if offre_with_files is not None:
|
||||
offres_with_files.append(offre_with_files)
|
||||
sites = entreprise.sites[:]
|
||||
correspondants = entreprise.correspondants[:]
|
||||
logs = (
|
||||
EntrepriseLog.query.order_by(EntrepriseLog.date.desc())
|
||||
.filter_by(object=id)
|
||||
@ -166,7 +163,7 @@ def fiche_entreprise(id):
|
||||
"entreprises/fiche_entreprise.html",
|
||||
title="Fiche entreprise",
|
||||
entreprise=entreprise,
|
||||
sites=sites,
|
||||
correspondants=correspondants,
|
||||
offres=offres_with_files,
|
||||
logs=logs,
|
||||
stages_apprentissages=stages_apprentissages,
|
||||
@ -297,31 +294,16 @@ def add_entreprise():
|
||||
)
|
||||
db.session.add(entreprise)
|
||||
db.session.commit()
|
||||
db.session.refresh(entreprise)
|
||||
site = EntrepriseSite(
|
||||
entreprise_id=entreprise.id,
|
||||
nom=form.nom_entreprise.data.strip(),
|
||||
adresse=form.adresse.data.strip(),
|
||||
codepostal=form.codepostal.data.strip(),
|
||||
ville=form.ville.data.strip(),
|
||||
pays=form.pays.data.strip() if form.pays.data.strip() else "FRANCE",
|
||||
)
|
||||
db.session.add(site)
|
||||
db.session.commit()
|
||||
if form.nom_correspondant.data.strip():
|
||||
db.session.refresh(site)
|
||||
db.session.refresh(entreprise)
|
||||
correspondant = EntrepriseCorrespondant(
|
||||
entreprise_id=entreprise.id,
|
||||
site_id=site.id,
|
||||
civilite=form.civilite.data,
|
||||
nom=form.nom_correspondant.data.strip(),
|
||||
prenom=form.prenom_correspondant.data.strip(),
|
||||
telephone=form.telephone.data.strip(),
|
||||
mail=form.mail.data.strip(),
|
||||
poste=form.poste.data.strip(),
|
||||
service=form.service.data.strip(),
|
||||
origine=form.origine.data.strip(),
|
||||
notes=form.notes.data.strip(),
|
||||
)
|
||||
db.session.add(correspondant)
|
||||
if current_user.has_permission(Permission.RelationsEntreprisesValidate, None):
|
||||
@ -422,27 +404,39 @@ def edit_entreprise(id):
|
||||
)
|
||||
|
||||
|
||||
@bp.route("/fiche_entreprise/desactiver/<int:id>", methods=["GET", "POST"])
|
||||
@bp.route("/fiche_entreprise/delete_entreprise/<int:id>", methods=["GET", "POST"])
|
||||
@permission_required(Permission.RelationsEntreprisesChange)
|
||||
def fiche_entreprise_desactiver(id):
|
||||
def delete_entreprise(id):
|
||||
"""
|
||||
Permet de désactiver une entreprise
|
||||
Permet de supprimer une entreprise de la base avec un formulaire de confirmation
|
||||
"""
|
||||
entreprise = Entreprise.query.filter_by(id=id, visible=True).first_or_404(
|
||||
description=f"entreprise {id} inconnue"
|
||||
)
|
||||
form = DesactivationConfirmationForm()
|
||||
form = SuppressionConfirmationForm()
|
||||
if form.validate_on_submit():
|
||||
entreprise.notes_active = form.notes_active.data.strip()
|
||||
entreprise.active = False
|
||||
db.session.delete(entreprise)
|
||||
# supprime les fichiers attachés aux offres
|
||||
path = os.path.join(
|
||||
Config.SCODOC_VAR_DIR,
|
||||
"entreprises",
|
||||
f"{entreprise.id}",
|
||||
)
|
||||
if os.path.isdir(path):
|
||||
shutil.rmtree(path)
|
||||
log = EntrepriseLog(
|
||||
authenticated_user=current_user.user_name,
|
||||
object=entreprise.id,
|
||||
text=f"Suppression de la fiche entreprise ({entreprise.nom})",
|
||||
)
|
||||
db.session.add(log)
|
||||
db.session.commit()
|
||||
flash("L'entreprise a été désactivé.")
|
||||
flash("L'entreprise a été supprimé de la liste.")
|
||||
return redirect(url_for("entreprises.index"))
|
||||
return render_template(
|
||||
"entreprises/confirmation_form.html",
|
||||
title="Désactiver entreprise",
|
||||
"entreprises/delete_confirmation.html",
|
||||
title="Supression entreprise",
|
||||
form=form,
|
||||
info_message="Cliquez sur le bouton Désactiver pour confirmer la désactivation",
|
||||
)
|
||||
|
||||
|
||||
@ -495,10 +489,9 @@ def delete_validation_entreprise(id):
|
||||
flash("L'entreprise a été supprimé de la liste des entreprise à valider.")
|
||||
return redirect(url_for("entreprises.validation"))
|
||||
return render_template(
|
||||
"entreprises/confirmation_form.html",
|
||||
"entreprises/delete_confirmation.html",
|
||||
title="Supression entreprise",
|
||||
form=form,
|
||||
info_message="Cliquez sur le bouton Supprimer pour confirmer votre supression",
|
||||
)
|
||||
|
||||
|
||||
@ -652,10 +645,9 @@ def delete_offre(id):
|
||||
flash("L'offre a été supprimé de la fiche entreprise.")
|
||||
return redirect(url_for("entreprises.fiche_entreprise", id=entreprise_id))
|
||||
return render_template(
|
||||
"entreprises/confirmation_form.html",
|
||||
"entreprises/delete_confirmation.html",
|
||||
title="Supression offre",
|
||||
form=form,
|
||||
info_message="Cliquez sur le bouton Supprimer pour confirmer votre supression",
|
||||
)
|
||||
|
||||
|
||||
@ -691,66 +683,26 @@ def expired(id):
|
||||
return redirect(url_for("entreprises.fiche_entreprise", id=offre.entreprise_id))
|
||||
|
||||
|
||||
@bp.route(
|
||||
"/fiche_entreprise/<int:id>/add_site",
|
||||
methods=["GET", "POST"],
|
||||
)
|
||||
@bp.route("/fiche_entreprise/<int:id>/add_correspondant", methods=["GET", "POST"])
|
||||
@permission_required(Permission.RelationsEntreprisesChange)
|
||||
def add_site(id):
|
||||
entreprise = Entreprise.query.filter_by(id=id, visible=True).first_or_404(
|
||||
description=f"entreprise {id} inconnue"
|
||||
)
|
||||
form = SiteCreationForm()
|
||||
if form.validate_on_submit():
|
||||
site = EntrepriseSite(
|
||||
entreprise_id=entreprise.id,
|
||||
nom=form.nom.data.strip(),
|
||||
adresse=form.adresse.data.strip(),
|
||||
codepostal=form.codepostal.data.strip(),
|
||||
ville=form.ville.data.strip(),
|
||||
pays=form.pays.data.strip() if form.pays.data.strip() else "FRANCE",
|
||||
)
|
||||
db.session.add(site)
|
||||
db.session.commit()
|
||||
flash("Le site a été créé et ajouté à la fiche entreprise")
|
||||
return redirect(url_for("entreprises.fiche_entreprise", id=entreprise.id))
|
||||
return render_template(
|
||||
"entreprises/form.html",
|
||||
title="Ajout site",
|
||||
form=form,
|
||||
)
|
||||
|
||||
|
||||
@bp.route(
|
||||
"/fiche_entreprise/<int:id_entreprise>/add_correspondant/<int:id_site>",
|
||||
methods=["GET", "POST"],
|
||||
)
|
||||
@permission_required(Permission.RelationsEntreprisesChange)
|
||||
def add_correspondant(id_entreprise, id_site):
|
||||
def add_correspondant(id):
|
||||
"""
|
||||
Permet d'ajouter un correspondant a une entreprise
|
||||
"""
|
||||
entreprise = Entreprise.query.filter_by(
|
||||
id=id_entreprise, visible=True
|
||||
).first_or_404(description=f"entreprise {id_entreprise} inconnue")
|
||||
site = EntrepriseSite.query.filter_by(id=id_site).first_or_404(
|
||||
description=f"site {id_site} inconnue"
|
||||
entreprise = Entreprise.query.filter_by(id=id, visible=True).first_or_404(
|
||||
description=f"entreprise {id} inconnue"
|
||||
)
|
||||
form = CorrespondantsCreationForm(hidden_entreprise_id=entreprise.id)
|
||||
if form.validate_on_submit():
|
||||
for correspondant_entry in form.correspondants.entries:
|
||||
correspondant = EntrepriseCorrespondant(
|
||||
entreprise_id=entreprise.id,
|
||||
site_id=site.id,
|
||||
civilite=correspondant_entry.civilite.data,
|
||||
nom=correspondant_entry.nom.data.strip(),
|
||||
prenom=correspondant_entry.prenom.data.strip(),
|
||||
telephone=correspondant_entry.telephone.data.strip(),
|
||||
mail=correspondant_entry.mail.data.strip(),
|
||||
poste=correspondant_entry.poste.data.strip(),
|
||||
service=correspondant_entry.service.data.strip(),
|
||||
origine=correspondant_entry.origine.data.strip(),
|
||||
notes=correspondant_entry.notes.data.strip(),
|
||||
)
|
||||
log = EntrepriseLog(
|
||||
authenticated_user=current_user.user_name,
|
||||
@ -783,15 +735,12 @@ def edit_correspondant(id):
|
||||
hidden_correspondant_id=correspondant.id,
|
||||
)
|
||||
if form.validate_on_submit():
|
||||
correspondant.civilite = form.civilite.data
|
||||
correspondant.nom = form.nom.data.strip()
|
||||
correspondant.prenom = form.prenom.data.strip()
|
||||
correspondant.telephone = form.telephone.data.strip()
|
||||
correspondant.mail = form.mail.data.strip()
|
||||
correspondant.poste = form.poste.data.strip()
|
||||
correspondant.service = form.service.data.strip()
|
||||
correspondant.origine = form.origine.data.strip()
|
||||
correspondant.notes = form.notes.data.strip()
|
||||
log = EntrepriseLog(
|
||||
authenticated_user=current_user.user_name,
|
||||
object=correspondant.entreprise_id,
|
||||
@ -801,18 +750,15 @@ def edit_correspondant(id):
|
||||
db.session.commit()
|
||||
flash("Le correspondant a été modifié.")
|
||||
return redirect(
|
||||
url_for("entreprises.fiche_entreprise", id=correspondant.entreprise_id)
|
||||
url_for("entreprises.fiche_entreprise", id=correspondant.entreprise.id)
|
||||
)
|
||||
elif request.method == "GET":
|
||||
form.civilite.data = correspondant.civilite
|
||||
form.nom.data = correspondant.nom
|
||||
form.prenom.data = correspondant.prenom
|
||||
form.telephone.data = correspondant.telephone
|
||||
form.mail.data = correspondant.mail
|
||||
form.poste.data = correspondant.poste
|
||||
form.service.data = correspondant.service
|
||||
form.origine.data = correspondant.origine
|
||||
form.notes.data = correspondant.notes
|
||||
return render_template(
|
||||
"entreprises/form.html",
|
||||
title="Modification correspondant",
|
||||
@ -844,10 +790,9 @@ def delete_correspondant(id):
|
||||
url_for("entreprises.fiche_entreprise", id=correspondant.entreprise_id)
|
||||
)
|
||||
return render_template(
|
||||
"entreprises/confirmation_form.html",
|
||||
"entreprises/delete_confirmation.html",
|
||||
title="Supression correspondant",
|
||||
form=form,
|
||||
info_message="Cliquez sur le bouton Supprimer pour confirmer votre supression",
|
||||
)
|
||||
|
||||
|
||||
@ -1071,10 +1016,9 @@ def delete_stage_apprentissage(id):
|
||||
)
|
||||
)
|
||||
return render_template(
|
||||
"entreprises/confirmation_form.html",
|
||||
"entreprises/delete_confirmation.html",
|
||||
title="Supression stage/apprentissage",
|
||||
form=form,
|
||||
info_message="Cliquez sur le bouton Supprimer pour confirmer votre supression",
|
||||
)
|
||||
|
||||
|
||||
@ -1299,15 +1243,12 @@ def export_correspondants():
|
||||
)
|
||||
if correspondants:
|
||||
keys = [
|
||||
"civilite",
|
||||
"nom",
|
||||
"prenom",
|
||||
"telephone",
|
||||
"mail",
|
||||
"poste",
|
||||
"service",
|
||||
"origine",
|
||||
"notes",
|
||||
"entreprise_siret",
|
||||
]
|
||||
titles = keys[:]
|
||||
@ -1331,15 +1272,12 @@ def get_import_correspondants_file_sample():
|
||||
Permet de récupérer un fichier exemple vide pour pouvoir importer des correspondants
|
||||
"""
|
||||
keys = [
|
||||
"civilite",
|
||||
"nom",
|
||||
"prenom",
|
||||
"telephone",
|
||||
"mail",
|
||||
"poste",
|
||||
"service",
|
||||
"origine",
|
||||
"notes",
|
||||
"entreprise_siret",
|
||||
]
|
||||
titles = keys[:]
|
||||
@ -1368,15 +1306,12 @@ def import_correspondants():
|
||||
correspondant_list = []
|
||||
ligne = 0
|
||||
titles = [
|
||||
"civilite",
|
||||
"nom",
|
||||
"prenom",
|
||||
"telephone",
|
||||
"mail",
|
||||
"poste",
|
||||
"service",
|
||||
"origine",
|
||||
"notes",
|
||||
"entreprise_siret",
|
||||
]
|
||||
if data[1][0] != titles:
|
||||
@ -1391,32 +1326,29 @@ def import_correspondants():
|
||||
if (
|
||||
are.verif_correspondant_data(correspondant_data)
|
||||
and (
|
||||
correspondant_data[0].strip(),
|
||||
correspondant_data[1].strip(),
|
||||
correspondant_data[2].strip(),
|
||||
correspondant_data[9].strip(),
|
||||
correspondant_data[6].strip(),
|
||||
)
|
||||
not in correspondant_list
|
||||
):
|
||||
correspondant_list.append(
|
||||
(
|
||||
correspondant_data[0].strip(),
|
||||
correspondant_data[1].strip(),
|
||||
correspondant_data[2].strip(),
|
||||
correspondant_data[9].strip(),
|
||||
correspondant_data[6].strip(),
|
||||
)
|
||||
)
|
||||
entreprise = Entreprise.query.filter_by(
|
||||
siret=correspondant_data[9].strip()
|
||||
siret=correspondant_data[6].strip()
|
||||
).first()
|
||||
correspondant = EntrepriseCorrespondant(
|
||||
civilite=correspondant_data[0].strip(),
|
||||
nom=correspondant_data[1].strip(),
|
||||
prenom=correspondant_data[2].strip(),
|
||||
telephone=correspondant_data[3].strip(),
|
||||
mail=correspondant_data[4].strip(),
|
||||
poste=correspondant_data[5].strip(),
|
||||
service=correspondant_data[6].strip(),
|
||||
origine=correspondant_data[7].strip(),
|
||||
notes=correspondant_data[8].strip(),
|
||||
nom=correspondant_data[0].strip(),
|
||||
prenom=correspondant_data[1].strip(),
|
||||
telephone=correspondant_data[2].strip(),
|
||||
mail=correspondant_data[3].strip(),
|
||||
poste=correspondant_data[4].strip(),
|
||||
service=correspondant_data[5].strip(),
|
||||
entreprise_id=entreprise.id,
|
||||
)
|
||||
correspondants_import.append(correspondant)
|
||||
@ -1548,10 +1480,9 @@ def delete_offre_file(offre_id, filedir):
|
||||
url_for("entreprises.fiche_entreprise", id=offre.entreprise_id)
|
||||
)
|
||||
return render_template(
|
||||
"entreprises/confirmation_form.html",
|
||||
"entreprises/delete_confirmation.html",
|
||||
title="Suppression fichier d'une offre",
|
||||
form=form,
|
||||
info_message="Cliquez sur le bouton Supprimer pour confirmer votre supression",
|
||||
)
|
||||
|
||||
|
||||
|
@ -141,18 +141,7 @@ class Identite(db.Model):
|
||||
"Le mail associé à la première adrese de l'étudiant, ou None"
|
||||
return getattr(self.adresses[0], field) if self.adresses.count() > 0 else None
|
||||
|
||||
def to_dict_short(self) -> dict:
|
||||
"""Les champs essentiels"""
|
||||
return {
|
||||
"id": self.id,
|
||||
"nip": self.code_nip,
|
||||
"nom": self.nom,
|
||||
"nom_usuel": self.nom_usuel,
|
||||
"prenom": self.prenom,
|
||||
"civilite": self.civilite,
|
||||
}
|
||||
|
||||
def to_dict_scodoc7(self) -> dict:
|
||||
def to_dict_scodoc7(self):
|
||||
"""Représentation dictionnaire,
|
||||
compatible ScoDoc7 mais sans infos admission
|
||||
"""
|
||||
|
@ -423,19 +423,17 @@ def list_abs_date(etudid, beg_date=None, end_date=None):
|
||||
print("On rentre")
|
||||
cnx = ndb.GetDBConnexion()
|
||||
cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor)
|
||||
print("Juste avant le SQL")
|
||||
|
||||
req = """SELECT jour, matin, estabs, estjust, description
|
||||
FROM ABSENCES A
|
||||
WHERE A.ETUDID = %(etudid)s""" + (
|
||||
""
|
||||
cursor.execute(
|
||||
"""SELECT jour, matin, estabs, estjust, description FROM ABSENCES A
|
||||
WHERE A.ETUDID = %(etudid)s"""
|
||||
+ ""
|
||||
if beg_date is None
|
||||
else """
|
||||
AND A.jour >= %(beg_date)s
|
||||
AND A.jour <= %(end_date)s
|
||||
"""
|
||||
)
|
||||
cursor.execute(
|
||||
req,
|
||||
""",
|
||||
vars(),
|
||||
)
|
||||
|
||||
|
@ -47,7 +47,6 @@ _SCO_PERMISSIONS = (
|
||||
),
|
||||
(1 << 25, "RelationsEntreprisesSend", "Envoyer des offres"),
|
||||
(1 << 26, "RelationsEntreprisesValidate", "Valide les entreprises"),
|
||||
(1 << 27, "RelationsEntreprisesCorrespondants", "Voir les correspondants"),
|
||||
# 27 à 39 ... réservé pour "entreprises"
|
||||
# Api scodoc9
|
||||
(1 << 40, "APIView", "Voir"),
|
||||
|
@ -63,11 +63,7 @@ SCO_ROLES_DEFAULTS = {
|
||||
# ObservateurEntreprise est un observateur de l'application entreprise
|
||||
"ObservateurEntreprise": (p.RelationsEntreprisesView,),
|
||||
# UtilisateurEntreprise est un utilisateur de l'application entreprise (droit de modification)
|
||||
"UtilisateurEntreprise": (
|
||||
p.RelationsEntreprisesView,
|
||||
p.RelationsEntreprisesChange,
|
||||
p.RelationsEntreprisesCorrespondants,
|
||||
),
|
||||
"UtilisateurEntreprise": (p.RelationsEntreprisesView, p.RelationsEntreprisesChange),
|
||||
# AdminEntreprise est un admin de l'application entreprise (toutes les actions possibles de l'application)
|
||||
"AdminEntreprise": (
|
||||
p.RelationsEntreprisesView,
|
||||
@ -75,7 +71,6 @@ SCO_ROLES_DEFAULTS = {
|
||||
p.RelationsEntreprisesExport,
|
||||
p.RelationsEntreprisesSend,
|
||||
p.RelationsEntreprisesValidate,
|
||||
p.RelationsEntreprisesCorrespondants,
|
||||
),
|
||||
# LecteurAPI peut utiliser l'API en lecture
|
||||
"LecteurAPI": (p.APIView,),
|
||||
|
@ -40,11 +40,6 @@
|
||||
*background-color: #151515;
|
||||
}
|
||||
|
||||
.btn-remove {
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.fiche-entreprise .btn {
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
@ -59,24 +54,23 @@
|
||||
margin-bottom: -5px;
|
||||
}
|
||||
|
||||
.entreprise, .correspondant, .offre, .site{
|
||||
.entreprise, .correspondant, .offre {
|
||||
border: solid 2px;
|
||||
border-radius: 10px;
|
||||
padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.sites-et-offres {
|
||||
.correspondants-et-offres {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.sites-et-offres > div {
|
||||
.correspondants-et-offres > div {
|
||||
flex: 1 0 0;
|
||||
}
|
||||
|
||||
.sites-et-offres > div:nth-child(2) {
|
||||
.correspondants-et-offres > div:nth-child(2) {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
{# -*- mode: jinja-html -*- #}
|
||||
<div class="correspondant">
|
||||
<div>
|
||||
Civilité : {{ correspondant.civilite|get_civilité }}<br>
|
||||
Nom : {{ correspondant.nom }}<br>
|
||||
Prénom : {{ correspondant.prenom }}<br>
|
||||
{% if correspondant.telephone %}
|
||||
@ -16,12 +15,6 @@
|
||||
{% if correspondant.service %}
|
||||
Service : {{ correspondant.service }}<br>
|
||||
{% endif %}
|
||||
{% if correspondant.origine %}
|
||||
Origine : {{ correspondant.origine }}<br>
|
||||
{% endif %}
|
||||
{% if correspondant.notes %}
|
||||
Notes : {{ correspondant.notes }}<br>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesChange, None) %}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{# -*- mode: jinja-html -*- #}
|
||||
<div class="offre">
|
||||
<div style="word-break:break-all; text-align: justify;">
|
||||
<div>
|
||||
Ajouté le {{ offre[0].date_ajout.strftime('%d/%m/%y') }} à {{ offre[0].date_ajout.strftime('%Hh%M') }}<br>
|
||||
Intitulé : {{ offre[0].intitule }}<br>
|
||||
Description : {{ offre[0].description }}<br>
|
||||
|
@ -35,14 +35,6 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let allCorrepondantsFieldWrapper = document.getElementById('correspondants');
|
||||
let allCorrepondantsForm = allCorrepondantsFieldWrapper.getElementsByTagName('li');
|
||||
for(let i = 0; i < allCorrepondantsForm.length; i++) {
|
||||
let form_id = allCorrepondantsForm[i].getElementsByTagName('table')[0].id
|
||||
if(form_id.split('-')[1] != 0)
|
||||
allCorrepondantsForm[i].insertAdjacentHTML('beforeend', `<div class="btn btn-default btn-remove" onclick="deleteForm('${form_id}')">Retirer ce correspondant</div>`)
|
||||
}
|
||||
|
||||
window.onload = function(e) {
|
||||
let addCorrespondantFieldBtn = document.getElementById('add-correspondant-field');
|
||||
addCorrespondantFieldBtn.addEventListener('click', function(e){
|
||||
@ -56,16 +48,9 @@
|
||||
}
|
||||
let newFieldName = `correspondants-${Math.max(...correspondantInputIds) + 1}`;
|
||||
allCorrepondantsFieldWrapper.insertAdjacentHTML('beforeend',`
|
||||
<li><label for="${newFieldName}">Correspondants-${Math.max(...correspondantInputIds) + 1}</label><table id="${newFieldName}"><tr><th><label for="${newFieldName}-civilite">Civilité (*)</label></th><td><select class="form-control" id="${newFieldName}-civilite" name="${newFieldName}-civilite" required><option value="H">Monsieur</option><option value="F">Madame</option></select></td></tr><tr><th><label for="${newFieldName}-nom">Nom (*)</label></th><td><input class="form-control" id="${newFieldName}-nom" name="${newFieldName}-nom" required type="text" value=""></td></tr><tr><th><label for="${newFieldName}-prenom">Prénom (*)</label></th><td><input class="form-control" id="${newFieldName}-prenom" name="${newFieldName}-prenom" required type="text" value=""></td></tr><tr><th><label for="${newFieldName}-telephone">Téléphone (*)</label></th><td><input class="form-control" id="${newFieldName}-telephone" name="${newFieldName}-telephone" type="text" value=""></td></tr><tr><th><label for="${newFieldName}-mail">Mail (*)</label></th><td><input class="form-control" id="${newFieldName}-mail" name="${newFieldName}-mail" type="text" value=""></td></tr><tr><th><label for="${newFieldName}-poste">Poste</label></th><td><input class="form-control" id="${newFieldName}-poste" name="${newFieldName}-poste" type="text" value=""></td></tr><tr><th><label for="${newFieldName}-service">Service</label></th><td><input class="form-control" id="${newFieldName}-service" name="${newFieldName}-service" type="text" value=""></td></tr><tr><th><label for="${newFieldName}-origine">Origine</label></th><td><input class="form-control" id="${newFieldName}-origine" name="${newFieldName}-origine" type="text" value=""></td></tr><tr><th><label for="${newFieldName}-notes">Notes</label></th><td><input class="form-control" id="${newFieldName}-notes" name="${newFieldName}-notes" type="text" value=""></td></tr></table><input id="${newFieldName}-csrf_token" name="${newFieldName}-csrf_token" type="hidden" value=${csrf_token}><div class="btn btn-default btn-remove" onclick="deleteForm('${newFieldName}')">Retirer ce correspondant</div></li>
|
||||
<li><label for="${newFieldName}">Correspondants-${Math.max(...correspondantInputIds) + 1}</label> <table id="${newFieldName}"><tr><th><label for="${newFieldName}-nom">Nom (*)</label></th><td><input class="form-control" id="${newFieldName}-nom" name="${newFieldName}-nom" required type="text" value=""></td></tr><tr><th><label for="${newFieldName}-prenom">Prénom (*)</label></th><td><input class="form-control" id="${newFieldName}-prenom" name="${newFieldName}-prenom" required type="text" value=""></td></tr><tr><th><label for="${newFieldName}-telephone">Téléphone (*)</label></th><td><input class="form-control" id="${newFieldName}-telephone" name="${newFieldName}-telephone" type="text" value=""></td></tr><tr><th><label for="${newFieldName}-mail">Mail (*)</label></th><td><input class="form-control" id="${newFieldName}-mail" name="${newFieldName}-mail" type="text" value=""></td></tr><tr><th><label for="${newFieldName}-poste">Poste</label></th><td><input class="form-control" id="${newFieldName}-poste" name="${newFieldName}-poste" type="text" value=""></td></tr><tr><th><label for="${newFieldName}-service">Service</label></th><td><input class="form-control" id="${newFieldName}-service" name="${newFieldName}-service" type="text" value=""></td></tr></table><input id="${newFieldName}-csrf_token" name="${newFieldName}-csrf_token" type="hidden" value=${csrf_token}></li>
|
||||
`);
|
||||
});
|
||||
}
|
||||
|
||||
function deleteForm(x) {
|
||||
var li_form = document.querySelector(`label[for=${x}]`).closest('li');
|
||||
if (li_form) {
|
||||
li_form.remove()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
@ -5,7 +5,7 @@
|
||||
{% block app_content %}
|
||||
<h1>{{ title }}</h1>
|
||||
<br>
|
||||
<div style="color:red;">{{ info_message }}</div>
|
||||
<div style="color:red;">Cliquez sur le bouton Supprimer pour confirmer votre supression</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
@ -67,7 +67,7 @@
|
||||
</a>
|
||||
<ul class="dropdown-menu pull-left">
|
||||
<li><a href="{{ url_for('entreprises.edit_entreprise', id=entreprise.id) }}">Modifier</a></li>
|
||||
<li><a href="{{ url_for('entreprises.fiche_entreprise_desactiver', id=entreprise.id)}}" style="color:red">Désactiver</a></li>
|
||||
<li><a href="{{ url_for('entreprises.delete_entreprise', id=entreprise.id) }}" style="color:red">Supprimer</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
|
@ -36,14 +36,6 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let allResponsablesFieldWrapper = document.getElementById('responsables');
|
||||
let allResponsablesField = allResponsablesFieldWrapper.getElementsByTagName('li');
|
||||
for(let i = 0; i < allResponsablesField.length; i++) {
|
||||
let form_id = allResponsablesField[i].getElementsByTagName('input')[0].id
|
||||
if(form_id.split('-')[1] != 0)
|
||||
allResponsablesField[i].insertAdjacentHTML('beforeend', `<div class="btn btn-default btn-remove" onclick="deleteForm('${form_id}')">Retirer</div>`)
|
||||
}
|
||||
|
||||
window.onload = function(e) {
|
||||
var responsables_options = {
|
||||
script: "/ScoDoc/entreprises/responsables?",
|
||||
@ -71,17 +63,10 @@
|
||||
}
|
||||
let newFieldName = `responsables-${Math.max(...responsableInputIds) + 1}`;
|
||||
allResponsablesFieldWrapper.insertAdjacentHTML('beforeend',`
|
||||
<li><label for="${newFieldName}">Responsable (*)</label><input class="form-control" id="${newFieldName}" name="${newFieldName}" type="text" value="" placeholder="Tapez le nom du responsable de formation"><div class="btn btn-default btn-remove" onclick="deleteForm('${newFieldName}')">Retirer</div></li>
|
||||
<li><label for="${newFieldName}">Responsable (*)</label> <input class="form-control" id="${newFieldName}" name="${newFieldName}" type="text" value="" placeholder="Tapez le nom du responsable de formation"></li>
|
||||
`);
|
||||
var as_r = new bsn.AutoSuggest(newFieldName, responsables_options);
|
||||
});
|
||||
}
|
||||
|
||||
function deleteForm(x) {
|
||||
var li_form = document.querySelector(`label[for=${x}]`).closest('li');
|
||||
if (li_form) {
|
||||
li_form.remove()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
@ -37,38 +37,24 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesChange, None) %}
|
||||
<div>
|
||||
<a class="btn btn-primary" href="{{ url_for('entreprises.edit_entreprise', id=entreprise.id) }}">Modifier</a>
|
||||
<a class="btn btn-danger" href="{{ url_for('entreprises.fiche_entreprise_desactiver', id=entreprise.id) }}">Désactiver</a>
|
||||
<a class="btn btn-primary" href="{{ url_for('entreprises.add_site', id=entreprise.id) }}">Ajouter site</a>
|
||||
<a class="btn btn-danger" href="{{ url_for('entreprises.delete_entreprise', id=entreprise.id) }}">Supprimer</a>
|
||||
<a class="btn btn-primary" href="{{ url_for('entreprises.add_offre', id=entreprise.id) }}">Ajouter offre</a>
|
||||
<a class="btn btn-primary" href="{{ url_for('entreprises.add_correspondant', id=entreprise.id) }}">Ajouter correspondant</a>
|
||||
{% endif %}
|
||||
<a class="btn btn-primary" href="{{ url_for('entreprises.contacts', id=entreprise.id) }}">Liste contacts</a>
|
||||
<a class="btn btn-primary" href="{{ url_for('entreprises.offres_expirees', id=entreprise.id) }}">Voir les offres expirées</a>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
|
||||
<div class="sites-et-offres">
|
||||
{% if sites %}
|
||||
<div class="correspondants-et-offres">
|
||||
{% if correspondants %}
|
||||
<div>
|
||||
<h3>Sites</h3>
|
||||
{% for site in sites %}
|
||||
<div class="site">
|
||||
Nom : {{ site.nom }}<br>
|
||||
Adresse : {{ site.adresse }}<br>
|
||||
Code postal : {{ site.codepostal }}<br>
|
||||
Ville : {{ site.ville }}<br>
|
||||
Pays : {{ site.pays }}
|
||||
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesChange, None) %}
|
||||
<br><a class="btn btn-primary" href="{{ url_for('entreprises.add_correspondant', id_entreprise=entreprise.id, id_site=site.id) }}">Ajouter correspondant</a>
|
||||
{% endif %}
|
||||
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesCorrespondants, None) %}
|
||||
{% for correspondant in site.correspondants %}
|
||||
{% include 'entreprises/_correspondant.html' %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<h3>Correspondants</h3>
|
||||
{% for correspondant in correspondants %}
|
||||
{% include 'entreprises/_correspondant.html' %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
@ -77,7 +63,7 @@
|
||||
<div>
|
||||
<h3>Offres - <a href="{{ url_for('entreprises.offres_expirees', id=entreprise.id) }}">Voir les offres expirées</a></h3>
|
||||
{% for offre in offres %}
|
||||
{% include 'entreprises/_offre.html' %}
|
||||
{% include 'entreprises/_offre.html' %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
@ -85,20 +71,20 @@
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 10px;">
|
||||
<h3>Liste des stages et apprentissages réalisés au sein de l'entreprise</h3>
|
||||
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesChange, None) %}
|
||||
<a class="btn btn-primary" href="{{ url_for('entreprises.add_stage_apprentissage', id=entreprise.id) }}" style="margin-bottom:10px;">Ajouter stage ou apprentissage</a>
|
||||
<a class="btn btn-primary" href="{{ url_for('entreprises.add_stage_apprentissage', id=entreprise.id) }}">Ajouter stage ou apprentissage</a>
|
||||
{% endif %}
|
||||
<h3>Liste des stages et apprentissages réalisés au sein de l'entreprise</h3>
|
||||
<table id="table-stages-apprentissages">
|
||||
<thead>
|
||||
<tr>
|
||||
<td data-priority="3">Date début</td>
|
||||
<td data-priority="4">Date fin</td>
|
||||
<td data-priority="5">Durée</td>
|
||||
<td data-priority="2">Type</td>
|
||||
<td data-priority="1">Étudiant</td>
|
||||
<td data-priority="6">Formation</td>
|
||||
<td data-priority="7">Notes</td>
|
||||
<td data-priority="">Date début</td>
|
||||
<td data-priority="">Date fin</td>
|
||||
<td data-priority="">Durée</td>
|
||||
<td data-priority="">Type</td>
|
||||
<td data-priority="">Étudiant</td>
|
||||
<td data-priority="">Formation</td>
|
||||
<td data-priority="">Notes</td>
|
||||
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesChange, None) %}
|
||||
<td data-priority="3">Action</td>
|
||||
{% endif %}
|
||||
|
@ -23,15 +23,15 @@
|
||||
<script>
|
||||
{# pour les formulaires offre #}
|
||||
var champ_depts = document.getElementById("depts")
|
||||
if (champ_depts) {
|
||||
if (champ_depts !== null) {
|
||||
var closest_form_control = champ_depts.closest(".form-control")
|
||||
closest_form_control.classList.remove("form-control")
|
||||
}
|
||||
|
||||
if(document.getElementById("expiration_date") && document.getElementById("expiration_date").value === "")
|
||||
if(document.getElementById("expiration_date") !== null && document.getElementById("expiration_date").value === "")
|
||||
expiration()
|
||||
|
||||
if(document.getElementById("type_offre"))
|
||||
if(document.getElementById("type_offre") !== null)
|
||||
document.getElementById("type_offre").addEventListener("change", expiration);
|
||||
|
||||
function expiration() {
|
||||
|
@ -25,16 +25,13 @@
|
||||
{% if not correspondants_import %}
|
||||
<table class="table">
|
||||
<thead><tr><td><b>Attribut</b></td><td><b>Type</b></td><td><b>Description</b></td></tr></thead>
|
||||
<tr><td>civilite</td><td>text</td><td>civilite du correspondant (H ou F)</td></tr>
|
||||
<tr><td>nom</td><td>text</td><td>nom du correspondant</td></tr>
|
||||
<tr><td>prenom</td><td>text</td><td>prenom du correspondant</td></tr>
|
||||
<tr><td>telephone</td><td>text</td><td>telephone du correspondant</td></tr>
|
||||
<tr><td>mail</td><td>text</td><td>mail du correspondant</td></tr>
|
||||
<tr><td>poste</td><td>text</td><td>poste du correspondant</td></tr>
|
||||
<tr><td>service</td><td>text</td><td>service dans lequel travaille le correspondant</td></tr>
|
||||
<tr><td>origine</td><td>text</td><td>origine du correspondant</td></tr>
|
||||
<tr><td>notes</td><td>text</td><td>notes sur le correspondant</td></tr>
|
||||
<tr><td>entreprise_siret</td><td>text</td><td>SIRET de l'entreprise</td></tr>
|
||||
<tr><td>entreprise_siret</td><td>integer</td><td>SIRET de l'entreprise</td></tr>
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
@ -43,7 +40,6 @@
|
||||
{% for correspondant in correspondants_import %}
|
||||
<div class="correspondant">
|
||||
<div>
|
||||
Civilité : {{ correspondant.civilite|get_civilité }}<br>
|
||||
Nom : {{ correspondant.nom }}<br>
|
||||
Prénom : {{ correspondant.prenom }}<br>
|
||||
{% if correspondant.telephone %}
|
||||
@ -58,13 +54,7 @@
|
||||
{% if correspondant.service %}
|
||||
Service : {{ correspondant.service }}<br>
|
||||
{% endif %}
|
||||
{% if correspondant.origine %}
|
||||
Origine : {{ correspondant.origine }}<br>
|
||||
{% endif %}
|
||||
{% if correspondant.notes %}
|
||||
Notes : {{ correspondant.notes }}<br>
|
||||
{% endif %}
|
||||
<a href="{{ url_for('entreprises.fiche_entreprise', id=correspondant.entreprise_id )}}" target="_blank">lien vers l'entreprise</a>
|
||||
<a href="{{ url_for('entreprises.fiche_entreprise', id=correspondant.entreprise_id )}}">lien vers l'entreprise</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
@ -2,9 +2,7 @@
|
||||
<nav class="nav-entreprise">
|
||||
<ul>
|
||||
<li><a href="{{ url_for('entreprises.index') }}">Entreprises</a></li>
|
||||
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesCorrespondants, None) %}
|
||||
<li><a href="{{ url_for('entreprises.correspondants') }}">Correspondants</a></li>
|
||||
{% endif %}
|
||||
<li><a href="{{ url_for('entreprises.offres_recues') }}">Offres reçues</a></li>
|
||||
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesValidate, None) %}
|
||||
<li><a href="{{ url_for('entreprises.validation') }}">Entreprises à valider</a></li>
|
||||
|
@ -9,7 +9,7 @@
|
||||
{% if offres_recues %}
|
||||
{% for offre in offres_recues %}
|
||||
<div class="offre offre-recue">
|
||||
<div style="word-break:break-all; text-align: justify;">
|
||||
<div>
|
||||
Envoyé le {{ offre[0].date_envoi.strftime('%d/%m/%Y') }} à {{ offre[0].date_envoi.strftime('%Hh%M') }} par {{ offre[0].sender_id|get_nomcomplet_by_id }}<br>
|
||||
Intitulé : {{ offre[1].intitule }}<br>
|
||||
Description : {{ offre[1].description }}<br>
|
||||
@ -19,20 +19,12 @@
|
||||
|
||||
{% if offre[1].correspondant_id %}
|
||||
Contacté {{ offre[3].nom }} {{ offre[3].prenom }}
|
||||
{% if offre[3].mail and offre[3].telephone %}
|
||||
({{ offre[3].mail }} - {{ offre[3].telephone }})
|
||||
{% else %}
|
||||
({{ offre[3].mail }}{{ offre[3].telephone }})
|
||||
{% endif %}
|
||||
{% if offre[3].mail and offre[3].telephone %}
|
||||
({{ offre[3].mail }} - {{ offre[3].telephone }})<br>
|
||||
{% else %}
|
||||
({{ offre[3].mail }}{{offre[3].telephone}})<br>
|
||||
{% endif %}
|
||||
|
||||
{% if offre[3].poste %}
|
||||
, poste : {{ offre[3].poste }}
|
||||
{% endif %}
|
||||
{% if offre[3].service %}
|
||||
, service : {{ offre[3].service }}
|
||||
{% endif %}
|
||||
<br>
|
||||
|
||||
<a href="{{ url_for('entreprises.fiche_entreprise', id=offre[1].entreprise_id) }}">lien vers l'entreprise</a><br>
|
||||
|
||||
|
@ -1,65 +0,0 @@
|
||||
"""ajout colonnes tables relations entreprises, sites
|
||||
|
||||
Revision ID: d5b3bdd1d622
|
||||
Revises: e97b2a10f86c
|
||||
Create Date: 2022-04-25 18:29:50.841280
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "d5b3bdd1d622"
|
||||
down_revision = "e97b2a10f86c"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table(
|
||||
"are_sites",
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
sa.Column("entreprise_id", sa.Integer(), nullable=True),
|
||||
sa.Column("nom", sa.Text(), nullable=True),
|
||||
sa.Column("adresse", sa.Text(), nullable=True),
|
||||
sa.Column("codepostal", sa.Text(), nullable=True),
|
||||
sa.Column("ville", sa.Text(), nullable=True),
|
||||
sa.Column("pays", sa.Text(), nullable=True),
|
||||
sa.ForeignKeyConstraint(
|
||||
["entreprise_id"], ["are_entreprises.id"], ondelete="cascade"
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.add_column(
|
||||
"are_correspondants", sa.Column("site_id", sa.Integer(), nullable=True)
|
||||
)
|
||||
op.add_column(
|
||||
"are_correspondants", sa.Column("civilite", sa.String(length=1), nullable=True)
|
||||
)
|
||||
op.add_column("are_correspondants", sa.Column("origine", sa.Text(), nullable=True))
|
||||
op.add_column("are_correspondants", sa.Column("notes", sa.Text(), nullable=True))
|
||||
op.create_foreign_key(
|
||||
None, "are_correspondants", "are_sites", ["site_id"], ["id"], ondelete="cascade"
|
||||
)
|
||||
op.add_column("are_entreprises", sa.Column("active", sa.Boolean(), nullable=True))
|
||||
op.add_column(
|
||||
"are_entreprises", sa.Column("notes_active", sa.Text(), nullable=True)
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column("are_entreprises", "notes_active")
|
||||
op.drop_column("are_entreprises", "active")
|
||||
op.drop_constraint(
|
||||
"are_correspondants_site_id_fkey", "are_correspondants", type_="foreignkey"
|
||||
)
|
||||
op.drop_column("are_correspondants", "notes")
|
||||
op.drop_column("are_correspondants", "origine")
|
||||
op.drop_column("are_correspondants", "civilite")
|
||||
op.drop_column("are_correspondants", "site_id")
|
||||
op.drop_table("are_sites")
|
||||
# ### end Alembic commands ###
|
@ -93,9 +93,7 @@ def upgrade():
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint(
|
||||
"are_offres_correspondant_id_fkey", "are_offres", type_="foreignkey"
|
||||
)
|
||||
op.drop_constraint(None, "are_offres", type_="foreignkey")
|
||||
op.drop_column("are_offres", "correspondant_id")
|
||||
op.add_column(
|
||||
"are_contacts",
|
||||
@ -123,10 +121,8 @@ def downgrade():
|
||||
op.add_column(
|
||||
"are_contacts", sa.Column("nom", sa.TEXT(), autoincrement=False, nullable=True)
|
||||
)
|
||||
op.drop_constraint(
|
||||
"are_contacts_entreprise_fkey", "are_contacts", type_="foreignkey"
|
||||
)
|
||||
op.drop_constraint("are_contacts_user_fkey", "are_contacts", type_="foreignkey")
|
||||
op.drop_constraint(None, "are_contacts", type_="foreignkey")
|
||||
op.drop_constraint(None, "are_contacts", type_="foreignkey")
|
||||
op.create_foreign_key(
|
||||
"are_contacts_entreprise_id_fkey",
|
||||
"are_contacts",
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
SCOVERSION = "9.2.14"
|
||||
SCOVERSION = "9.2.12"
|
||||
|
||||
SCONAME = "ScoDoc"
|
||||
|
||||
|
@ -23,16 +23,85 @@ import requests
|
||||
from tests.api.setup_test_api import SCODOC_URL, CHECK_CERTIFICATE, HEADERS
|
||||
|
||||
|
||||
# # etudiants
|
||||
# def test_etudiants():
|
||||
#
|
||||
# fields = [
|
||||
# "civilite",
|
||||
# "code_ine",
|
||||
# "code_nip",
|
||||
# "date_naissance",
|
||||
# "email",
|
||||
# "emailperso",
|
||||
# "etudid",
|
||||
# "nom",
|
||||
# "prenom",
|
||||
# "nomprenom",
|
||||
# "lieu_naissance",
|
||||
# "dept_naissance",
|
||||
# "nationalite",
|
||||
# "boursier",
|
||||
# "id",
|
||||
# "domicile",
|
||||
# "villedomicile",
|
||||
# "telephone",
|
||||
# "fax",
|
||||
# "description",
|
||||
# "codepostaldomicile",
|
||||
# "paysdomicile",
|
||||
# "telephonemobile",
|
||||
# "typeadresse",
|
||||
# ]
|
||||
#
|
||||
# r = requests.get(
|
||||
# SCODOC_URL + "/ScoDoc/api/etudiants",
|
||||
# headers=HEADERS,
|
||||
# verify=CHECK_CERTIFICATE,
|
||||
# )
|
||||
# assert r.status_code == 200
|
||||
# assert len(r.json()) == 16
|
||||
#
|
||||
# # Choisis aléatoirement un étudiant dans la liste des étudiants
|
||||
# etu = r.json()[randint(0, len(r.json())) - 1]
|
||||
#
|
||||
# fields_OK = True
|
||||
#
|
||||
# # Vérifie si tous les champs sont bien présents
|
||||
# for field in etu:
|
||||
# if field not in fields:
|
||||
# fields_OK = False
|
||||
#
|
||||
# assert fields_OK is True
|
||||
|
||||
|
||||
# etudiants_courant
|
||||
def test_etudiants_courant(): # XXX TODO pour Seb
|
||||
|
||||
fields = [
|
||||
"id",
|
||||
"nip",
|
||||
"nom",
|
||||
"nom_usuel",
|
||||
"prenom",
|
||||
"civilite",
|
||||
"code_ine",
|
||||
"code_nip",
|
||||
"date_naissance",
|
||||
"email",
|
||||
"emailperso",
|
||||
"etudid",
|
||||
"nom",
|
||||
"prenom",
|
||||
"nomprenom",
|
||||
"lieu_naissance",
|
||||
"dept_naissance",
|
||||
"nationalite",
|
||||
"boursier",
|
||||
"id",
|
||||
"domicile",
|
||||
"villedomicile",
|
||||
"telephone",
|
||||
"fax",
|
||||
"description",
|
||||
"codepostaldomicile",
|
||||
"paysdomicile",
|
||||
"telephonemobile",
|
||||
"typeadresse",
|
||||
]
|
||||
|
||||
r = requests.get(
|
||||
@ -55,55 +124,6 @@ def test_etudiants_courant(): # XXX TODO pour Seb
|
||||
|
||||
assert fields_OK is True
|
||||
|
||||
########## Version long################
|
||||
|
||||
fields_long = [
|
||||
"civilite",
|
||||
"code_ine",
|
||||
"code_nip",
|
||||
"date_naissance",
|
||||
"email",
|
||||
"emailperso",
|
||||
"etudid",
|
||||
"nom",
|
||||
"prenom",
|
||||
"nomprenom",
|
||||
"lieu_naissance",
|
||||
"dept_naissance",
|
||||
"nationalite",
|
||||
"boursier",
|
||||
"id",
|
||||
"codepostaldomicile",
|
||||
"paysdomicile",
|
||||
"telephonemobile",
|
||||
"typeadresse",
|
||||
"domicile",
|
||||
"villedomicile",
|
||||
"telephone",
|
||||
"fax",
|
||||
"description",
|
||||
]
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/etudiants/courant/long",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
assert len(r.json()) == 16
|
||||
|
||||
# Choisis aléatoirement un étudiant dans la liste des étudiants
|
||||
etu = r.json()[randint(0, len(r.json())) - 1]
|
||||
|
||||
fields_OK = True
|
||||
|
||||
# Vérifie si tous les champs sont bien présents
|
||||
for field in etu:
|
||||
if field not in fields_long:
|
||||
fields_OK = False
|
||||
|
||||
assert fields_OK is True
|
||||
|
||||
|
||||
# etudiant
|
||||
def test_etudiant(): # XXX TODO pour Seb
|
||||
|
Loading…
Reference in New Issue
Block a user