From 86d05b1bdb05607587792be6bb373e0d9479e412 Mon Sep 17 00:00:00 2001
From: Marc Rufener
Date: Mon, 18 Mar 2024 08:58:15 +0100
Subject: [PATCH 1/7] guichet RF - get date_cloture if date_envoi is empty
---
back/infolica/views/affaire.py | 98 ++++++++++++++++++----------------
1 file changed, 53 insertions(+), 45 deletions(-)
diff --git a/back/infolica/views/affaire.py b/back/infolica/views/affaire.py
index 0847bbf9..c350651e 100644
--- a/back/infolica/views/affaire.py
+++ b/back/infolica/views/affaire.py
@@ -80,7 +80,7 @@ def affaire_cockpit_view(request):
affaire_etape_client_id = int(request.registry.settings['affaire_etape_client_id'])
etape_finProcessus_id = request.registry.settings["affaire_etape_fin_processus_id"]
-
+
query = request.dbsession.query(VAffaire)
# Filtrer les affaires abandonnées
@@ -118,7 +118,7 @@ def affaire_cockpit_view(request):
VAffaire.no_access.ilike("%" + searchTerm + "%")
)
)
-
+
query = query.all()
# get affaire etapes
@@ -130,13 +130,13 @@ def affaire_cockpit_view(request):
if not affaire.urgent_echeance is None \
and not affaire.etape_id in [int(settings['affaire_etape_validation_bd_id']), int(settings['affaire_etape_signature_art35_id']), int(settings['affaire_etape_fin_processus_id'])]:
urgent_echeance = datetime.strftime(affaire.urgent_echeance, '%d.%m.%Y')
-
+
nom_affaire = (affaire.no_access if affaire.no_access else str(affaire.id)) + (" / " + urgent_echeance if urgent_echeance else "") + (" / " + affaire.attribution if affaire.attribution else "")
etape_datetime = datetime.strftime(affaire.etape_datetime, '%Y-%m-%d %H:%M:%S')
etape_days_elapsed = (datetime.now().date() - affaire.etape_datetime.date()).days
etape_days_elapsed_text = "aujourd'hui" if etape_days_elapsed == 0 else ("hier" if etape_days_elapsed == 1 else str(etape_days_elapsed) + " jours")
title = affaire.technicien_initiales + " — Affaire " + str(affaire.id) + " — " + affaire.cadastre + " — " + (affaire.nom if affaire.nom is not None else "~ Aucune description ~") + " — Dans cette étape depuis " + etape_days_elapsed_text
-
+
nb_preavis = request.dbsession.query(func.count(Preavis.affaire_id)).filter(Preavis.affaire_id == affaire.id).scalar()
nb_closed_preavis = request.dbsession.query(func.count(Preavis.affaire_id)).filter(Preavis.affaire_id == affaire.id, Preavis.date_reponse != None).scalar()
preavis_status = None
@@ -172,7 +172,7 @@ def affaire_cockpit_view(request):
if affaire.etape_id == affaire_etape_devis_id:
# Si l'affaire est à l'étape devis, la basculer dans l'étape client du tableau cockpit
- for etape in ae:
+ for etape in ae:
tmp['dashboard_' + str(etape.id)] = nom_affaire if etape.id == affaire_etape_client_id else None
else:
for etape in ae:
@@ -195,7 +195,7 @@ def affaires_search_view(request):
settings = request.registry.settings
search_limit = int(settings['search_limit'])
-
+
params_affaires = {}
client_id = None
date_from = None
@@ -215,7 +215,7 @@ def affaires_search_view(request):
limitNbResults = False
else:
params_affaires[key] = request.params[key]
-
+
# Chercher les affaires par les clients de facture
affaires_id_by_clients_facture = []
if client_id is not None:
@@ -224,7 +224,7 @@ def affaires_search_view(request):
# Récupérer la liste des id des affaires retenues
for facture in query_facture:
affaires_id_by_clients_facture.append(int(facture.affaire_id))
-
+
# Chercher les affaires par les conditions (sauf client_facture)
conditions = Utils.get_search_conditions(VAffaire, params_affaires)
query = request.dbsession.query(VAffaire).filter(*conditions)
@@ -239,11 +239,11 @@ def affaires_search_view(request):
# filtrer les affaires par critères temporels
if not date_from is None:
query = query.filter(VAffaire.date_ouverture >= date_from)
-
+
if not date_to is None:
query = query.filter(VAffaire.date_ouverture <= date_to)
-
-
+
+
if limitNbResults:
query = query.limit(search_limit)
@@ -295,7 +295,7 @@ def affaire_mpd_view(request):
if re.search(regexp, aff.nom) is not None:
affaire = aff
break
-
+
return Utils.serialize_one(affaire)
@@ -306,7 +306,7 @@ def affaire_dashboard_layout_view(request):
"""
if not check_connected(request):
raise exc.HTTPForbidden()
-
+
affaire_id = request.params['affaire_id'] if 'affaire_id' in request.params else None
affaire_type_id = request.params['affaire_type_id'] if 'affaire_type_id' in request.params else None
@@ -421,16 +421,16 @@ def affaires_new_view(request):
# Créer les formulaires de contrôle
params = {'affaire_id': model.id}
affaireType = request.dbsession.query(AffaireType).filter(AffaireType.id == affaire_type).first()
-
+
if affaireType.affaire_section_ctrl_chefprojet_mo is True:
Utils.addNewRecord(request, ControleMutation, params)
-
+
if affaireType.affaire_section_ctrl_chefprojet_ppe is True:
Utils.addNewRecord(request, ControlePPE, params)
-
+
if affaireType.affaire_section_ctrl_coordprojets is True:
Utils.addNewRecord(request, SuiviMandat, params)
-
+
if affaireType.affaire_section_ctrl_geometre is True:
Utils.addNewRecord(request, ControleGeometre, params)
@@ -441,7 +441,7 @@ def affaires_new_view(request):
if tmp and tmp.logique_processus:
if len(tmp.logique_processus) > 0:
params['etape_id'] = tmp.logique_processus[0]
-
+
params['operateur_id'] = request.params['operateur_id'] if 'operateur_id' in request.params else None
params['datetime'] = datetime.now()
Utils.addNewRecord(request, AffaireEtape, params)
@@ -532,12 +532,12 @@ def affaires_update_view(request):
if "chemin" in params:
affaires_directory_baseName = request.registry.settings["affaires_directory_full_path"]
chemin_affaire = params["chemin"]
-
+
if not chemin_affaire.lower().startswith(affaires_directory_baseName.lower()):
raise CustomError(CustomError.DIRECTORY_WRONG_BASE.format(chemin_affaire, affaires_directory_baseName))
else:
relpath = os.path.relpath(chemin_affaire, affaires_directory_baseName)
-
+
if os.path.exists(os.path.join(request.registry.settings['affaires_directory'], relpath)):
params["chemin"] = relpath
else:
@@ -560,7 +560,7 @@ def affaire_cloture_view(request):
# Check connected
if not check_connected(request):
raise exc.HTTPForbidden()
-
+
affaire_id = request.params['affaire_id'] if 'affaire_id' in request.params else None
remarque = request.params['remarque'] if 'remarque' in request.params else None
@@ -828,21 +828,21 @@ def affaire_attribution_change_state_update_view(request):
return Utils.get_data_save_response(Constant.SUCCESS_SAVE.format(Affaire.__tablename__))
-@view_config(route_name="guichet_rf_saisie_pm", request_method="GET", renderer='jsonp')
+@view_config(route_name="guichet_rf_saisie_pm", request_method="GET", renderer="jsonp")
def guichet_rf_saisie_pm_view(request):
"""
Get date_envoi for guichet_rf saisie_pm
"""
- affaire_id = request.params['infolica_affaire_id'] if "infolica_affaire_id" in request.params else None
+ affaire_id = request.params["infolica_affaire_id"] if "infolica_affaire_id" in request.params else None
if affaire_id is None:
result = {
- 'search_term': None,
- 'infolica_affaire_id': None,
- 'infolica_affaire_nom': None,
- 'plan_date': None,
- 'status': 'error',
- 'detail': "Le numéro/nom de l'affaire est manquant dans la requête"
+ "search_term": None,
+ "infolica_affaire_id": None,
+ "infolica_affaire_nom": None,
+ "plan_date": None,
+ "status": "error",
+ "detail": "Le numéro/nom de l'affaire est manquant dans la requête"
}
return result
@@ -854,33 +854,41 @@ def guichet_rf_saisie_pm_view(request):
).first()
else:
# tester si le nom entré est dans l'ancien format N_1234_0
- affaire_id2 = re.split('(\d+)', affaire_id)
- if len(affaire_id2) == 2 or (len(affaire_id2) == 3 and affaire_id2[2] == ''):
+ affaire_id2 = re.split("(\d+)", affaire_id)
+ if len(affaire_id2) == 2 or (len(affaire_id2) == 3 and affaire_id2[2] == ""):
affaire_id2 = affaire_id2[0] + "_" + affaire_id2[1] + "_0"
affaire = request.dbsession.query(VAffaire).filter(
func.lower(VAffaire.no_access) == func.lower(affaire_id2)
).first()
-
- if affaire is None :
+ if affaire is None:
result = {
- 'search_term': affaire_id,
- 'infolica_affaire_id': None,
- 'infolica_affaire_nom': None,
- 'plan_date': None,
- 'status': 'error',
- 'detail': "Aucune affaire trouvée avec la référence donnée : infolica_affaire_id = " + affaire_id
+ "search_term": affaire_id,
+ "infolica_affaire_id": None,
+ "infolica_affaire_nom": None,
+ "plan_date": None,
+ "status": "error",
+ "detail": "Aucune affaire trouvée avec la référence donnée : infolica_affaire_id = " + affaire_id
}
else:
+ plan_date = None
+ detail = "pas de date d'envoi ni de date de clôture"
+ if affaire.date_envoi is not None:
+ plan_date = datetime.strftime(affaire.date_envoi, "%d.%m.%Y")
+ detail = "date d'envoi"
+ elif affaire.date_cloture:
+ plan_date = datetime.strftime(affaire.date_cloture, "%d.%m.%Y")
+ detail = "date de clôture"
+
result = {
- 'search_term': affaire_id,
- 'infolica_affaire_id': affaire.id,
- 'infolica_affaire_nom': affaire.no_access,
- 'plan_date': datetime.strftime(affaire.date_envoi, "%d.%m.%Y"),
- 'status': 'success',
- 'detail': 'Affaire trouvée'
+ "search_term": affaire_id,
+ "infolica_affaire_id": affaire.id,
+ "infolica_affaire_nom": affaire.no_access,
+ "plan_date": plan_date,
+ "status": "success",
+ "detail": f"Affaire trouvée ({detail})"
}
return result
From 87e17547dca86f32f19f483c71d25899ad182a0f Mon Sep 17 00:00:00 2001
From: Marc Rufener
Date: Fri, 22 Mar 2024 11:31:02 +0100
Subject: [PATCH 2/7] fix save new user
---
.../alembic/versions/20240321_7f61c1192ef6.py | 28 +++++++++++++++++++
back/infolica/models/models.py | 10 ++++---
back/infolica/scripts/authentication.py | 6 ++--
back/infolica/views/affaire.py | 12 ++++----
back/infolica/views/operateur.py | 18 +++++++-----
back/infolica/views/services_externes.py | 19 ++++++++++---
.../src/components/Operateurs/Operateurs.vue | 10 +++----
.../src/components/Operateurs/operateurs.html | 6 ++--
8 files changed, 77 insertions(+), 32 deletions(-)
create mode 100644 back/infolica/alembic/versions/20240321_7f61c1192ef6.py
diff --git a/back/infolica/alembic/versions/20240321_7f61c1192ef6.py b/back/infolica/alembic/versions/20240321_7f61c1192ef6.py
new file mode 100644
index 00000000..6a43eb67
--- /dev/null
+++ b/back/infolica/alembic/versions/20240321_7f61c1192ef6.py
@@ -0,0 +1,28 @@
+"""add start and end date to services
+
+Revision ID: 7f61c1192ef6
+Revises: 1317c98cd991
+Create Date: 2024-03-21 11:54:07.109451
+
+"""
+from alembic import op
+import sqlalchemy as sa
+
+
+# revision identifiers, used by Alembic.
+revision = '7f61c1192ef6'
+down_revision = '1317c98cd991'
+branch_labels = None
+depends_on = None
+
+def upgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.add_column('service', sa.Column('date_entree', sa.Date(), nullable=True))
+ op.add_column('service', sa.Column('date_sortie', sa.Date(), nullable=True))
+ # ### end Alembic commands ###
+
+def downgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.drop_column('service', 'date_sortie')
+ op.drop_column('service', 'date_entree')
+ # ### end Alembic commands ###
diff --git a/back/infolica/models/models.py b/back/infolica/models/models.py
index 226b6f68..9607065d 100644
--- a/back/infolica/models/models.py
+++ b/back/infolica/models/models.py
@@ -59,6 +59,8 @@ class Service(Base):
mail = Column(Text)
ordre = Column(BigInteger)
relpath = Column(Text)
+ date_entree = Column(Date)
+ date_sortie = Column(Date)
class Operateur(Base):
__tablename__ = 'operateur'
@@ -840,8 +842,8 @@ class NumeroType(Base):
id = Column(BigInteger, primary_key=True, autoincrement=True)
nom = Column(Text, nullable=False)
ordre = Column(BigInteger)
-
-
+
+
class NumeroEtat(Base):
__tablename__ = 'numero_etat'
__table_args__ = {'schema': 'infolica'}
@@ -1066,7 +1068,7 @@ class ControleEtapeTypeAffaire(Base):
# ======================== VUES ========================
-# Ajouter l'information 'info': dict(is_view=True) aux vues
+# Ajouter l'information 'info': dict(is_view=True) aux vues
# pour qu'elles ne soient pas prises en compte dans les migrations par Alembic
@@ -1290,7 +1292,7 @@ class VAffairesPreavis(Base):
operateur_service_id = Column(BigInteger)
operateur_service_prenom = Column(Text)
operateur_service_nom = Column(Text)
-
+
class VTableauBord(Base):
__tablename__ = 'v_tableau_de_bord'
diff --git a/back/infolica/scripts/authentication.py b/back/infolica/scripts/authentication.py
index 6e30b53f..88e43b4a 100644
--- a/back/infolica/scripts/authentication.py
+++ b/back/infolica/scripts/authentication.py
@@ -28,7 +28,7 @@ def check_connected(request, services=None):
if user is None:
return False
-
+
operateur = request.dbsession.query(Operateur).filter(
func.lower(Operateur.login) == user
).first()
@@ -40,7 +40,7 @@ def check_connected(request, services=None):
def get_user_functions(request):
-
+
results = {}
operateur = request.dbsession.query(Operateur).filter(
@@ -52,5 +52,5 @@ def get_user_functions(request):
results['role_id'] = operateur.role.id
results['role_name'] = operateur.role.nom
results['fonctions'] = [x.nom for x in fonctions]
-
+
return results
diff --git a/back/infolica/views/affaire.py b/back/infolica/views/affaire.py
index c350651e..1683214d 100644
--- a/back/infolica/views/affaire.py
+++ b/back/infolica/views/affaire.py
@@ -127,8 +127,8 @@ def affaire_cockpit_view(request):
affaires = []
for affaire in query:
urgent_echeance = None
- if not affaire.urgent_echeance is None \
- and not affaire.etape_id in [int(settings['affaire_etape_validation_bd_id']), int(settings['affaire_etape_signature_art35_id']), int(settings['affaire_etape_fin_processus_id'])]:
+ if affaire.urgent_echeance is not None \
+ and affaire.etape_id not in [int(settings['affaire_etape_validation_bd_id']), int(settings['affaire_etape_signature_art35_id']), int(settings['affaire_etape_fin_processus_id'])]:
urgent_echeance = datetime.strftime(affaire.urgent_echeance, '%d.%m.%Y')
nom_affaire = (affaire.no_access if affaire.no_access else str(affaire.id)) + (" / " + urgent_echeance if urgent_echeance else "") + (" / " + affaire.attribution if affaire.attribution else "")
@@ -237,10 +237,10 @@ def affaires_search_view(request):
))
# filtrer les affaires par critères temporels
- if not date_from is None:
+ if date_from is not None:
query = query.filter(VAffaire.date_ouverture >= date_from)
- if not date_to is None:
+ if date_to is not None:
query = query.filter(VAffaire.date_ouverture <= date_to)
@@ -411,7 +411,7 @@ def affaires_new_view(request):
model.chemin = str(model.id) # chemin relatif
# Copier le dossier __template pour une nouvelle affaire
- if not affaire_chemin_full_path is None:
+ if affaire_chemin_full_path is not None:
if model.type_id == request.registry.settings['affaire_type_mpd_id']:
Utils.create_affaire_folder(request.registry.settings['affaireTemplateDir_mpd'], affaire_chemin_full_path)
else:
@@ -878,7 +878,7 @@ def guichet_rf_saisie_pm_view(request):
if affaire.date_envoi is not None:
plan_date = datetime.strftime(affaire.date_envoi, "%d.%m.%Y")
detail = "date d'envoi"
- elif affaire.date_cloture:
+ elif affaire.date_cloture is not None:
plan_date = datetime.strftime(affaire.date_cloture, "%d.%m.%Y")
detail = "date de clôture"
diff --git a/back/infolica/views/operateur.py b/back/infolica/views/operateur.py
index f21d9d44..41c61c84 100644
--- a/back/infolica/views/operateur.py
+++ b/back/infolica/views/operateur.py
@@ -4,7 +4,7 @@
from infolica.exceptions.custom_error import CustomError
from infolica.models.constant import Constant
-from infolica.models.models import Operateur, EtapeMailer
+from infolica.models.models import Operateur, EtapeMailer, Service, NotesMAJ, Role
from infolica.scripts.utils import Utils
from infolica.scripts.authentication import check_connected
from datetime import datetime
@@ -25,11 +25,11 @@ def _updateOperateurNotifications(request, operateur_id, etapesMailerList):
).group_by(
EtapeMailer.operateur_id
).first()
-
+
tmp = []
if aem_old is not None:
tmp = aem_old.affaire_etapes_mailer
-
+
aem_old = set(tmp)
aem2create = etapesMailerList.difference(aem_old)
@@ -76,7 +76,7 @@ def operateurs_view(request):
for op in operateurs:
op['prenom_nom'] = ' '.join([op['prenom'], op['nom']])
-
+
return operateurs
@@ -129,9 +129,9 @@ def operateur_update_view(request):
tmp = []
if operateur_etapes_mailer is not None:
tmp = operateur_etapes_mailer.affaire_etapes_mailer
-
+
operateur['affaire_etapes_mailer'] = tmp
-
+
return operateur
@@ -171,6 +171,10 @@ def operateurs_new_view(request):
# Get operateur instance
model = Utils.set_model_record(Operateur(), request.params)
+ model.service = request.dbsession.query(Service.abreviation).filter(Service.id == model.service_id).scalar() if model.service_id else None
+ model.last_notemaj_id = request.dbsession.query(func.max(NotesMAJ.id)).scalar()
+ model.role = request.dbsession.query(Role).filter(Role.id == model.role_id).first()
+
request.dbsession.add(model)
request.dbsession.flush()
@@ -204,7 +208,7 @@ def operateurs_update_view(request):
# Read params operateur
model = Utils.set_model_record(model, request.params)
-
+
if 'affaire_etapes_mailer' in request.params:
aem_new = set(json.loads(request.params['affaire_etapes_mailer']))
_updateOperateurNotifications(request, id_operateur, aem_new)
diff --git a/back/infolica/views/services_externes.py b/back/infolica/views/services_externes.py
index 83fb41d5..235a76cf 100644
--- a/back/infolica/views/services_externes.py
+++ b/back/infolica/views/services_externes.py
@@ -7,6 +7,9 @@
from infolica.models.models import Cadastre, Service
from infolica.scripts.utils import Utils
from infolica.scripts.authentication import check_connected
+from sqlalchemy import or_
+from datetime import datetime
+
###########################################################
# SERVICES EXTERNES
###########################################################
@@ -40,6 +43,8 @@ def services_view(request):
if not check_connected(request):
raise exc.HTTPForbidden()
+ now = datetime.now()
+
cadastre_id = request.params['cadastre_id'] if 'cadastre_id' in request.params else None
if cadastre_id is not None:
@@ -47,12 +52,18 @@ def services_view(request):
service_at_id = cadastre.service_at_id
# filtrer le service de l'aménagement du territoire
- records = request.dbsession.query(Service).filter(Service.ordre != 1).union(
- request.dbsession.query(Service).filter(Service.id == service_at_id)
- ).order_by(Service.ordre.asc()).all()
+ records = request.dbsession.query(Service).filter(Service.ordre >= 20).union(
+ request.dbsession.query(Service).filter(Service.id == service_at_id))
else:
- records = request.dbsession.query(Service).order_by(Service.ordre.asc()).all()
+ records = request.dbsession.query(Service)
+
+ records = records.filter(
+ or_(
+ Service.date_sortie == None,
+ Service.date_sortie > now,
+ )
+ ).order_by(Service.ordre.asc()).all()
return Utils.serialize_many(records)
diff --git a/front/src/components/Operateurs/Operateurs.vue b/front/src/components/Operateurs/Operateurs.vue
index 80f64178..1a818af6 100644
--- a/front/src/components/Operateurs/Operateurs.vue
+++ b/front/src/components/Operateurs/Operateurs.vue
@@ -102,7 +102,7 @@ export default {
*/
callEditOperateur (op) {
this.divEditUser.title = "Modifier un·e opérateur·rice existant·e";
-
+
this.getOperateur(op.id);
this.getAffaireEtapesAll();
@@ -327,11 +327,11 @@ export default {
})
.catch(err => handleException(err, this));
},
-
+
textUpperCase() {
this.form.ldap_domain = this.form.ldap_domain.toUpperCase();
},
-
+
/**
* get Affaire Etapes
*/
@@ -354,8 +354,8 @@ export default {
})
.catch(err => handleException(err, this));
},
-
-
+
+
/**
* get Operateur for update
*/
diff --git a/front/src/components/Operateurs/operateurs.html b/front/src/components/Operateurs/operateurs.html
index 99792a43..5a595885 100644
--- a/front/src/components/Operateurs/operateurs.html
+++ b/front/src/components/Operateurs/operateurs.html
@@ -51,7 +51,7 @@ Opérateurs
- Service (laisser vide pour SGRF)
+ Service
{{ item.nom_ }}
@@ -96,14 +96,14 @@ Opérateurs
-
+
Recherche
-
+
keyboard_arrow_down
From 929348b958e51e0d709b02c68fba5ce335eaabf5 Mon Sep 17 00:00:00 2001
From: Marc Rufener
Date: Fri, 22 Mar 2024 16:01:39 +0100
Subject: [PATCH 3/7] partial select on affaire_type (cockpit)
---
back/infolica/views/affaire.py | 6 ++--
front/src/components/Cockpit/Cockpit.vue | 43 +++++++++++++++--------
front/src/components/Cockpit/cockpit.html | 21 +++++++----
3 files changed, 45 insertions(+), 25 deletions(-)
diff --git a/back/infolica/views/affaire.py b/back/infolica/views/affaire.py
index 1683214d..793699ac 100644
--- a/back/infolica/views/affaire.py
+++ b/back/infolica/views/affaire.py
@@ -70,7 +70,7 @@ def affaire_cockpit_view(request):
settings = request.registry.settings
- type_id = request.params['type_id'] if 'type_id' in request.params else None
+ type_id = request.params['type_id'].split(',') if 'type_id' in request.params else []
etape_id = request.params['etape_id'].split(',') if 'etape_id' in request.params else None
searchTerm = request.params['searchTerm'] if 'searchTerm' in request.params else None
operateur_id = request.params['operateur_id'] if 'operateur_id' in request.params else None
@@ -89,8 +89,8 @@ def affaire_cockpit_view(request):
if etape_id is not None:
query = query.filter(VAffaire.etape_id.in_(etape_id))
# recherche par type
- if type_id is not None:
- query = query.filter(VAffaire.type_id == type_id)
+ if len(type_id) > 0:
+ query = query.filter(VAffaire.type_id.in_(type_id))
# recherche par opérateur
if operateur_id is not None:
query = query.filter(VAffaire.technicien_id == operateur_id)
diff --git a/front/src/components/Cockpit/Cockpit.vue b/front/src/components/Cockpit/Cockpit.vue
index bcf46f6a..e56b555f 100644
--- a/front/src/components/Cockpit/Cockpit.vue
+++ b/front/src/components/Cockpit/Cockpit.vue
@@ -44,7 +44,7 @@ export default {
},
search: {
operateur_id: -1,
- type_id: -1,
+ type_id: [],
showFinProcessus: false,
showOnlyAffairesUrgentes: false,
current_sort: "id",
@@ -64,18 +64,18 @@ export default {
getPermissions() {
// set time out of 0.5 seconds. If not, local storage has not time to memorize user allowed functions
setTimeout(() => {
-
+
this.newAffaireAllowed = checkPermission(process.env.VUE_APP_AFFAIRE_EDITION) || checkPermission(process.env.VUE_APP_AFFAIRE_PPE_EDITION) ||
checkPermission(process.env.VUE_APP_AFFAIRE_REVISION_ABORNEMENT_EDITION) || checkPermission(process.env.VUE_APP_AFFAIRE_CADASTRATION_EDITION) ||
checkPermission(process.env.VUE_APP_AFFAIRE_RETABLISSEMENT_PFP3_EDITION) || checkPermission(process.env.VUE_APP_AFFAIRE_PCOP_EDITION) ||
checkPermission(process.env.VUE_APP_AFFAIRE_AUTRE_EDITION);
-
+
//Check if role secretaire
let role_id = getCurrentUserRoleId();
if ( role_id && !isNaN(role_id) && Number(role_id) === this.role.secretaire || checkPermission(process.env.VUE_APP_FONCTION_ADMIN) ) {
this.showMatdiff_secr = true;
- }
-
+ }
+
//Check if role MO
if ( role_id && !isNaN(role_id) && Number(role_id) === this.role.mo || checkPermission(process.env.VUE_APP_FONCTION_ADMIN) ) {
this.showMatdiff_mo = true;
@@ -91,8 +91,8 @@ export default {
// this.showMatdiff_secr = true;
this.showMatdiff_mo = true;
this.showMatdiff_ctrl = true;
- }
-
+ }
+
}, 500);
},
@@ -172,7 +172,7 @@ export default {
).then(response => {
if (response && response.data) {
let tmp = response.data;
-
+
this.affaireTypes = stringifyAutocomplete(tmp);
}
}).catch(err => handleException(err, this));
@@ -189,15 +189,15 @@ export default {
if (this.search.operateur_id > 0) {
query.push("operateur_id=" + this.search.operateur_id);
}
- if (this.search.type_id > 0) {
- query.push("type_id=" + this.search.type_id);
+ if (this.search.type_id.length > 0) {
+ query.push("type_id=" + this.search.type_id.join(','));
}
query.push("showFinProcessus=" + this.search.showFinProcessus);
query.push("showOnlyAffairesUrgentes=" + this.search.showOnlyAffairesUrgentes);
// query.push("sort_by=" + this.current_sort);
// query.push("sort_order=" + this.current_sort_order);
query.push('ts=' + Date.now());
-
+
query = "?" + query.join('&');
return query;
@@ -213,16 +213,16 @@ export default {
if (response && response.data) {
let tmp = response.data;
tmp = tmp.filter(x => x.chef_equipe);
-
+
// set operateur by default if he is chef_equipe
let currentUserID = JSON.parse(localStorage.getItem("infolica_user")).id;
let currentUserRoleID = getCurrentUserRoleId();
if (tmp.some(x => (x.id === currentUserID) && x.chef_equipe) && (currentUserRoleID && [this.role.mo, this.role.ppe, this.role.mo_ppe].includes(currentUserRoleID))) {
this.search.operateur_id = Number(currentUserID);
}
-
+
tmp = stringifyAutocomplete2(tmp, "prenom_nom", null, "prenom_nom");
-
+
this.operateurs = tmp;
resolve(tmp);
}
@@ -287,6 +287,19 @@ export default {
this.search.current_sort = this.current_sort;
this.search.current_sort_order = this.current_sort_order;
localStorage.setItem("infolica_cockpit_searchParams", JSON.stringify(this.search));
+ },
+
+ updateSelection(mode) {
+ if (mode==='tout'){
+ let tmp = [];
+ this.affaireTypes.forEach(x => {
+ tmp.push(x.id);
+ })
+ this.search.type_id = tmp;
+ }
+ if (mode==='aucun'){
+ this.search.type_id = [];
+ }
}
},
@@ -308,7 +321,7 @@ export default {
this.snow.newYear = newYear;
}
},
-
+
created() {
this.getSearchParams().then(() => {
this.refreshAffaire = setInterval(this.getAffaire, 60000); // Recharge le tableau toutes les minutes
diff --git a/front/src/components/Cockpit/cockpit.html b/front/src/components/Cockpit/cockpit.html
index c0342f84..da301855 100644
--- a/front/src/components/Cockpit/cockpit.html
+++ b/front/src/components/Cockpit/cockpit.html
@@ -14,7 +14,7 @@ Cockpit
:showMatdiff_mo="showMatdiff_mo"
:showMatdiff_ctrl="showMatdiff_ctrl">
-
+
@@ -24,7 +24,7 @@
Cockpit
search
-
+
Opérateur·rice
@@ -32,15 +32,22 @@ Cockpit
{{ item.prenom_nom }}
-
+
Type(s) d'affaire
-
- Tous
+
+
{{ item.nom }}
-
+
Afficher l'étape fin de processus
N'afficher que les affaires urgentes
@@ -56,7 +63,7 @@ Cockpit
-
+
{{ item.affaire_type }}
{{ item.dashboard_13 }}
{{ item.dashboard_13 }}
From 6ae12bf7e91c82bc612c8f6b880afe55e108049f Mon Sep 17 00:00:00 2001
From: Marc Rufener
Date: Mon, 25 Mar 2024 12:34:51 +0100
Subject: [PATCH 4/7] =?UTF-8?q?avertissement=20client=20d=C3=A9j=C3=A0=20e?=
=?UTF-8?q?xistant=20dans=20la=20db?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
back/infolica/routes.py | 1 +
back/infolica/views/client.py | 66 ++++++++++++++---
front/.env | 1 +
front/src/components/Clients/ClientsEdit.vue | 72 ++++++++++++++++---
front/src/components/Clients/clientsEdit.css | 6 +-
front/src/components/Clients/clientsEdit.html | 24 ++++---
6 files changed, 141 insertions(+), 29 deletions(-)
diff --git a/back/infolica/routes.py b/back/infolica/routes.py
index e104ceb3..922fad3b 100644
--- a/back/infolica/routes.py
+++ b/back/infolica/routes.py
@@ -17,6 +17,7 @@ def includeme(config):
config.add_route('client_moral_personnes_s', '/infolica/api/client_moral_personnes/')
config.add_route('search_clients_aggregated_by_term', '/infolica/api/search_clients_aggregated_by_term')
config.add_route('search_client_aggregated_by_id', '/infolica/api/search_client_aggregated/{id}')
+ config.add_route('client_check_existing', '/infolica/api/client_check_existing')
#Affaires
config.add_route('affaires', '/infolica/api/affaires')
config.add_route('affaires_s', '/infolica/api/affaires/')
diff --git a/back/infolica/views/client.py b/back/infolica/views/client.py
index e5e488d6..91c00c41 100644
--- a/back/infolica/views/client.py
+++ b/back/infolica/views/client.py
@@ -8,7 +8,7 @@
from infolica.scripts.authentication import check_connected
import json
from datetime import datetime
-from sqlalchemy import cast, or_, String
+from sqlalchemy import cast, or_, String, func
import re
@@ -25,7 +25,7 @@ def _set_client_aggregated_name(client, sep=', '):
if client.sortie is not None:
nom_ = '(ancien client) ' + nom_
-
+
return nom_
@@ -63,9 +63,9 @@ def _multipleAttributesClientSearch(request, searchTerm, old_clients=False, sear
# cast(Client.no_access, String).ilike(term),
)
)
-
+
results = query.limit(search_limit).all()
-
+
return results
@@ -95,7 +95,7 @@ def clients_view(request):
if client_id:
query = query.filter(Client.id == client_id)
-
+
query = query.filter(Client.sortie == None).all()
return Utils.serialize_many(query)
@@ -127,7 +127,7 @@ def client_aggregated_by_id_view(request):
id = request.matchdict['id']
result = request.dbsession.query(Client).filter(
Client.id == id).first()
-
+
client = {
'id': result.id,
'nom': _set_client_aggregated_name(result),
@@ -161,7 +161,7 @@ def clients_search_view(request):
query = request.dbsession.query(
Client
).order_by(
- Client.nom,
+ Client.nom,
Client.prenom
).filter(
*conditions
@@ -169,7 +169,7 @@ def clients_search_view(request):
if not old_clients:
query = query.filter(Client.sortie == None)
-
+
query = query.limit(search_limit).all()
return Utils.serialize_many(query)
@@ -187,7 +187,7 @@ def clients_search_by_term_view(request):
old_clients = request.params['old_clients'] == 'true' if 'old_clients' in request.params else False
clients = _multipleAttributesClientSearch(request, searchTerm, old_clients=old_clients)
-
+
return Utils.serialize_many(clients)
@@ -214,7 +214,7 @@ def clients_aggregated_search_by_term_view(request):
'nom': nom_,
'type_client': client.type_client
})
-
+
return liste_clients
@@ -369,4 +369,48 @@ def client_moral_personnes_delete_view(request):
request.dbsession.delete(model)
- return Utils.get_data_save_response(Constant.SUCCESS_DELETE.format(Client.__tablename__))
\ No newline at end of file
+ return Utils.get_data_save_response(Constant.SUCCESS_DELETE.format(Client.__tablename__))
+
+
+@view_config(route_name='client_check_existing', request_method='GET', renderer='json')
+def client_check_existing_view(request):
+ """
+ Check if client already exists
+ """
+ # Check authorization
+ if not Utils.has_permission(request, request.registry.settings['client_edition']):
+ raise exc.HTTPForbidden()
+
+ entreprise = request.params['entreprise'] if 'entreprise' in request.params else None
+ firstname = request.params['firstname'] if 'firstname' in request.params else None
+ lastname = request.params['lastname'] if 'lastname' in request.params else None
+ client_id = request.params['client_id'] if 'client_id' in request.params else None
+
+ clients = request.dbsession.query(Client)
+
+ if entreprise is not None:
+ clients = clients.filter(
+ func.similarity(Client.entreprise, entreprise) > 0.6
+ )
+ else:
+ clients = clients.filter(
+ func.similarity(Client.prenom, firstname) > 0.6,
+ func.similarity(Client.nom, lastname) > 0.6
+ )
+
+ if client_id is not None:
+ clients = clients.filter(Client.id != client_id)
+
+ clients = clients.all()
+
+ nom = []
+ nom.append(entreprise) if entreprise is not None else ''
+ nom.append(f'{lastname} {firstname}') if lastname is not None and firstname is not None else ''
+ nom = ' - '.join(nom)
+ response = {
+ 'error': len(clients) > 0,
+ 'message': f'{nom} semble déjà exister dans la base de données.' if len(clients) > 0 else '',
+ 'clients': Utils.serialize_many(clients)
+ }
+
+ return response
diff --git a/front/.env b/front/.env
index 26ef663b..71c555e3 100644
--- a/front/.env
+++ b/front/.env
@@ -45,6 +45,7 @@ VUE_APP_SEARCH_CLIENTS_ENDPOINT = "/recherche_clients"
VUE_APP_SEARCH_CLIENTS_BY_TERM_ENDPOINT = "/search_clients_by_term"
VUE_APP_SEARCH_TYPES_CLIENTS_ENDPOINT = "/types_clients"
VUE_APP_CLIENT_MORAL_PERSONNES_ENDPOINT = "/client_moral_personnes"
+VUE_APP_CLIENT_CHECK_EXISTING_ENDPOINT = "/client_check_existing"
#Operateurs
VUE_APP_OPERATEURS_ENDPOINT = "/operateurs"
diff --git a/front/src/components/Clients/ClientsEdit.vue b/front/src/components/Clients/ClientsEdit.vue
index f7576c0c..963c5f53 100644
--- a/front/src/components/Clients/ClientsEdit.vue
+++ b/front/src/components/Clients/ClientsEdit.vue
@@ -58,6 +58,7 @@ export default {
showDialogAddNewContact: false,
types_clients_list: [],
npa_localite_list: [],
+ existingClient: {},
}),
// Validations
@@ -67,7 +68,7 @@ export default {
mail: { email }
}
},
-
+
methods: {
/**
@@ -129,14 +130,14 @@ export default {
handleException(err, this);
});
},
-
+
/**
* Save data
*/
saveData () {
this.sending = true;
var formData = this.initPostData();
-
+
var url = process.env.VUE_APP_API_URL + process.env.VUE_APP_CLIENTS_ENDPOINT;
if(this.mode === 'new'){
@@ -166,7 +167,7 @@ export default {
else{
let client_id = this.$route.params.id;
formData.append("id", client_id);
-
+
this.$http.put(
url,
formData,
@@ -250,7 +251,7 @@ export default {
this.saveData()
}
},
-
+
/**
* Cancel edit
*/
@@ -263,12 +264,12 @@ export default {
this.$router.push({name: "Clients"});
}
},
-
+
/**
* Init edit data
*/
initEditData (id) {
-
+
this.$http.get(
process.env.VUE_APP_API_URL + process.env.VUE_APP_CLIENTS_ENDPOINT + '/' + id,
{
@@ -349,6 +350,19 @@ export default {
}
},
+ updateClientType() {
+ // remove first and lastname if client type set to personne_morale or remove entreprise if type set to personne_physique
+ if (this.form.type_client === this.clientTypes_conf.personne_morale) {
+ this.form.nom = null;
+ this.form.prenom = null;
+ } else {
+ this.form.entreprise = null;
+ }
+ this.existingClient = {
+ error: false
+ };
+ },
+
/**
* Add new contact in entreprise
*/
@@ -453,13 +467,13 @@ export default {
}
});
tmp = tmp.splice(0,10);
-
+
this.npa_localite_list = stringifyAutocomplete2(tmp, "nom");
} else {
this.npa_localite_list = [];
}
},
-
+
setNPALocalite(data){
setTimeout(() => {
this.form.npa = data.id;
@@ -467,6 +481,46 @@ export default {
}, 100);
},
+ checkExistingClient() {
+ if (!((this.form.nom && this.form.prenom) || this.form.entreprise)) {
+ return;
+ }
+
+ let search = '';
+ if (this.form.type_client===this.clientTypes_conf.personne_morale) {
+ search += `?entreprise=${this.form.entreprise}`
+ if (this.$route.params.id) {
+ search += `&client_id=${this.$route.params.id}`;
+ }
+ } else {
+ search += `?firstname=${this.form.prenom}&lastname=${this.form.nom}`
+ if (this.$route.params.id) {
+ search += `&client_id=${this.$route.params.id}`;
+ }
+ }
+
+ this.$http.get(process.env.VUE_APP_API_URL + process.env.VUE_APP_CLIENT_CHECK_EXISTING_ENDPOINT + search,
+ {
+ withCredentials: true,
+ headers: {"Accept": "application/json"}
+ }
+ ).then((response) => {
+ if (response && response.data) {
+ console.log('response.data',response.data)
+ this.existingClient = response.data;
+ }
+ }).catch(err => handleException(err, this));
+ },
+
+ seturl(client) {
+ let routedata = this.$router.resolve({ name: 'ClientsEdit', params: { id: client.id } });
+ return routedata.href;
+ },
+
+ testInactiveClient(client) {
+ return client.sortie !== null && new Date(client.sortie) < new Date();
+ }
+
},
mounted: function(){
diff --git a/front/src/components/Clients/clientsEdit.css b/front/src/components/Clients/clientsEdit.css
index e4c2a0e7..d75956ca 100644
--- a/front/src/components/Clients/clientsEdit.css
+++ b/front/src/components/Clients/clientsEdit.css
@@ -9,4 +9,8 @@
top: 0;
right: 0;
left: 0;
- }
\ No newline at end of file
+}
+
+.inactiveClient {
+ font-style: italic;
+}
diff --git a/front/src/components/Clients/clientsEdit.html b/front/src/components/Clients/clientsEdit.html
index c6d7c29c..68662bef 100644
--- a/front/src/components/Clients/clientsEdit.html
+++ b/front/src/components/Clients/clientsEdit.html
@@ -15,7 +15,7 @@ Edition de clients
Type client
-
+
{{ item.nom }}
Le type client est obligatoire
@@ -28,7 +28,7 @@ Edition de clients
Nom de l'entreprise
-
+
@@ -48,16 +48,24 @@
Edition de clients
Nom
-
+
Prénom
-
+
+
+
+
+
+
{{ existingClient.message }}
+
@@ -86,7 +94,7 @@
Edition de clients
-
+
Localité
@@ -116,7 +124,7 @@ Edition de clients
Format: 032 123 45 67
-
+
Téléphone portable/autre
@@ -153,7 +161,7 @@ Edition de clients
-
+
@@ -181,7 +189,7 @@
Edition de clients
-
+
From 3ac40d39aab3efcc836d6d75992995a3fcc10ad0 Mon Sep 17 00:00:00 2001
From: Marc Rufener
Date: Mon, 25 Mar 2024 13:15:04 +0100
Subject: [PATCH 5/7] update version
---
front/.env | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/front/.env b/front/.env
index 71c555e3..3ea04825 100644
--- a/front/.env
+++ b/front/.env
@@ -3,7 +3,7 @@ VUE_APP_API_URL="{API_URL}"
PUBLIC_PATH = "{PUBLIC_PATH}"
VUE_APP_STATUS = "development"
-VUE_APP_VERSION = "1.11.7"
+VUE_APP_VERSION = "1.11.8"
#==================================
From 2fae60337b5530166101ff175ad6ba5bdcd0321e Mon Sep 17 00:00:00 2001
From: Marc Rufener
Date: Wed, 27 Mar 2024 11:03:38 +0100
Subject: [PATCH 6/7] fix client hors canton error when no npa is setten
---
back/infolica/scripts/mail_templates.py | 41 +++++++++++++------------
back/infolica/views/affaire_etape.py | 10 +++---
front/src/services/helper.js | 16 +++++-----
3 files changed, 34 insertions(+), 33 deletions(-)
diff --git a/back/infolica/scripts/mail_templates.py b/back/infolica/scripts/mail_templates.py
index 8b9dc802..37109145 100644
--- a/back/infolica/scripts/mail_templates.py
+++ b/back/infolica/scripts/mail_templates.py
@@ -29,7 +29,7 @@ def sendMailAffaireEtape(cls, request, model, chef_equipe_id, operateur_id):
VEtapesAffaires.etape_priorite == int(request.registry.settings['affaire_etape_priorite_1_id'])
)
).order_by(VEtapesAffaires.next_datetime.desc()).all()
-
+
# set affaire_nom
affaire_nom = " (" + affaire.no_access + ")" if affaire.no_access is not None else ""
@@ -46,7 +46,7 @@ def sendMailAffaireEtape(cls, request, model, chef_equipe_id, operateur_id):
mail = next((op.mail for op in operateur if op.id == em_i.operateur_id), None)
if mail:
mail_list.append(mail)
-
+
# Send mail only if step prio is 1 and if mail_list not empty
if affaire_etape_index.priorite == int(request.registry.settings['affaire_etape_priorite_1_id']) and len(mail_list)>0:
lastSteps_html = "".join(["{} \
@@ -54,13 +54,13 @@ def sendMailAffaireEtape(cls, request, model, chef_equipe_id, operateur_id):
{} \
{} \
".format(
- i.etape,
- i.next_operateur_prenom if i.next_operateur_prenom else "",
- i.next_operateur_nom if i.next_operateur_nom else "",
- i.next_datetime.strftime("%d.%m.%Y - %H:%M") if i.next_datetime else "",
+ i.etape,
+ i.next_operateur_prenom if i.next_operateur_prenom else "",
+ i.next_operateur_nom if i.next_operateur_nom else "",
+ i.next_datetime.strftime("%d.%m.%Y - %H:%M") if i.next_datetime else "",
i.next_remarque if i.next_remarque else ""
) for i in lastSteps])
-
+
text = "L'affaire " + str(v_affaire.id) + affaire_nom + " " + (" (avec mention urgente)" if v_affaire.urgent else "") + " est en attente pour l'étape "+ affaire_etape_index.nom +" ."
text += " Cadastre: " + str(v_affaire.cadastre)
text += " Description: " + str(v_affaire.nom)
@@ -74,7 +74,7 @@ def sendMailAffaireEtape(cls, request, model, chef_equipe_id, operateur_id):
" + lastSteps_html + "") if lastSteps_html != "" else ""
subject = "Infolica - affaire " + str(v_affaire.id) + (" - URGENT" if v_affaire.urgent else "")
send_mail(request, mail_list, "", subject, html=text)
-
+
return (lastSteps, affaire_etape_index)
@@ -130,7 +130,8 @@ def sendMailClientHorsCanton(cls, request, client_id, affaire_id):
return
#Contrôle que le client habite hors canton et que son numéros SAP est null
- if cl.no_sap is None and int(cl.npa) not in request.registry.settings['npa_NE']:
+ cl_npa = int(cl.npa) if cl.npa is not None else -1
+ if cl.no_sap is None and cl_npa not in request.registry.settings['npa_NE']:
operateur_secretariat = request.registry.settings["operateur_secretariat"].split(",")
mail_list = request.dbsession.query(Operateur.mail).filter(Operateur.id.in_(operateur_secretariat)).all()
mail_list = [mail[0] for mail in mail_list]
@@ -139,13 +140,13 @@ def sendMailClientHorsCanton(cls, request, client_id, affaire_id):
html += "Un client hors canton et sans numéro SAP a été référencé dans la facturation de l'affaire " + str(affaire_id) + affaire_nom + " .
"
html += "" + ", ".join([
cl.entreprise if cl.entreprise is not None else " ".join([
- cl.titre if cl.titre is not None else "",
- cl.prenom if cl.prenom is not None else "",
+ cl.titre if cl.titre is not None else "",
+ cl.prenom if cl.prenom is not None else "",
cl.nom if cl.nom is not None else ""
- ]),
- cl.adresse if cl.adresse is not None else "",
+ ]),
+ cl.adresse if cl.adresse is not None else "",
" ".join([
- cl.npa if cl.npa is not None else "",
+ cl.npa if cl.npa is not None else "",
cl.localite if cl.localite is not None else ""
])
]) + " → Lien sur la fiche du client "+ " "
@@ -168,9 +169,9 @@ def sendMailClientHorsCanton(cls, request, client_id, affaire_id):
def sendMailPreavisReponse(cls, request, preavis_id):
preavis = request.dbsession.query(VAffairesPreavis).filter(VAffairesPreavis.id == preavis_id).first()
affaire = request.dbsession.query(Affaire).filter(Affaire.id == preavis.affaire_id).first()
-
+
affaire_nom = " (" + affaire.no_access + ")" if affaire.no_access is not None else ""
-
+
operateur_coordinateur_projets = request.registry.settings["operateur_coordinateur_projets"].split(",")
mail_list = request.dbsession.query(Operateur.mail).filter(Operateur.id.in_(operateur_coordinateur_projets)).all()
mail_list = [mail[0] for mail in mail_list]
@@ -178,7 +179,7 @@ def sendMailPreavisReponse(cls, request, preavis_id):
html = "Un nouveau préavis a été saisi "
html += "Le préavis du " + preavis.service + " a été saisi pour l'affaire " + str(preavis.affaire_id) + affaire_nom + " . "
html += "Il peut être consulté dans l'onglet Préavis de l'affaire, en cliquant sur le préavis en question dans le tableau.
"
-
+
send_mail(request, mail_list, "", "Infolica - Préavis saisi", html=html)
return
@@ -194,12 +195,12 @@ def sendMailPreavisDemande(cls, request, preavis_id, service_id, message=None):
em = etape_mailer.filter(EtapeMailer.operateur_id == op.id).first()
if em is not None and em.sendmail is True:
mail_list.append(op.mail)
-
+
if len(mail_list) > 0:
preavis = request.dbsession.query(VAffairesPreavis).filter(VAffairesPreavis.id == preavis_id).first()
affaire = request.dbsession.query(Affaire).filter(Affaire.id == preavis.affaire_id).first()
cadastre = request.dbsession.query(Cadastre).filter(Cadastre.id == affaire.cadastre_id).first().nom
-
+
affaire_nom = " (" + affaire.no_access + ")" if affaire.no_access is not None else ""
link = str(os.path.join(request.registry.settings['infolica_url_base'], 'preavis/edit', str(preavis_id))).replace('\\', '/')
@@ -224,7 +225,7 @@ def sendMailPreavisDemande(cls, request, preavis_id, service_id, message=None):
html += "Remarque: " + message + " "
html += ""
html += "
"
-
+
send_mail(request, mail_list, "", "Infolica - Demande de préavis" + subject_suffix, html=html, signature="Le service de la géomatique et du registre foncier")
return
diff --git a/back/infolica/views/affaire_etape.py b/back/infolica/views/affaire_etape.py
index 6dfd01dd..d34a0829 100644
--- a/back/infolica/views/affaire_etape.py
+++ b/back/infolica/views/affaire_etape.py
@@ -114,16 +114,16 @@ def etapes_new_view(request):
affaire_id = request.params['affaire_id'] if 'affaire_id' in request.params else None
chef_equipe_id = request.params['chef_equipe_id'] if 'chef_equipe_id' in request.params else None
operateur_id = request.params['operateur_id'] if 'operateur_id' in request.params else None
-
+
# Add new step
model = Utils.addNewRecord(request, AffaireEtape)
# # send mail
(lastSteps, affaire_etape_index) = MailTemplates.sendMailAffaireEtape(request, model, chef_equipe_id, operateur_id)
-
+
# update chef d'équipe in affaire
affaire = request.dbsession.query(Affaire).filter(Affaire.id == model.affaire_id).first()
- if not affaire.technicien_id == chef_equipe_id and chef_equipe_id is not None:
+ if chef_equipe_id is not None and not affaire.technicien_id == chef_equipe_id:
affaire.technicien_id = chef_equipe_id
# Finally erase attribution on affaire if etape_priority == 1 and if last etape was different
@@ -145,7 +145,7 @@ def etapes_new_view(request):
# If last step was treatment & client_facture is outside of canton and has no SAP number, send mail to secretariat
etape_traitement_id = int(request.registry.settings['affaire_etape_traitement_id'])
-
+
if (len(lastSteps) > 1 and lastSteps[1].etape_id == etape_traitement_id):
# get clients_facture
clients_factures_id = request.dbsession.query(Facture.client_id).filter(Facture.affaire_id == affaire_id).all()
@@ -256,7 +256,7 @@ def etape_index_all_view(request):
# Check connected
if not check_connected(request):
raise exc.HTTPForbidden()
-
+
affaire_etape_priorite_1_id = int(request.registry.settings['affaire_etape_priorite_1_id'])
aei = request.dbsession.query(
diff --git a/front/src/services/helper.js b/front/src/services/helper.js
index 32cd511b..805bb994 100644
--- a/front/src/services/helper.js
+++ b/front/src/services/helper.js
@@ -35,7 +35,7 @@ export const getCurrentUserRoleId = function () {
/*
* Set current user functions
*/
-export const setCurrentUserFunctions = async function () {
+export const setCurrentUserFunctions = async function () {
return new Promise ((resolve, reject) => {
axios.get(process.env.VUE_APP_API_URL + process.env.VUE_APP_CURRENT_USERS_FUNCTIONS_ENDPOINT,
{
@@ -160,9 +160,9 @@ export const setClientsAdresse_ = function(clients, sep=", ") {
let isArray = true;
if (!Array.isArray(clients)) {
isArray = false;
- clients = [clients];
+ clients = [clients];
}
-
+
clients.forEach(x => {
x.adresse_ = [
x.entreprise,
@@ -244,17 +244,17 @@ export const stringifyAutocomplete2 = function(liste, keys=["nom"], sep=", ", ne
}
if (Array.isArray(liste) === true) {
-
+
// Here are treated objects in lists
liste.forEach(x => {
let nom_ = [];
keys.forEach(key => nom_.push(x[key]));
-
+
x[new_key] = nom_.filter(Boolean).join(sep);
x.toLowerCase = () => String(x[new_key]).toLowerCase();
x.toString = () => String(x[new_key]);
});
-
+
} else {
// Here are treated objects solo
@@ -345,7 +345,7 @@ export const deleteGeneratedDocument = async function(filename) {
.then(response => resolve(response))
.catch(err => reject(err));
});
- });
+ });
};
/**
@@ -380,7 +380,7 @@ export const filterList = function(list, searchTerm, nLetters=0) {
};
/**
- * Set date format
+ * Set date format
*/
export const setDateFormatClient = function(obj) {
// test dates to set them to client format
From 125dccae481a4b1408dba742dc6886799ee7d0bc Mon Sep 17 00:00:00 2001
From: Marc Rufener
Date: Wed, 27 Mar 2024 11:51:13 +0100
Subject: [PATCH 7/7] add reload_without_cache button into notes_MAJ
---
front/src/components/NotesMAJ/NotesMAJ.vue | 9 ++++++++-
front/src/components/NotesMAJ/notesMAJ.html | 1 +
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/front/src/components/NotesMAJ/NotesMAJ.vue b/front/src/components/NotesMAJ/NotesMAJ.vue
index 2fd483d2..e512762d 100644
--- a/front/src/components/NotesMAJ/NotesMAJ.vue
+++ b/front/src/components/NotesMAJ/NotesMAJ.vue
@@ -276,6 +276,13 @@ export default {
this.showNotesMAJ = false;
//set main_div height
this.updateMainDivHeight();
+ },
+
+ /**
+ * Reload without cache
+ */
+ reloadWithoutCache() {
+ location.reload(true);
}
},
@@ -283,7 +290,7 @@ export default {
mounted: function(){
this.getVersion();
this.getPermissions();
-
+
if (JSON.parse(localStorage.getItem("infolica_user")) && JSON.parse(localStorage.getItem("infolica_user")).id) {
this.compareOperateurVersionWithCurrentVersion();
}
diff --git a/front/src/components/NotesMAJ/notesMAJ.html b/front/src/components/NotesMAJ/notesMAJ.html
index 8251f1e2..dbdec72d 100644
--- a/front/src/components/NotesMAJ/notesMAJ.html
+++ b/front/src/components/NotesMAJ/notesMAJ.html
@@ -5,6 +5,7 @@
Information
+ replay
add
close