From 5e77ca53a5d2879b92fbb1609fe9d01c207c9c9d Mon Sep 17 00:00:00 2001 From: Arthur ZHU Date: Fri, 25 Feb 2022 09:45:14 +0100 Subject: [PATCH] corrections --- app/entreprises/app_relations_entreprises.py | 33 ++++++++++--------- app/entreprises/forms.py | 8 +++-- app/templates/entreprises/contacts.html | 2 +- app/templates/entreprises/entreprises.html | 2 +- .../entreprises/entreprises_validation.html | 2 +- .../form_modification_entreprise.html | 2 +- app/templates/entreprises/offres_recues.html | 2 +- 7 files changed, 28 insertions(+), 23 deletions(-) diff --git a/app/entreprises/app_relations_entreprises.py b/app/entreprises/app_relations_entreprises.py index 421f08824..af06f6e18 100644 --- a/app/entreprises/app_relations_entreprises.py +++ b/app/entreprises/app_relations_entreprises.py @@ -172,21 +172,22 @@ def verif_entreprise_data(entreprise_data): """ Verifie les données d'une ligne Excel (entreprise) """ - for data in entreprise_data: # champs obligatoires + for data in entreprise_data[1:]: # champs obligatoires if data == "": return False - siret = entreprise_data[0].strip() # vérification sur le siret - if re.match("^\d{14}$", siret) is None: - return False - try: - req = requests.get( - f"https://entreprise.data.gouv.fr/api/sirene/v1/siret/{siret}" - ) - except requests.ConnectionError: - print("no internet") - if req.status_code != 200: - return False - entreprise = Entreprise.query.filter_by(siret=siret).first() - if entreprise is not None: - return False - return True + if EntreprisePreferences.get_check_siret(): + siret = entreprise_data[0].strip() # vérification sur le siret + if re.match("^\d{14}$", siret) is None: + return False + try: + req = requests.get( + f"https://entreprise.data.gouv.fr/api/sirene/v1/siret/{siret}" + ) + except requests.ConnectionError: + print("no internet") + if req.status_code != 200: + return False + entreprise = Entreprise.query.filter_by(siret=siret).first() + if entreprise is not None: + return False + return True diff --git a/app/entreprises/forms.py b/app/entreprises/forms.py index 5b1b175f8..e5e334c34 100644 --- a/app/entreprises/forms.py +++ b/app/entreprises/forms.py @@ -145,7 +145,9 @@ class OffreCreationForm(FlaskForm): choices=[("Stage"), ("Alternance")], validators=[DataRequired(message=CHAMP_REQUIS)], ) - missions = _build_string_field("Missions") + missions = TextAreaField( + "Missions", validators=[DataRequired(message=CHAMP_REQUIS)] + ) duree = _build_string_field("Durée") depts = MultiCheckboxField("Départements", validators=[Optional()], coerce=int) expiration_date = DateField( @@ -171,7 +173,9 @@ class OffreModificationForm(FlaskForm): choices=[("Stage"), ("Alternance")], validators=[DataRequired(message=CHAMP_REQUIS)], ) - missions = _build_string_field("Missions") + missions = TextAreaField( + "Missions", validators=[DataRequired(message=CHAMP_REQUIS)] + ) duree = _build_string_field("Durée") depts = MultiCheckboxField("Départements", validators=[Optional()], coerce=int) expiration_date = DateField( diff --git a/app/templates/entreprises/contacts.html b/app/templates/entreprises/contacts.html index 7830f83a2..0437c2bc4 100644 --- a/app/templates/entreprises/contacts.html +++ b/app/templates/entreprises/contacts.html @@ -31,7 +31,7 @@ {% endif %} -
+

Liste des contacts

diff --git a/app/templates/entreprises/entreprises.html b/app/templates/entreprises/entreprises.html index 8e2768c66..b48668e09 100644 --- a/app/templates/entreprises/entreprises.html +++ b/app/templates/entreprises/entreprises.html @@ -34,7 +34,7 @@ {% endif %} -
+

Liste des entreprises

diff --git a/app/templates/entreprises/entreprises_validation.html b/app/templates/entreprises/entreprises_validation.html index a7fbf0c94..d37e2494d 100644 --- a/app/templates/entreprises/entreprises_validation.html +++ b/app/templates/entreprises/entreprises_validation.html @@ -22,7 +22,7 @@ {% endif %} -
+

Liste des entreprises à valider

diff --git a/app/templates/entreprises/form_modification_entreprise.html b/app/templates/entreprises/form_modification_entreprise.html index c77cc12f8..47ce42e65 100644 --- a/app/templates/entreprises/form_modification_entreprise.html +++ b/app/templates/entreprises/form_modification_entreprise.html @@ -15,7 +15,7 @@
- Informations de l'API Sirene + Informations de la base SIRENE
diff --git a/app/templates/entreprises/offres_recues.html b/app/templates/entreprises/offres_recues.html index 2d3c9698e..a8814739f 100644 --- a/app/templates/entreprises/offres_recues.html +++ b/app/templates/entreprises/offres_recues.html @@ -23,7 +23,7 @@ {% endfor %}
- supprimer + supprimer
{% endfor %}