From 56d4f729e30d40a2ed734a7484af74589e9cd4dc Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Wed, 22 Oct 2025 17:26:18 +0200 Subject: [PATCH] =?UTF-8?q?Correction=20d=C3=A9tection=20libell=C3=A9=20en?= =?UTF-8?q?tr=C3=A9e/sortie=20d=C3=A9j=C3=A0=20pr=C3=A9sent=20dans=20confi?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _get_config.html | 7 +++---- config/add_movement_type.html | 13 ++++++------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/_get_config.html b/_get_config.html index 8f36df8..095dff9 100644 --- a/_get_config.html +++ b/_get_config.html @@ -1,9 +1,8 @@ {{* -*- brindille -*- *}} {{* - Récupérer soit la config enregistrée, soit la config par défaut - @param : default = true si config par défaut - résultat : config.input_nature et config.output_nature + Récupérer la config + résultat : config_defaut, directions, config.input_nature et config.output_nature *}} {{* config par défaut *}} @@ -15,7 +14,7 @@ {{#foreach from=$directions key="direction"}} {{:assign var="nature" from="module.config.%s_nature"|args:$direction}} - {{if $nature != null && ! $default}} + {{if $nature != null}} {{#foreach from=$nature item="elem"}} {{:assign var="item" label=$label type=$type}} {{:assign var="config.%s_nature.%s"|args:$direction:$key value=$item}} diff --git a/config/add_movement_type.html b/config/add_movement_type.html index bb7d64b..226311f 100644 --- a/config/add_movement_type.html +++ b/config/add_movement_type.html @@ -12,16 +12,16 @@ {{* Traiter l'envoi du formulaire *}} -{{* lecture config par défaut *}} -{{:include file="../_get_config.html" keep="config, directions" default=true}} +{{* lecture config *}} +{{:include file="../_get_config.html" keep="config, directions, config_defaut"}} {{#form on="save"}} - {{* vérifier s'il existe un type de mouvement de même nom *}} + {{* vérifier s'il existe un libellé de même nom dans la même direction *}} {{#foreach from=$directions key="direction"}} {{:assign var="nature" from="config.%s_nature"|args:$direction}} {{#foreach from=$nature key="key"}} {{:assign var="fields" from="_POST.%s_fields"|args:$_GET.dir}} - {{if $label|trim|tolower == $fields.label|trim|tolower}} + {{if $_GET.dir == $direction && $label|trim|tolower == $fields.label|trim|tolower}} {{:error message="Ce libellé est déjà présent"}} {{/if}} {{:assign var="%s_nature.key"|args:$direction value=$key}} @@ -39,7 +39,6 @@ {{:assign var="%s_nature.type"|args:$direction from="_POST.%s_fields.type"|args:$direction}} {{:assign var="%s_natures."|args:$direction from="%s_nature"|args:$direction}} {{/if}} - {{/foreach}} {{:save @@ -56,7 +55,7 @@ {{if $_GET.dir == 'input'}} {{* types d'entrées *}} - {{#foreach from=$config.input_nature}} + {{#foreach from=$config_defaut.inputs}} {{:assign var='input_types.%s'|args:$type value=$type}} {{/foreach}}
@@ -95,7 +94,7 @@
{{else}} {{* types de sorties *}} - {{#foreach from=$config.output_nature}} + {{#foreach from=$config_defaut.outputs}} {{:assign var='output_types.%s'|args:$type value=$type}} {{/foreach}}