diff --git a/back/infolica/models/models.py b/back/infolica/models/models.py index 2827718e..1d89b737 100644 --- a/back/infolica/models/models.py +++ b/back/infolica/models/models.py @@ -629,6 +629,8 @@ class NumeroRelation(Base): NumeroRelationType.id), nullable=False) affaire_id = Column(BigInteger, ForeignKey(Affaire.id)) + UniqueConstraint(numero_id_base, numero_id_associe, relation_type_id, affaire_id) + class AffaireNumeroType(Base): __tablename__ = 'affaire_numero_type' diff --git a/back/infolica/scripts/utils.py b/back/infolica/scripts/utils.py index 4278b604..713164a1 100644 --- a/back/infolica/scripts/utils.py +++ b/back/infolica/scripts/utils.py @@ -1,9 +1,7 @@ # -*- coding: utf-8 -*-- from datetime import date, datetime from sqlalchemy import func, and_, desc -from infolica.models.models import Numero, AffaireNumero, Fonction, Role, FonctionRole, ReservationNumerosMO -from infolica.models.models import SuiviMandat, ControleGeometre, ControleMutation, ControlePPE -from infolica.models.models import AffaireEtape, Cadastre, Operateur +from infolica.models.models import Numero, AffaireNumero, Fonction, Role, FonctionRole, ReservationNumerosMO, Cadastre, Operateur from infolica.scripts.ldap_query import LDAPQuery from infolica.scripts.mailer import send_mail diff --git a/back/infolica/views/document.py b/back/infolica/views/document.py index ae3c938f..f4c41951 100644 --- a/back/infolica/views/document.py +++ b/back/infolica/views/document.py @@ -1,15 +1,11 @@ # -*- coding: utf-8 -*-- from pyramid.view import view_config -import pyramid.httpexceptions as exc -from infolica.exceptions.custom_error import CustomError -from infolica.models.constant import Constant -from infolica.models.models import Service +from infolica.models.models import Affaire, Service from infolica.scripts.utils import Utils import os import json -from datetime import datetime from docxtpl import DocxTemplate, RichText @@ -37,12 +33,21 @@ def save_document_view(request): output_file_name += "_" + service.abreviation relPath = service.relpath.strip('/').strip('\\') + affaire_relpath = request.dbsession.query(Affaire).filter(Affaire.id == affaire_id).first().chemin + + if affaire_relpath is None: + affaire_relpath = affaire_id + + affaire_path = os.path.normcase(os.path.join(affaires_directory, affaire_relpath)) + filename = output_file_name + '.docx' - file_path = os.path.normcase(os.path.join(affaires_directory, affaire_id, relPath, filename)) - folder_path = os.path.dirname(file_path) + file_path = os.path.normcase(os.path.join(affaire_path, relPath, filename)) - if not os.path.exists(folder_path): - Utils.create_affaire_folder(request, folder_path) + if not os.path.exists(affaire_path): + Utils.create_affaire_folder(request, affaire_path) + # update affaire chemin + affaire = request.dbsession.query(Affaire).filter(Affaire.id == affaire_id).first() + affaire.chemin = affaire_relpath # Set context context = json.loads(values) diff --git a/front/.env b/front/.env index 1a635727..36cbc0d5 100644 --- a/front/.env +++ b/front/.env @@ -188,9 +188,9 @@ VUE_APP_SITN_SEARCH_CATEGORIES_ALIASES = {__CATEGORY__ : __ALIAS__} #SITN couches environnement et aménagement du territoire -VUE_APP_SITN_ENVIRONNEMENT_URL = "__url/to/environment_layer__" VUE_APP_SITN_AMENAGEMENT_TERRITOIRE_URL = "__url/to/amenagement_territoire_layer__" VUE_APP_SITN_CADASTRE_URL = "__url/to/cadastre_layer__" +VUE_APP_SITN_SITES_POLLUES_URL = "__url/to/sites_pollues_layer__" #====================================== diff --git a/front/src/components/Affaires/AffairesDashboard.vue b/front/src/components/Affaires/AffairesDashboard.vue index 84e39a88..e022fe3e 100644 --- a/front/src/components/Affaires/AffairesDashboard.vue +++ b/front/src/components/Affaires/AffairesDashboard.vue @@ -426,13 +426,13 @@ export default { * Open Theme SITN */ openSitnTheme(theme) { - var route; - if (theme === "environnement") { - route = process.env.VUE_APP_SITN_ENVIRONNEMENT_URL; - } else if (theme === "amenagement_territoire") { + let route; + if (theme === "amenagement_territoire") { route = process.env.VUE_APP_SITN_AMENAGEMENT_TERRITOIRE_URL; } else if (theme === "cadastre") { route = process.env.VUE_APP_SITN_CADASTRE_URL; + } else if (theme === "sites_pollues") { + route = process.env.VUE_APP_SITN_SITES_POLLUES_URL; } else { return null; } diff --git a/front/src/components/Affaires/Documents/Documents.vue b/front/src/components/Affaires/Documents/Documents.vue index c2c32bc3..58c8d6d0 100644 --- a/front/src/components/Affaires/Documents/Documents.vue +++ b/front/src/components/Affaires/Documents/Documents.vue @@ -194,7 +194,10 @@ export default { this.searchAffaireDocuments(); this.searchAffaireDossier(); - this.$root.$on("searchAffaireDocuments", () => this.searchAffaireDocuments()) + this.$root.$on("searchAffaireDocuments", () => { + this.searchAffaireDossier() + this.searchAffaireDocuments() + }) // show edit affaire path if(checkPermission(process.env.VUE_APP_FONCTION_ADMIN)) { diff --git a/front/src/components/Affaires/affairesDashboard.html b/front/src/components/Affaires/affairesDashboard.html index 7810d009..0d1efbf6 100644 --- a/front/src/components/Affaires/affairesDashboard.html +++ b/front/src/components/Affaires/affairesDashboard.html @@ -56,7 +56,7 @@