1
0
forked from ScoDoc/ScoDoc

corrections

This commit is contained in:
Arthur ZHU 2022-02-25 09:45:14 +01:00
parent c86d780585
commit 5e77ca53a5
7 changed files with 28 additions and 23 deletions

View File

@ -172,21 +172,22 @@ def verif_entreprise_data(entreprise_data):
""" """
Verifie les données d'une ligne Excel (entreprise) 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 == "": if data == "":
return False return False
siret = entreprise_data[0].strip() # vérification sur le siret if EntreprisePreferences.get_check_siret():
if re.match("^\d{14}$", siret) is None: siret = entreprise_data[0].strip() # vérification sur le siret
return False if re.match("^\d{14}$", siret) is None:
try: return False
req = requests.get( try:
f"https://entreprise.data.gouv.fr/api/sirene/v1/siret/{siret}" req = requests.get(
) f"https://entreprise.data.gouv.fr/api/sirene/v1/siret/{siret}"
except requests.ConnectionError: )
print("no internet") except requests.ConnectionError:
if req.status_code != 200: print("no internet")
return False if req.status_code != 200:
entreprise = Entreprise.query.filter_by(siret=siret).first() return False
if entreprise is not None: entreprise = Entreprise.query.filter_by(siret=siret).first()
return False if entreprise is not None:
return True return False
return True

View File

@ -145,7 +145,9 @@ class OffreCreationForm(FlaskForm):
choices=[("Stage"), ("Alternance")], choices=[("Stage"), ("Alternance")],
validators=[DataRequired(message=CHAMP_REQUIS)], validators=[DataRequired(message=CHAMP_REQUIS)],
) )
missions = _build_string_field("Missions") missions = TextAreaField(
"Missions", validators=[DataRequired(message=CHAMP_REQUIS)]
)
duree = _build_string_field("Durée") 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( expiration_date = DateField(
@ -171,7 +173,9 @@ class OffreModificationForm(FlaskForm):
choices=[("Stage"), ("Alternance")], choices=[("Stage"), ("Alternance")],
validators=[DataRequired(message=CHAMP_REQUIS)], validators=[DataRequired(message=CHAMP_REQUIS)],
) )
missions = _build_string_field("Missions") missions = TextAreaField(
"Missions", validators=[DataRequired(message=CHAMP_REQUIS)]
)
duree = _build_string_field("Durée") 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( expiration_date = DateField(

View File

@ -31,7 +31,7 @@
{% endif %} {% endif %}
</div> </div>
<div class="container"> <div class="container" style="margin-bottom: 10px;">
<h1>Liste des contacts</h1> <h1>Liste des contacts</h1>
<table id="table-contacts"> <table id="table-contacts">
<thead> <thead>

View File

@ -34,7 +34,7 @@
{% endif %} {% endif %}
</div> </div>
<div class="container"> <div class="container" style="margin-bottom: 10px;">
<h1>Liste des entreprises</h1> <h1>Liste des entreprises</h1>
<table id="table-entreprises"> <table id="table-entreprises">
<thead> <thead>

View File

@ -22,7 +22,7 @@
</div> </div>
{% endif %} {% endif %}
<div class="container"> <div class="container" style="margin-bottom: 10px;">
<h1>Liste des entreprises à valider</h1> <h1>Liste des entreprises à valider</h1>
<table id="table-entreprises-validation"> <table id="table-entreprises-validation">
<thead> <thead>

View File

@ -15,7 +15,7 @@
</div> </div>
<div id="sirene-data" class="col-md-5"> <div id="sirene-data" class="col-md-5">
<b>Informations de l'API Sirene</b> <b>Informations de la base SIRENE</b>
<div id="nom_entreprise_base"></div> <div id="nom_entreprise_base"></div>
<div id="adresse_base"></div> <div id="adresse_base"></div>
<div id="codepostal_base"></div> <div id="codepostal_base"></div>

View File

@ -23,7 +23,7 @@
{% endfor %} {% endfor %}
</div> </div>
<div> <div>
<a href="{{ url_for('entreprises.delete_offre_recue', id=offre[0].id) }}" style="margin-left: 5px;"><img title="Supprimer fichier" alt="supprimer" width="16" height="16" border="0" src="/ScoDoc/static/icons/delete_small_img.png" /></a> <a href="{{ url_for('entreprises.delete_offre_recue', id=offre[0].id) }}" style="margin-left: 5px;"><img title="Supprimer" alt="supprimer" width="16" height="16" border="0" src="/ScoDoc/static/icons/delete_small_img.png" /></a>
</div> </div>
</div> </div>
{% endfor %} {% endfor %}