diff --git a/_get_config.html b/_get_config.html index 3fe6f2d..c95aaf7 100644 --- a/_get_config.html +++ b/_get_config.html @@ -6,7 +6,7 @@ *}} {{* config par défaut *}} -{{:read file="./default.json" assign="config_defaut"}} +{{:read file="./defaut.json" assign="config_defaut"}} {{:assign config_defaut=$config_defaut|json_decode}} {{:assign var="directions.input" value="entrée"}} diff --git a/_nav.html b/_nav.html index 4e69986..78b0cb5 100644 --- a/_nav.html +++ b/_nav.html @@ -6,7 +6,7 @@ {{if $subsubcurrent == null && $cat == 0}} {{:linkbutton label="Ajouter une catégorie" shape="plus" href="categories/add_category.html" target="_dialog"}} {{else}} - {{:linkbutton label="Ajouter un nouveau matériel" shape="plus" href="movements/add_new_equipment.html" target="_dialog"}} + {{:linkbutton label="Ajouter un nouveau matériel" shape="plus" href="mouvements/ajouter_entree.html" target="_dialog"}} {{/if}} {{/if}} @@ -46,8 +46,8 @@ {{elseif $subcurrent == 'typesES'}} {{/if}}
Il n'y a aucune catégorie : vous devez en ajouter.
{{else}} - {{if $_GET.prop == null || $_GET.prop == "1"}} - {{:include file="./_inventory.html"}} + {{if $_GET.prop == null || $_GET.prop}} + {{:include file="./inventaire.html"}} {{else}} - {{:include file="./_temp_inventory.html"}} + {{:include file="./inventaire_nonprop.html"}} {{/if}} {{/if}} diff --git a/_inventory.html b/inventaire.html similarity index 86% rename from _inventory.html rename to inventaire.html index 1a84d48..e41f239 100644 --- a/_inventory.html +++ b/inventaire.html @@ -34,7 +34,7 @@ {{:assign condition="1"}} {{else}} {{:assign cat_key=$_GET.cat_key|quote_sql}} - {{:assign condition="$$.category = %s"|args:$cat_key}} + {{:assign condition="$$.category == %s"|args:$cat_key}} {{/if}} {{#list @@ -63,21 +63,21 @@ {{:linkbutton label="Sortie" shape="minus" - href="movements/output_equipment.html?key=%s"|args:$key + href="mouvements/sorties/stock_disponible.html?key=%s"|args:$key target="_dialog"}} {{/if}} {{:linkbutton label="Entrée" shape="plus" - href="movements/input_equipment.html?key=%s"|args:$key + href="mouvements/entrees/repertorie.html?key=%s"|args:$key target="_dialog"}} {{:linkbutton label="Historique" - href="equipment_history.html?key=%s&prop=1"|args:$key + href="historique.html?key=%s&prop=1"|args:$key shape="table"}} {{:linkbutton label="Modifier" - href="modify_equipment.html?key=%s&prop=1"|args:$key + href="modifier_materiel.html?key=%s&prop=1&stock=%s"|args:$key:$col3 shape="edit" target="_dialog"}} diff --git a/_temp_inventory.html b/inventaire_nonprop.html similarity index 87% rename from _temp_inventory.html rename to inventaire_nonprop.html index bf8db8a..f02db5b 100644 --- a/_temp_inventory.html +++ b/inventaire_nonprop.html @@ -34,7 +34,7 @@ {{:assign condition="1"}} {{else}} {{:assign cat_key=$_GET.cat_key|quote_sql}} - {{:assign condition="$$.category = %s"|args:$cat_key}} + {{:assign condition="$$.category == %s"|args:$cat_key}} {{/if}} {{#list @@ -58,15 +58,15 @@ {{:linkbutton label="Entrée" shape="plus" - href="movements/input_equipment.html?key=%s"|args:$key + href="mouvements/entrees/repertorie.html?key=%s"|args:$key target="_dialog"}} {{:linkbutton label="Historique" - href="equipment_history.html?key=%s&prop=0"|args:$key + href="historique.html?key=%s&prop=0"|args:$key shape="table"}} {{:linkbutton label="Modifier" - href="modify_equipment.html?key=%s&prop=0"|args:$key + href="modifier_materiel.html?key=%s&prop=0"|args:$key shape="edit" target="_dialog"}} diff --git a/modify_equipment.html b/modifier_materiel.html similarity index 89% rename from modify_equipment.html rename to modifier_materiel.html index d36c78b..10c0ce2 100644 --- a/modify_equipment.html +++ b/modifier_materiel.html @@ -3,7 +3,7 @@ {{* Paramètres : - key : clé du matériel à modifier - - prop : =1 si matériel propriété de l'association, 0 sinon + - prop : =1 si matériel propriété de l'association *}} {{:assign equipment_key=$_GET.key|trim}} @@ -17,11 +17,9 @@ {{#form on="save"}} {{if $_POST.archive == 1}} - {{* vérifier les qunatités *}} - {{if $_GET.prop == 1 && $equipment.stock != 0}} + {{* vérifier si le stock est nul *}} + {{if $_GET.stock != 0}} {{:error message="L'archivage n'est possible que si le stock est nul !"}} - {{elseif $_GET.prop == 0 && $equipment.notowned != 0}} - {{:error message="L'archivage n'est possible que s'il n'y a plus de matériel présent temporairement"}} {{/if}} {{* archiver le matériel *}} {{:save diff --git a/module.ini b/module.ini index 3e8e269..51027ff 100644 --- a/module.ini +++ b/module.ini @@ -1,5 +1,5 @@ name="Gestion des matériels" -description="Permet de gérer un inventaire de matériels, ainsi que de suivre les prêts (en test)." +description="Gestion des matériels: stock, entrées, sorties." author="Jean-Christophe Engel" author_url="https://git.roflcopter.fr/lesanges" home_button=false diff --git a/movements/add_new_equipment.html b/mouvements/ajouter_entree.html similarity index 100% rename from movements/add_new_equipment.html rename to mouvements/ajouter_entree.html diff --git a/movements/copy_movement.html b/mouvements/dupliquer_mouvement.html similarity index 98% rename from movements/copy_movement.html rename to mouvements/dupliquer_mouvement.html index 6c76a55..aea6877 100644 --- a/movements/copy_movement.html +++ b/mouvements/dupliquer_mouvement.html @@ -66,11 +66,11 @@ -------------------- Traiter la saisie -------------------- *}} {{#form on="save"}} - {{* vérifier la validité de la saisie *}} {{if $_POST.amount <= 0}} {{:error message="La quantité (%s) doit être strictement positive !!"|args:$_POST.amount}} {{/if}} + {{* vérifier la validité de la saisie *}} {{if $_POST.date|parse_date|strtotime > $now}} {{:error message="Impossible de saisir une date dans le futur (%s)"|args:$_POST.date}} {{/if}} @@ -135,7 +135,7 @@ {{* Vérifier la cohérence des mouvements du matériel *}} {{:include - file="./_validate_modification.html" + file="./valider_modification.html" keep="erreur" movements=$movements_new }} @@ -192,7 +192,7 @@ user=$user.id storage=$_POST.storage }} - {{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=copie"|args:$eqpmt_key:$prop}} + {{:redirect force="../historique.html?ok=1&key=%s&prop=%s&msg=copie"|args:$eqpmt_key:$prop}} {{/form}} {{:admin_header title="Dupliquer un mouvement" current="module_equipment"}} diff --git a/movements/input_equipment.html b/mouvements/entrees/repertorie.html similarity index 89% rename from movements/input_equipment.html rename to mouvements/entrees/repertorie.html index cca0b0d..f366d36 100644 --- a/movements/input_equipment.html +++ b/mouvements/entrees/repertorie.html @@ -8,11 +8,11 @@ {{* barre de navigation *}} {{if ! $dialog}} - {{:include file="../_nav.html" current="entrees"}} + {{:include file="../../_nav.html" current="entrees"}} {{/if}} {{* récupérer la config des entrées/sorties *}} -{{:include file="../_get_config.html" keep="config"}} +{{:include file="../../_get_config.html" keep="config"}} {{* types d'entrées *}} {{#foreach from=$config.input_nature key=key}} @@ -50,7 +50,7 @@ {{:save key=$equipment.key - validate_schema="../equipment.schema.json" + validate_schema="../../equipment.schema.json" type="equipment" category=$equipment.category name=$equipment.name @@ -64,7 +64,7 @@ {{:assign mvt_key=""|uuid}} {{:save key=$mvt_key - validate_schema="./movement.schema.json" + validate_schema="../movement.schema.json" type="movement" direction="input" operation=$_POST.operation @@ -80,10 +80,10 @@ {{else}} {{:assign prop=1}} {{/if}} - {{:redirect force="../equipment_history.html?key=%s&ok=1&msg=entrée&prop=%s"|args:$equipment.key:$prop}} + {{:redirect force="../../historique.html?key=%s&ok=1&msg=entrée&prop=%s"|args:$equipment.key:$prop}} {{/form}} -{{:admin_header title="Entrée de matériel" custom_css="./../style.css" current="module_equipment"}} +{{:admin_header title="Entrée de matériel" custom_css="./../../style.css" current="module_equipment"}} {{:form_errors}} {{* formulaire de saisie d'une entrée de matériel *}} diff --git a/movements/input_return.html b/mouvements/input_return.html similarity index 96% rename from movements/input_return.html rename to mouvements/input_return.html index a311473..a47615c 100644 --- a/movements/input_return.html +++ b/mouvements/input_return.html @@ -107,7 +107,7 @@ {{* Vérifier la cohérence des mouvements du matériel *}} {{:include - file="./_validate_modification.html" + file="./valider_modification.html" keep="erreur, pb" movements=$movements_new }} @@ -161,10 +161,10 @@ temp_key=$_GET.key return=$mvt_key }} - {{:redirect force="../equipment_history.html?ok=1&key=%s&prop=0&msg=retour"|args:$mvt_new.equipment}} + {{:redirect force="../historique.html?ok=1&key=%s&prop=0&msg=retour"|args:$mvt_new.equipment}} {{/form}} -{{:admin_header title="Retour de matériel" custom_css="../style.css" current="module_equipment"}} +{{:admin_header title="Retour de matériel" custom_css="./../../style.css" current="module_equipment"}} {{:form_errors}} {{* barre de navigation *}} diff --git a/movements/link.schema.json b/mouvements/link.schema.json similarity index 100% rename from movements/link.schema.json rename to mouvements/link.schema.json diff --git a/movements/modify_movement.html b/mouvements/modifier_mouvement.html similarity index 93% rename from movements/modify_movement.html rename to mouvements/modifier_mouvement.html index 93b3ca3..a199dd9 100644 --- a/movements/modify_movement.html +++ b/mouvements/modifier_mouvement.html @@ -126,7 +126,7 @@ {{* Vérifier la cohérence des mouvements du matériel *}} {{:include - file="./_validate_modification.html" + file="./valider_modification.html" keep="erreur" movements=$movements_new }} @@ -175,6 +175,25 @@ {{/if}} {{/if}} + {{if $equipment.stock == 0}} + {{* vérifier s'il y a au moins une entrée définitive *}} + {{:assign entree_def=false}} + {{#foreach from=$config.input_nature key=key}} + {{if $type == 'définitif'}} + {{:assign var="input_types." value=$key}} + {{/if}} + {{/foreach}} + {{#foreach from=$movements_new}} + {{if $operation|in:$input_types}} + {{:assign entree_def=true}} + {{:break}} + {{/if}} + {{/foreach}} + {{if ! $entree_def}} + {{:assign var="equipment.stock" value=null}} + {{/if}} + {{/if}} + {{:save key=$equipment.key validate_schema="../equipment.schema.json" @@ -207,7 +226,7 @@ user=$user_id storage=$_POST.storage }} - {{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=modification"|args:$eqpmt_key:$prop}} + {{:redirect force="../historique.html?ok=1&key=%s&prop=%s&msg=modification"|args:$eqpmt_key:$prop}} {{/form}} {{:admin_header title="Modifier un mouvement" current="module_equipment"}} diff --git a/movements/movement.schema.json b/mouvements/movement.schema.json similarity index 100% rename from movements/movement.schema.json rename to mouvements/movement.schema.json diff --git a/movements/output_return.html b/mouvements/output_return.html similarity index 96% rename from movements/output_return.html rename to mouvements/output_return.html index 49d09e9..aa011b0 100644 --- a/movements/output_return.html +++ b/mouvements/output_return.html @@ -107,7 +107,7 @@ {{* Vérifier la cohérence des mouvements du matériel *}} {{:include - file="./_validate_modification.html" + file="./valider_modification.html" keep="erreur, pb" movements=$movements_new }} @@ -162,13 +162,13 @@ return=$mvt_key }} {{if $_GET.user == null}} - {{:redirect force="../equipment_history.html?ok=1&key=%s&prop=1&msg=retour"|args:$mvt_new.equipment}} + {{:redirect force="../historique.html?ok=1&key=%s&prop=1&msg=retour"|args:$mvt_new.equipment}} {{else}} {{:redirect force="/admin/users/details.php?id=%s"|args:$_GET.user}} {{/if}} {{/form}} -{{:admin_header title="Retour de matériel" custom_css="../style.css" current="module_equipment"}} +{{:admin_header title="Retour de matériel" custom_css="./../../style.css" current="module_equipment"}} {{:form_errors}} {{* barre de navigation *}} diff --git a/movements/output_equipment.html b/mouvements/sorties/stock_disponible.html similarity index 94% rename from movements/output_equipment.html rename to mouvements/sorties/stock_disponible.html index 38af7f9..eec388e 100644 --- a/movements/output_equipment.html +++ b/mouvements/sorties/stock_disponible.html @@ -6,7 +6,7 @@ *}} {{* récupérer la config des entrées/sorties *}} -{{:include file="../_get_config.html" keep="config"}} +{{:include file="../../_get_config.html" keep="config"}} {{* types de sorties *}} {{#foreach from=$config.output_nature key=key}} @@ -119,7 +119,7 @@ {{:save key=$equipment.key - validate_schema="../equipment.schema.json" + validate_schema="../../equipment.schema.json" type="equipment" category=$equipment.category name=$equipment.name @@ -133,7 +133,7 @@ {{:assign mvt_key=""|uuid}} {{:save key=$mvt_key - validate_schema="./movement.schema.json" + validate_schema="../movement.schema.json" type="movement" direction="output" operation=$_POST.operation @@ -143,13 +143,13 @@ comment=$_POST.remarques|trim user=$user.id }} - {{:redirect force="../equipment_history.html?ok=1&key=%s&prop=1&msg=sortie"|args:$_GET.key}} + {{:redirect force="../../historique.html?ok=1&key=%s&prop=1&msg=sortie"|args:$_GET.key}} {{/form}} -{{:admin_header title="Sortie de matériel" custom_css="./../style.css" current="module_equipment"}} +{{:admin_header title="Sortie de matériel" custom_css="./../../style.css" current="module_equipment"}} {{if ! $dialog}} {{* barre de navigation *}} - {{:include file="../_nav.html" current="sorties"}} + {{:include file="../../_nav.html" current="sorties"}} {{/if}} {{#load key=$equipment.category assign="category"}}{{/load}} diff --git a/movements/delete_movement.html b/mouvements/supprimer_mouvement.html similarity index 91% rename from movements/delete_movement.html rename to mouvements/supprimer_mouvement.html index aea6243..6a91b3b 100644 --- a/movements/delete_movement.html +++ b/mouvements/supprimer_mouvement.html @@ -29,7 +29,7 @@ {{:assign link_key=$key}} {{/load}} {{if $link_key != null}} - {{:redirect force="../equipment_history.html?key=%s&prop=%s&err=1&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}} + {{:redirect force="../historique.html?key=%s&prop=%s&err=1&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}} {{/if}} {{else}} {{:assign dispo=0}} @@ -62,7 +62,7 @@ {{* problème ? *}} {{if $dispo < 0 || $nonprop < 0}} - {{:redirect force="../equipment_history.html?key=%s&prop=%s&err=1&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}} + {{:redirect force="../historique.html?key=%s&prop=%s&err=1&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}} {{/if}} {{/if}} {{/load}} @@ -83,7 +83,7 @@ {{:assign link_key=$key}} {{/load}} {{if $link_key != null}} - {{:redirect force="../equipment_history.html?key=%s&prop=%s&err=1&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}} + {{:redirect force="../historique.html?key=%s&prop=%s&err=1&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}} {{/if}} {{elseif $type_operation == 'retour'}} {{#load type="link" where="$$.return = :key" :key=$_GET.key}} @@ -148,7 +148,7 @@ out=$curr_eqpmt.out notowned=$curr_eqpmt.notowned }} - {{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}} + {{:redirect force="../historique.html?ok=1&key=%s&prop=%s&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}} {{else}} {{* supprimer le matériel *}} {{:delete key=$curr_eqpmt.key}} diff --git a/movements/_validate_modification.html b/mouvements/valider_modification.html similarity index 100% rename from movements/_validate_modification.html rename to mouvements/valider_modification.html diff --git a/snippets/user_details.html b/snippets/user_details.html index 6d364be..07cf0ee 100644 --- a/snippets/user_details.html +++ b/snippets/user_details.html @@ -80,7 +80,7 @@ {{if $direction == "output" && $type_mvt == "temporaire"}} {{:linkbutton label="Retour" - href="%smovements/output_return.html?key=%s&prop=0&user=%s"|args:$module.url:$mvt_key:$user.id + href="%smouvements/output_return.html?key=%s&prop=0&user=%s"|args:$module.url:$mvt_key:$user.id shape="history" target="_dialog"}} {{/if}} diff --git a/storage/delete_storage.html b/storage/delete_storage.html index 03facb6..b50e1a6 100644 --- a/storage/delete_storage.html +++ b/storage/delete_storage.html @@ -17,7 +17,7 @@ {{/form}} -{{:admin_header title="Lieux de stockage" custom_css="../style.css" current="module_equipment"}} +{{:admin_header title="Lieux de stockage" custom_css="./style.css" current="module_equipment"}} {{:form_errors}} {{#load key=$_GET.key limit="1" assign="store"}}{{/load}} diff --git a/style.css b/style.css index 2193b11..63d6ca6 100644 --- a/style.css +++ b/style.css @@ -2,6 +2,13 @@ margin-top : 0.5em; } +/* +.informations legend { + font-weight: bold; + border-bottom : solid 1px; + margin-bottom : 0.5em; +} +*/ .informations dt::after { content: ' :'; }