diff --git a/_get_config.html b/_get_config.html index 671a20e..119a20b 100644 --- a/_get_config.html +++ b/_get_config.html @@ -16,7 +16,7 @@ {{:assign var="nature" from="module.config.%s_nature"|args:$direction}} {{if $nature != null}} {{#foreach from=$nature item="elem"}} - {{:assign var="item" label=$label type=$type fee=$fee}} + {{:assign var="item" label=$label type=$type}} {{:assign var="config.%s_nature.%s"|args:$direction:$key value=$item}} {{/foreach}} {{else}} diff --git a/_inventory.html b/_inventory.html index 53e9566..090a01d 100644 --- a/_inventory.html +++ b/_inventory.html @@ -1,56 +1,40 @@ {{* -*- brindille -*- *}} {{* - Inventaire des matériels en stock dans l'association + inventaire des entrées/sorties des matériels permanents *}} {{* filtrer selon la catégorie *}} {{if $_GET.cat_key == null}} {{:assign selected_category=$module.config.stock_cat_key}} + {{if $module.config.stock_cat_key != null}} + {{:assign cat_key=$selected_category|quote_sql}} + {{/if}} {{elseif $_GET.cat_key == -1}} {{:assign selected_category=null}} {{:save key="config" stock_cat_key=null}} {{else}} {{:assign selected_category=$_GET.cat_key}} + {{:assign cat_key=$selected_category|quote_sql}} {{:save key="config" stock_cat_key=$selected_category}} {{/if}} {{* condition de filtrage *}} {{if $selected_category != null}} - {{:assign cat_key=$selected_category|quote_sql}} {{:assign cat_condition="$$.category = %s"|args:$cat_key}} {{else}} {{:assign cat_condition="1"}} {{/if}} -{{* filtrer selon appartenance *}} -{{if $_GET.prop == null}} - {{:assign selected_prop=$module.config.stock_prop}} -{{elseif $_GET.prop == -1}} - {{:assign selected_prop=null}} - {{:save key="config" stock_prop=null}} -{{else}} - {{:assign selected_prop=$_GET.prop}} - {{:save key="config" stock_prop=$_GET.prop}} -{{/if}} - -{{if $selected_prop == null}} - {{:assign prop_condition="1"}} -{{elseif $selected_prop == 1}} - {{:assign prop_condition="$$.stock NOT NULL"}} -{{else}} - {{:assign prop_condition="$$.notowned != 0"}} -{{/if}} - -{{* sélecteurs de catégorie et d'appartenance *}} -{{:assign var="cat_options." value="" label="Toutes les catégories" href="?cat_key=-1"}} +{{* Sélecteur catégories *}} +{{:assign var="cat_options." value="" label="Toutes les catégories" href="?cat_key=-1&prop=1"}} {{#load type="category" order="$$.name"}} {{:assign var="categories.%s"|args:$key value=$name}} {{:assign var="cat_options." value=$key label=$name - href="?cat_key=%s"|args:$key + href="?cat_key=%s&prop=1"|args:$key }} {{/load}} @@ -63,21 +47,8 @@ }} -{{:assign var="prop_options." value="" label="Tous les matériels" href="?prop=-1"}} -{{:assign var="prop_options." value="1" label="Matériels propriété de l'association" href="?prop=1"}} -{{:assign var="prop_options." value="0" label="Matériels NON propriété de l'association" href="?prop=0"}} - -
-Inventaire des matériels présents dans l'association
+Inventaire des matériels propriété de l'association
Inventaire des matériels empruntés ou loués
-{{* filtrer selon la catégorie *}} -{{if $_GET.cat_key == null}} - {{:assign condition="1"}} -{{else}} - {{:assign cat_key=$_GET.cat_key|quote_sql}} - {{:assign condition="$$.category = %s"|args:$cat_key}} -{{/if}} - {{#list select=" $$.name AS 'Matériel' ; @@ -46,7 +60,7 @@ $$.notowned AS 'Quantité' " type="equipment" - where="$$.status <> 'archived' AND $$.notowned != 0 AND %s"|args:$condition + where="$$.status <> 'archived' AND $$.notowned != 0 AND %s"|args:$cat_condition order=1 }} {{:assign var=cat_name from=categories.%s|args:$category}} diff --git a/archives.html b/archives.html index efb1a22..261673c 100644 --- a/archives.html +++ b/archives.html @@ -9,30 +9,11 @@Matériel remis en service
{{/if}} -{{* filtrer selon la catégorie *}} -{{if $_GET.cat_key == null}} - {{:assign selected_category=$module.config.archive_cat_key}} -{{elseif $_GET.cat_key == -1}} - {{:assign selected_category=null}} - {{:save key="config" archive_cat_key=null}} -{{else}} - {{:assign selected_category=$_GET.cat_key}} - {{:save key="config" archive_cat_key=$selected_category}} -{{/if}} - -{{* condition de filtrage *}} -{{if $selected_category == null}} - {{:assign cat_condition="1"}} -{{else}} - {{:assign cat_key=$selected_category|quote_sql}} - {{:assign cat_condition="$$.category == %s"|args:$cat_key}} -{{/if}} - {{* Sélecteur catégories *}} -{{:assign var="cat_options." value="" label="Toutes les catégories" href="?cat_key=-1"}} +{{:assign var="options." value="" label="Toutes les catégories" href="?prop=1"}} {{#load type="category" order="$$.name"}} {{:assign - var="cat_options." + var="options." value=$key label=$name href="?cat_key=%s"|args:$key @@ -43,8 +24,8 @@ {{:dropdown title="Filtrer par catégorie" - options=$cat_options - value="%s"|args:$selected_category + options=$options + value="%s"|args:$_GET.cat_key }} @@ -52,6 +33,14 @@Matériels qui ne sont plus dans l'association
+{{* filtrer selon la catégorie *}} +{{if $_GET.cat_key == null}} + {{:assign condition="1"}} +{{else}} + {{:assign cat_key=$_GET.cat_key|quote_sql}} + {{:assign condition="$$.category == %s"|args:$cat_key}} +{{/if}} + {{* Liste des matériels archivés *}} {{#list select=" @@ -61,7 +50,7 @@ WHERE cat.key = @TABLE.$$.category) AS "Catégorie" " type="equipment" - where="$$.status='archived' AND %s"|args:$cat_condition + where="$$.status='archived' AND %s"|args:$condition order=1 }} 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}}