diff --git a/_nav.html b/_nav.html
index e2e6170..dfdf9ef 100644
--- a/_nav.html
+++ b/_nav.html
@@ -60,7 +60,9 @@
{{/if}}
diff --git a/config.html b/config.html
index f5bb3ec..9927c5e 100644
--- a/config.html
+++ b/config.html
@@ -12,21 +12,14 @@
{{/if}}
{{* lecture config (défaut ou enregistrée) *}}
-{{:include file="./_get_config.html" keep="config_defaut, config, directions"}}
-
-{{* interdire la modification et la suppression des types de mouvement prédéfinis *}}
-{{#foreach from=$directions key="direction"}}
- {{:assign var="nature" from="config_defaut.%ss"|args:$direction}}
- {{#foreach from=$nature item="elem"}}
- {{:assign var="default_keys." value=$key}}
- {{/foreach}}
-{{/foreach}}
+{{:include file="./_get_config.html" keep="config, directions"}}
{{#foreach from=$directions key="direction" item="item"}}
{{* types de mouvements qui ne peuvent être supprimés *}}
{{#load type="movement" where="$$.direction='%s'"|args:$direction group="$$.operation"}}
- {{:assign var="locked." value=$operation}}
+ {{:assign var="op_label" from="config.%s_nature.%s.label"|args:$direction:$operation}}
+ {{:assign var="locked_%ss."|args:$direction value=$op_label}}
{{/load}}
{{$item|ucfirst}}s
@@ -45,12 +38,11 @@
{{$label}} |
{{$type}} |
- {{if ! $default_keys|has:$key && ! $locked|has:$key}}
+ {{:assign var="locked" from="locked_%ss"|args:$direction}}
+ {{if ! $locked|has:$label}}
{{:linkbutton label="Supprimer" shape="delete" href="config/delete_movement_type.html?dir=%s&op_key=%s"|args:$direction:$key target="_dialog"}}
{{/if}}
- {{if ! $default_keys|has:$key}}
{{:linkbutton label="Modifier" shape="edit" href="config/modify_movement_type.html?dir=%s&op_key=%s"|args:$direction:$key target="_dialog"}}
- {{/if}}
|
{{/foreach}}
diff --git a/config/add_movement_type.html b/config/add_movement_type.html
index c5e827f..06881dc 100644
--- a/config/add_movement_type.html
+++ b/config/add_movement_type.html
@@ -12,28 +12,18 @@
{{* lecture config *}}
{{:include file="../_get_config.html" keep="config, directions, config_defaut"}}
-{{if ! $directions|has_key:$_GET.dir}}
- {{:error message="Direction « %s » inconnue !"|args:$_GET.dir}}
-{{/if}}
-
{{#form on="save"}}
- {{if $_POST.output_fields.type == "temporaire"}}
- {{* vérifier si le tarif a été choisi *}}
- {{if $_POST.tarif == null}}
- {{:error message="Vous n'avez pas choisi le tarif"}}
- {{/if}}
- {{/if}}
-
{{* 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" item="elem"}}
+ {{#foreach from=$nature key="key"}}
{{:assign var="fields" from="_POST.%s_fields"|args:$_GET.dir}}
- {{if $_GET.dir == $direction && $fields.label|trim|tolower == $elem.label|trim|tolower}}
- {{:error message="Le libellé « %s » est déjà présent"|args:$fields.label}}
+ {{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"|args:$direction value=$elem}}
{{:assign var="%s_nature.key"|args:$direction value=$key}}
+ {{:assign var="%s_nature.label"|args:$direction value=$label}}
+ {{:assign var="%s_nature.type"|args:$direction value=$type}}
{{:assign var="%s_natures."|args:$direction from="%s_nature"|args:$direction}}
{{/foreach}}
@@ -44,13 +34,6 @@
{{:assign var="%s_nature.key"|args:$direction value=""|uuid}}
{{:assign var="%s_nature.label"|args:$direction value=$newlabel}}
{{:assign var="%s_nature.type"|args:$direction from="_POST.%s_fields.type"|args:$direction}}
- {{if $_POST.output_fields != null}}
- {{if $_POST.output_fields.type == "temporaire"}}
- {{:assign var="output_nature.fee" value=$_POST.tarif}}
- {{else}}
- {{:assign var="output_nature.fee" value=null}}
- {{/if}}
- {{/if}}
{{:assign var="%s_natures."|args:$direction from="%s_nature"|args:$direction}}
{{/if}}
{{/foreach}}
@@ -121,28 +104,28 @@