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 %} -