Compare commits
No commits in common. "main" and "v0.47" have entirely different histories.
@ -1,7 +1,5 @@
|
||||
# Module de gestion de matériels pour Paheko
|
||||
|
||||
## Ce dépôt n'est plus mis à jour ; nouvel emplacement https://gitea.zaclys.com/lesanges/equipment
|
||||
|
||||
Ce module permet de gérer les matériels de l'association: stock,
|
||||
entrées, sorties, classés par catégorie.
|
||||
|
||||
|
@ -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"}}
|
||||
|
18
_nav.html
18
_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}}
|
||||
</aside>
|
||||
{{/if}}
|
||||
@ -15,6 +15,7 @@
|
||||
<li {{if $current == 'inventaire'}} class="current"{{/if}}><a href="{{$module.url}}index.html?prop=1">Inventaire</a></li>
|
||||
<li {{if $current == 'historique'}} class="current"{{/if}}><a href="{{$module.url}}global_history.html">Historique</a></li>
|
||||
<li {{if $current == 'archives'}} class="current"{{/if}}><a href="{{$module.url}}archives.html">Archives</a></li>
|
||||
<li {{if $current == 'storage'}} class="current"{{/if}}><a href="{{$module.url}}storage/index.html">Stockage</a></li>
|
||||
<li {{if $current == 'config'}} class="current"{{/if}}><a href="{{$module.url}}categories/index.html">Configuration</a></li>
|
||||
</ul>
|
||||
|
||||
@ -35,24 +36,23 @@
|
||||
<li class="title"><strong>Historique — {{$eqpmt}} ({{$category}})</strong></li>
|
||||
</ul>
|
||||
{{/if}}
|
||||
{{elseif $current == 'storage'}}
|
||||
<aside>
|
||||
{{:linkbutton label="Ajouter un lieu de stockage" shape="plus" href="add_storage.html" target="_dialog"}}
|
||||
</aside>
|
||||
{{elseif $current == 'config'}}
|
||||
{{if $subcurrent == 'categories'}}
|
||||
<aside>
|
||||
{{:linkbutton label="Ajouter une catégorie" shape="plus" href="add_category.html" target="_dialog"}}
|
||||
</aside>
|
||||
{{elseif $subcurrent == 'storage'}}
|
||||
<aside>
|
||||
{{:linkbutton label="Ajouter un lieu de stockage" shape="plus" href="add_storage.html" target="_dialog"}}
|
||||
</aside>
|
||||
{{elseif $subcurrent == 'typesES'}}
|
||||
<aside>
|
||||
{{:linkbutton label="Ajouter un type d'entrée" shape="plus" href="config/add_movement_type.html?dir=input" target="_dialog"}}
|
||||
{{:linkbutton label="Ajouter un type de sortie" shape="plus" href="config/add_movement_type.html?dir=output" target="_dialog"}}
|
||||
{{:linkbutton label="Ajouter un type d'entrée" shape="plus" href="config/ajouter_type_mouvement.html?dir=input" target="_dialog"}}
|
||||
{{:linkbutton label="Ajouter un type de sortie" shape="plus" href="config/ajouter_type_mouvement.html?dir=output" target="_dialog"}}
|
||||
</aside>
|
||||
{{/if}}
|
||||
<ul class="sub">
|
||||
<ul class="sub" >
|
||||
<li {{if $subcurrent == 'categories'}} class="current"{{/if}}><a href="{{$module.url}}categories/index.html">Catégories</a></li>
|
||||
<li {{if $subcurrent == 'storage'}} class="current"{{/if}}><a href="{{$module.url}}storage/index.html">Lieux de stockage</a></li>
|
||||
<li {{if $subcurrent == 'typesES'}} class="current"{{/if}}><a href="{{$module.url}}config.html">Types d'entrées/sorties</a></li>
|
||||
</ul>
|
||||
{{/if}}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{:admin_header title="Matériels archivés" current="module_equipment"}}
|
||||
{{:admin_header title="Matériels archivés" custom_css=$custom_css current="module_equipment"}}
|
||||
{{:include file="_nav.html" current="archives"}}
|
||||
|
||||
{{if $_GET.ok}}
|
||||
@ -54,7 +54,7 @@
|
||||
<td class="actions">
|
||||
{{:linkbutton
|
||||
label="Historique"
|
||||
href="equipment_history.html?key=%s&prop=1¤t=archives"|args:$key
|
||||
href="historique.html?key=%s&prop=1¤t=archives"|args:$key
|
||||
shape="table"}}
|
||||
{{:linkbutton
|
||||
label="Modifier"
|
||||
|
@ -38,9 +38,9 @@
|
||||
<td class="actions">
|
||||
{{: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"}}
|
||||
{{:linkbutton label="Supprimer" shape="delete" href="config/supprimer_type_mouvement.html?dir=%s&op_key=%s"|args:$direction:$key target="_dialog"}}
|
||||
{{/if}}
|
||||
{{:linkbutton label="Modifier" shape="edit" href="config/modify_movement_type.html?dir=%s&op_key=%s"|args:$direction:$key target="_dialog"}}
|
||||
{{:linkbutton label="Modifier" shape="edit" href="config/modifier_type_mouvement.html?dir=%s&op_key=%s"|args:$direction:$key target="_dialog"}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
|
@ -32,21 +32,10 @@
|
||||
}}
|
||||
</fieldset>
|
||||
|
||||
{{* condition de filtrage *}}
|
||||
{{if $_GET.cat_key != null}}
|
||||
{{:assign condition="(SELECT key
|
||||
FROM @TABLE AS cat
|
||||
WHERE cat.key = (SELECT $$.category
|
||||
FROM @TABLE AS mat
|
||||
WHERE mat.key = @TABLE.$$.equipment)) = '%s'"|args:$_GET.cat_key}}
|
||||
{{else}}
|
||||
{{:assign condition=1}}
|
||||
{{/if}}
|
||||
|
||||
{{* lister tous les mouvements *}}
|
||||
{{#list
|
||||
type="movement"
|
||||
select="($$.date || '_' || substr('000000' || id, -6, 6)) AS 'Date';
|
||||
select="$$.date AS 'Date';
|
||||
CASE $$.direction WHEN 'input' THEN 'Entrée' WHEN 'output' THEN 'Sortie' END AS 'Mouvement';
|
||||
$$.operation AS 'Opération';
|
||||
(SELECT $$.name
|
||||
@ -63,11 +52,17 @@
|
||||
END as 'Stockage';
|
||||
$$.comment AS 'Commentaire'
|
||||
"|args:$config.user_fields.name_sql
|
||||
where="%s"|args:$condition
|
||||
order=1
|
||||
max=50
|
||||
desc=true
|
||||
}}
|
||||
{{* filtrer selon la catégorie *}}
|
||||
{{#load key=$equipment}}
|
||||
{{:assign cat_key=$category}}
|
||||
{{/load}}
|
||||
{{if $_GET.cat_key != null && $cat_key != $_GET.cat_key}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
|
||||
{{:assign var="op_label" from="config.%s_nature.%s.label"|args:$direction:$operation}}
|
||||
<tr>
|
||||
<td>{{$date|date_short}}</td>
|
||||
|
@ -124,11 +124,11 @@
|
||||
<aside>
|
||||
{{if $_GET.prop}}
|
||||
{{if $equipment.stock > 0}}
|
||||
{{:linkbutton label="Sortie" shape="minus" href="movements/output_equipment.html?key=%s"|args:$_GET.key target="_dialog"}}
|
||||
{{:linkbutton label="Sortie" shape="minus" href="mouvements/sorties/stock_disponible.html?key=%s"|args:$_GET.key target="_dialog"}}
|
||||
{{/if}}
|
||||
{{:linkbutton label="Entrée" shape="plus" href="movements/input_equipment.html?key=%s"|args:$_GET.key target="_dialog"}}
|
||||
{{:linkbutton label="Entrée" shape="plus" href="mouvements/entrees/repertorie.html?key=%s"|args:$_GET.key target="_dialog"}}
|
||||
{{else}}
|
||||
{{:linkbutton label="Entrée" shape="plus" href="movements/input_equipment.html?key=%s"|args:$_GET.key target="_dialog"}}
|
||||
{{:linkbutton label="Entrée" shape="plus" href="mouvements/entrees/repertorie.html?key=%s"|args:$_GET.key target="_dialog"}}
|
||||
{{/if}}
|
||||
</aside>
|
||||
</nav>
|
||||
@ -164,23 +164,22 @@
|
||||
|
||||
{{#list
|
||||
type="movement"
|
||||
select="
|
||||
($$.date || '_' || substr('000000' || id, -6, 6)) AS 'Date';
|
||||
select="$$.date AS 'Date';
|
||||
CASE $$.direction WHEN 'input' THEN 'Entrée' WHEN 'output' THEN 'Sortie' END AS 'Mouvement';
|
||||
$$.operation AS 'Opération';
|
||||
$$.amount AS 'Quantité';
|
||||
'' AS 'Stock';
|
||||
'' AS 'Sorti';
|
||||
'' AS 'Disponible';
|
||||
"" as 'Stock';
|
||||
"" as 'Sorti';
|
||||
"" as 'Disponible';
|
||||
CASE WHEN $$.user NOT NULL
|
||||
THEN (SELECT %s AS nom FROM users WHERE id = $$.user)
|
||||
ELSE ''
|
||||
END AS 'Dépositaire';
|
||||
END as 'Dépositaire';
|
||||
CASE WHEN $$.storage NOT NULL
|
||||
THEN (SELECT $$.name FROM @TABLE as storage WHERE storage.key = @TABLE.$$.storage)
|
||||
ELSE ''
|
||||
END AS 'Stockage';
|
||||
$$.comment AS 'Commentaire'
|
||||
END as 'Stockage';
|
||||
$$.comment AS 'Commentaire'
|
||||
"|args:$config.user_fields.name_sql
|
||||
equipment=$equipment_key
|
||||
order=1
|
||||
@ -212,31 +211,27 @@
|
||||
{{if $temp_ext != null && $temp_ext > 0}}
|
||||
{{:linkbutton
|
||||
label="Retour"
|
||||
href="movements/output_return.html?key=%s&prop=%s"|args:$key:$_GET.prop
|
||||
href="mouvements/output_return.html?key=%s&prop=%s"|args:$key:$_GET.prop
|
||||
shape="reset"
|
||||
target="_dialog"}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{if $direction == "input" && $type_mvt == "retour"}}
|
||||
{{* interdire dupliquer *}}
|
||||
{{else}}
|
||||
{{:linkbutton
|
||||
label="Dupliquer"
|
||||
href="movements/copy_movement.html?key=%s&prop=%s"|args:$key:$_GET.prop
|
||||
shape="plus"
|
||||
target="_dialog"}}
|
||||
{{/if}}
|
||||
label="Dupliquer"
|
||||
href="mouvements/dupliquer_mouvement.html?key=%s&prop=%s"|args:$key:$_GET.prop
|
||||
shape="plus"
|
||||
target="_dialog"}}
|
||||
{{:linkbutton
|
||||
label="Modifier"
|
||||
href="movements/modify_movement.html?key=%s"|args:$key
|
||||
href="mouvements/modifier_mouvement.html?key=%s"|args:$key
|
||||
shape="edit"
|
||||
target="_dialog"}}
|
||||
{{:linkbutton
|
||||
label="Supprimer"
|
||||
href="movements/delete_movement.html?key=%s&prop=%s"|args:$key:$_GET.prop
|
||||
href="mouvements/supprimer_mouvement.html?key=%s&prop=%s"|args:$key:$_GET.prop
|
||||
shape="delete"
|
||||
target="_dialog"}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
@ -271,7 +266,7 @@
|
||||
|
||||
{{#list
|
||||
type="movement"
|
||||
select="($$.date || '_' || substr('000000' || id, -6, 6)) AS 'Date';
|
||||
select="$$.date AS 'Date';
|
||||
CASE $$.direction WHEN 'input' THEN 'Entrée' WHEN 'output' THEN 'Sortie' END AS 'Mouvement';
|
||||
$$.operation AS 'Opération';
|
||||
$$.amount AS 'Quantité';
|
||||
@ -305,24 +300,24 @@
|
||||
{{if $temp_in != null && $temp_in > 0}}
|
||||
{{:linkbutton
|
||||
label="Retour"
|
||||
href="movements/input_return.html?key=%s&prop=%s"|args:$key:$_GET.prop
|
||||
href="mouvements/input_return.html?key=%s&prop=%s"|args:$key:$_GET.prop
|
||||
shape="reset"
|
||||
target="_dialog"}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{:linkbutton
|
||||
label="Dupliquer"
|
||||
href="movements/copy_movement.html?key=%s&prop=%s"|args:$key:$_GET.prop
|
||||
href="mouvements/dupliquer_mouvement.html?key=%s&prop=%s"|args:$key:$_GET.prop
|
||||
shape="plus"
|
||||
target="_dialog"}}
|
||||
{{:linkbutton
|
||||
label="Modifier"
|
||||
href="movements/modify_movement.html?key=%s"|args:$key
|
||||
href="mouvements/modifier_mouvement.html?key=%s"|args:$key
|
||||
shape="edit"
|
||||
target="_dialog"}}
|
||||
{{:linkbutton
|
||||
label="Supprimer"
|
||||
href="movements/delete_movement.html?key=%s&prop=%s"|args:$key:$_GET.prop
|
||||
href="mouvements/supprimer_mouvement.html?key=%s&prop=%s"|args:$key:$_GET.prop
|
||||
shape="delete"
|
||||
target="_dialog"}}
|
||||
</td>
|
@ -1,6 +1,6 @@
|
||||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{:admin_header title="Gestion des matériels" current="module_equipment"}}
|
||||
{{:admin_header title="Gestion des matériels" custom_css=$custom_css current="module_equipment"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{if $_GET.prop == null || $_GET.prop}}
|
||||
@ -29,10 +29,10 @@
|
||||
{{if $result.count == 0}}
|
||||
<p class="block alert">Il n'y a aucune catégorie : vous devez en ajouter.</p>
|
||||
{{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}}
|
||||
|
||||
|
@ -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"}}
|
||||
</td>
|
@ -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"}}
|
||||
</td>
|
@ -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
|
@ -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
|
||||
|
@ -66,23 +66,21 @@
|
||||
-------------------- 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}}
|
||||
|
||||
{{if $mvt_new.direction == "input" && $_POST.user != null}}
|
||||
{{if $mvt_new.direction != "output" && $_POST.user != null}}
|
||||
{{:error message="Un membre ne peut être associé qu'à une sortie"}}
|
||||
{{/if}}
|
||||
|
||||
{{if $_POST.user|count > 1}}
|
||||
{{:error message="Un membre au plus peut être associé à une sortie"}}
|
||||
{{/if}}
|
||||
|
||||
{{#foreach from=$_POST.user key="id" item="name"}}
|
||||
{{:assign var="user.id" value=$id}}
|
||||
{{:assign var="user.name" value=$name}}
|
||||
@ -117,13 +115,8 @@
|
||||
{{:assign var="movements_new." from=mvt_new}}
|
||||
{{:assign insere=true}}
|
||||
{{elseif $mvt_new.direction == "output" && $type_mvt == "temporaire"}}
|
||||
{{if $movement.direction == "input"}}
|
||||
{{:assign var="type_mvt_crt" from="config.input_nature.%s.type"|args::$movement.operation}}
|
||||
{{if $type_mvt_crt == "retour"}}
|
||||
{{:assign var="movements_new." from=mvt_new}}
|
||||
{{:assign insere=true}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{:assign var="movements_new." from=mvt_new}}
|
||||
{{:assign insere=true}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
@ -135,64 +128,65 @@
|
||||
|
||||
{{* Vérifier la cohérence des mouvements du matériel *}}
|
||||
{{:include
|
||||
file="./_validate_modification.html"
|
||||
file="./valider_modification.html"
|
||||
keep="erreur"
|
||||
movements=$movements_new
|
||||
}}
|
||||
{{if $erreur}}
|
||||
{{:assign var="mvt_label" from="%s_labels.%s"|args:$mvt_new.direction:$mvt_new.operation}}
|
||||
{{:assign new_date=$mvt_new.date|date_short}}
|
||||
{{:error message="Impossible d'enregistrer ce mouvement : « %s de %s (qté : %s) à la date du %s »"|args:$mvt_label:$equipment.name:$mvt_new.amount:$new_date}}
|
||||
{{/if}}
|
||||
|
||||
{{* calculer la nouvelle quantité du matériel *}}
|
||||
{{if $mvt_new.direction == "input"}}
|
||||
{{:assign var="type_mvt" from="config.input_nature.%s.type"|args:$_POST.operation}}
|
||||
{{if $type_mvt == 'définitif'}}
|
||||
{{:assign var="equipment.stock" value="%d+%d"|math:$equipment.stock:$_POST.amount|intval}}
|
||||
{{elseif $type_mvt == 'temporaire'}}
|
||||
{{:assign var="equipment.notowned" value="%d+%d"|math:$equipment.notowned:$_POST.amount|intval}}
|
||||
{{elseif $type_mvt == 'retour'}}
|
||||
{{:assign var="equipment.out" value="%d-%d"|math:$equipment.out:$_POST.amount|intval}}
|
||||
{{/if}}
|
||||
<p class="block error">
|
||||
Impossible d'enregistrer ce mouvement : « {{$mvt_label}}
|
||||
de {{$equipment.name}} (qté : {{$mvt_new.amount}}) à la date du {{$mvt_new.date|date_short}} »
|
||||
</p>
|
||||
{{else}}
|
||||
{{:assign var="type_mvt" from="config.output_nature.%s.type"|args:$_POST.operation}}
|
||||
{{if $type_mvt == 'définitif'}}
|
||||
{{:assign var="equipment.stock" value="%d-%d"|math:$equipment.stock:$_POST.amount|intval}}
|
||||
{{elseif $type_mvt == 'temporaire'}}
|
||||
{{:assign var="equipment.out" value="%d+%d"|math:$equipment.out:$_POST.amount|intval}}
|
||||
{{elseif $type_mvt == 'retour'}}
|
||||
{{:assign var="equipment.notowned" value="%d-%d"|math:$equipment.notowned:$_POST.amount|intval}}
|
||||
{{* calculer la nouvelle quantité du matériel *}}
|
||||
{{if $mvt_new.direction == "input"}}
|
||||
{{:assign var="type_mvt" from="config.input_nature.%s.type"|args:$_POST.operation}}
|
||||
{{if $type_mvt == 'définitif'}}
|
||||
{{:assign var="equipment.stock" value="%d+%d"|math:$equipment.stock:$_POST.amount|intval}}
|
||||
{{elseif $type_mvt == 'temporaire'}}
|
||||
{{:assign var="equipment.notowned" value="%d+%d"|math:$equipment.notowned:$_POST.amount|intval}}
|
||||
{{elseif $type_mvt == 'retour'}}
|
||||
{{:assign var="equipment.out" value="%d-%d"|math:$equipment.out:$_POST.amount|intval}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{:assign var="type_mvt" from="config.output_nature.%s.type"|args:$_POST.operation}}
|
||||
{{if $type_mvt == 'définitif'}}
|
||||
{{:assign var="equipment.stock" value="%d-%d"|math:$equipment.stock:$_POST.amount|intval}}
|
||||
{{elseif $type_mvt == 'temporaire'}}
|
||||
{{:assign var="equipment.out" value="%d+%d"|math:$equipment.out:$_POST.amount|intval}}
|
||||
{{elseif $type_mvt == 'retour'}}
|
||||
{{:assign var="equipment.notowned" value="%d-%d"|math:$equipment.notowned:$_POST.amount|intval}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{:save
|
||||
key=$equipment.key
|
||||
validate_schema="../equipment.schema.json"
|
||||
type="equipment"
|
||||
category=$equipment.category
|
||||
name=$equipment.name
|
||||
status="available"
|
||||
stock=$equipment.stock
|
||||
out=$equipment.out
|
||||
notowned=$equipment.notowned
|
||||
}}
|
||||
{{* vérification réussie : enregistrer le nouveau mouvement *}}
|
||||
{{:assign mvt_key=""|uuid}}
|
||||
{{:save
|
||||
key=$mvt_key
|
||||
validate_schema="movement.schema.json"
|
||||
type="movement"
|
||||
direction=$mvt_new.direction
|
||||
operation=$_POST.operation
|
||||
amount=$mvt_new.amount|intval
|
||||
equipment=$eqpmt_key
|
||||
date=$mvt_new.date
|
||||
comment=$mvt_new.comment
|
||||
user=$user.id
|
||||
storage=$_POST.storage
|
||||
}}
|
||||
{{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=copie"|args:$eqpmt_key:$prop}}
|
||||
{{:save
|
||||
key=$equipment.key
|
||||
validate_schema="../equipment.schema.json"
|
||||
type="equipment"
|
||||
category=$equipment.category
|
||||
name=$equipment.name
|
||||
status="available"
|
||||
stock=$equipment.stock
|
||||
out=$equipment.out
|
||||
notowned=$equipment.notowned
|
||||
}}
|
||||
{{* vérification réussie : enregistrer le mouvement modifié *}}
|
||||
{{:assign mvt_key=""|uuid}}
|
||||
{{:save
|
||||
key=$mvt_key
|
||||
validate_schema="movement.schema.json"
|
||||
type="movement"
|
||||
direction=$mvt_new.direction
|
||||
operation=$_POST.operation
|
||||
amount=$mvt_new.amount|intval
|
||||
equipment=$eqpmt_key
|
||||
date=$mvt_new.date
|
||||
comment=$mvt_new.comment
|
||||
user=$user.id
|
||||
}}
|
||||
{{:redirect force="../historique.html?ok=1&key=%s&prop=%s&msg=copie"|args:$eqpmt_key:$prop}}
|
||||
{{/if}}
|
||||
{{/form}}
|
||||
|
||||
{{:admin_header title="Dupliquer un mouvement" current="module_equipment"}}
|
@ -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 *}}
|
@ -3,7 +3,7 @@
|
||||
{{*
|
||||
Enregistrer un retour d'entrée temporaire
|
||||
paramètres :
|
||||
- key : clé de l'entrée temporaire
|
||||
- key : clé du mouvement
|
||||
*}}
|
||||
|
||||
{{* infos du mouvement *}}
|
||||
@ -65,7 +65,7 @@
|
||||
|
||||
{{* préparer le nouveau mouvement *}}
|
||||
{{:assign var="mvt_new.key" value=""|uuid}}
|
||||
{{:assign var="mvt_new.direction" value="output"}}
|
||||
{{:assign var="mvt_new.direction" value="input"}}
|
||||
{{:assign var="mvt_new.date" value=$_POST.date|parse_date}}
|
||||
{{:assign var="mvt_new.operation" value=$_POST.operation}}
|
||||
{{:assign var="mvt_new.amount" value=$_POST.amount}}
|
||||
@ -107,64 +107,63 @@
|
||||
|
||||
{{* 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
|
||||
}}
|
||||
|
||||
{{if $erreur}}
|
||||
{{:assign message="Impossible d'enregistrer ce mouvement."}}
|
||||
{{if $pb.mvt.key != $mvt_new.key}}
|
||||
{{:assign var="err_mvt_label" from="config.output_nature.%s.label"|args:$pb.mvt.operation}}
|
||||
{{:assign date_pb=$pb.mvt.date|date_short}}
|
||||
{{:assign var=message2 value=" Mouvement incompatible avec « %s » : « %s (qté : %s) en date du %s »."|args:$err_mvt_label:$equipment.name:$pb.mvt.amount:$date_pb}}
|
||||
{{:assign message=$message|cat:$message2}}
|
||||
{{/if}}
|
||||
{{:error message=$message}}
|
||||
<p class="block error">Impossible d'enregistrer ce mouvement.
|
||||
{{if $pb.mvt.key != $mvt_new.key}}
|
||||
{{:assign var="err_mvt_label" from="config.input_nature.%s.label"|args:$pb.mvt.operation}}
|
||||
<br />Mouvement incompatible avec
|
||||
« {{$err_mvt_label}} » : « {{$equipment.name}} (qté : {{$pb.mvt.amount}})
|
||||
en date du {{$pb.mvt.date|date_short}} ».
|
||||
{{/if}}
|
||||
</p>
|
||||
{{else}}
|
||||
{{* calculer la nouvelle quantité du matériel *}}
|
||||
{{:assign var="type_mvt" from="config.output_nature.%s.type"|args:$_POST.operation}}
|
||||
{{:assign var="equipment.notowned" value="%d-%d"|math:$equipment.notowned:$_POST.amount|intval}}
|
||||
|
||||
{{:save
|
||||
key=$equipment.key
|
||||
validate_schema="../equipment.schema.json"
|
||||
type="equipment"
|
||||
category=$equipment.category
|
||||
name=$equipment.name
|
||||
status="available"
|
||||
stock=$equipment.stock
|
||||
out=$equipment.out
|
||||
notowned=$equipment.notowned
|
||||
}}
|
||||
|
||||
{{* vérification réussie : enregistrer le mouvement modifié *}}
|
||||
{{:assign mvt_key=""|uuid}}
|
||||
{{:save
|
||||
key=$mvt_key
|
||||
validate_schema="movement.schema.json"
|
||||
type="movement"
|
||||
direction="output"
|
||||
operation=$_POST.operation
|
||||
amount=$_POST.amount|intval
|
||||
equipment=$equipment.key
|
||||
date=$_POST.date|parse_date
|
||||
comment=$_POST.comment|trim
|
||||
}}
|
||||
{{* enregistrer la liaison entre le retour et la sortie temporaire *}}
|
||||
{{:save
|
||||
key=""|uuid
|
||||
validate_schema="link.schema.json"
|
||||
type="link"
|
||||
direction="input"
|
||||
temp_key=$_GET.key
|
||||
return=$mvt_key
|
||||
}}
|
||||
{{:redirect force="../historique.html?ok=1&key=%s&prop=0&msg=retour"|args:$mvt_new.equipment}}
|
||||
{{/if}}
|
||||
|
||||
{{* calculer la nouvelle quantité du matériel *}}
|
||||
{{:assign var="type_mvt" from="config.output_nature.%s.type"|args:$_POST.operation}}
|
||||
{{:assign var="equipment.notowned" value="%d-%d"|math:$equipment.notowned:$_POST.amount|intval}}
|
||||
|
||||
{{:save
|
||||
key=$equipment.key
|
||||
validate_schema="../equipment.schema.json"
|
||||
type="equipment"
|
||||
category=$equipment.category
|
||||
name=$equipment.name
|
||||
status="available"
|
||||
stock=$equipment.stock
|
||||
out=$equipment.out
|
||||
notowned=$equipment.notowned
|
||||
}}
|
||||
|
||||
{{* vérification réussie : enregistrer le mouvement modifié *}}
|
||||
{{:assign mvt_key=""|uuid}}
|
||||
{{:save
|
||||
key=$mvt_key
|
||||
validate_schema="movement.schema.json"
|
||||
type="movement"
|
||||
direction="output"
|
||||
operation=$_POST.operation
|
||||
amount=$_POST.amount|intval
|
||||
equipment=$equipment.key
|
||||
date=$_POST.date|parse_date
|
||||
comment=$_POST.comment|trim
|
||||
}}
|
||||
{{* enregistrer la liaison entre le retour et la sortie temporaire *}}
|
||||
{{:save
|
||||
key=""|uuid
|
||||
validate_schema="link.schema.json"
|
||||
type="link"
|
||||
direction="input"
|
||||
temp_key=$_GET.key
|
||||
return=$mvt_key
|
||||
}}
|
||||
{{:redirect force="../equipment_history.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 *}}
|
@ -15,7 +15,6 @@
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="../_get_config.html" keep="config, directions"}}
|
||||
{{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$mvt_new.direction:$mvt_new.operation}}
|
||||
|
||||
{{if $mvt_new.direction == "input"}}
|
||||
{{if $type_mvt == "temporaire"}}
|
||||
{{:assign prop=0}}
|
||||
@ -88,6 +87,7 @@
|
||||
- insérer le mvt modifié à sa place par date croissante
|
||||
*}}
|
||||
{{:assign insere=false}}
|
||||
{{:assign entree_def=false}}
|
||||
{{#load
|
||||
where="
|
||||
$$.type = 'movement'
|
||||
@ -107,13 +107,8 @@
|
||||
{{:assign var="movements_new." from=mvt_new}}
|
||||
{{:assign insere=true}}
|
||||
{{elseif $mvt_new.direction == "output" && $type_mvt == "temporaire"}}
|
||||
{{if $movement.direction == "input"}}
|
||||
{{:assign var="type_mvt_crt" from="config.input_nature.%s.type"|args::$movement.operation}}
|
||||
{{if $type_mvt_crt == "retour"}}
|
||||
{{:assign var="movements_new." from=mvt_new}}
|
||||
{{:assign insere=true}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{:assign var="movements_new." from=mvt_new}}
|
||||
{{:assign insere=true}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
@ -126,88 +121,110 @@
|
||||
|
||||
{{* Vérifier la cohérence des mouvements du matériel *}}
|
||||
{{:include
|
||||
file="./_validate_modification.html"
|
||||
file="./valider_modification.html"
|
||||
keep="erreur"
|
||||
movements=$movements_new
|
||||
}}
|
||||
|
||||
{{if $erreur}}
|
||||
{{:assign var="new_op_label" from="config.%s_nature.%s.label"|args:$mvt_new.direction:$mvt_new.operation}}
|
||||
{{:assign new_date=$mvt_new.date|date_short}}
|
||||
{{:error message="Modification impossible : « %s de %s (qté : %s) en date du %s » vers « %s de %s (qté : %s) à la date du %s »"|args:$op_label:$equipment.name:$amount_init:$date_init:$new_op_label:$equipment.name:$mvt_new.amount:$new_date}}
|
||||
{{/if}}
|
||||
|
||||
{{* calculer la nouvelle quantité du matériel *}}
|
||||
{{:assign var="type_mvt_init" from="config.%s_nature.%s.type"|args:$mvt_new.direction:$operation_init}}
|
||||
{{:assign var="type_mvt_final" from="config.%s_nature.%s.type"|args:$mvt_new.direction:$mvt_new.operation}}
|
||||
|
||||
{{if $mvt_new.direction == 'input'}}
|
||||
{{if $type_mvt_init == 'définitif'}}
|
||||
{{:assign var="equipment.stock" value="%d-%d"|math:$equipment.stock:$amount_init}}
|
||||
{{elseif $type_mvt_init == 'temporaire'}}
|
||||
{{:assign var="equipment.notowned" value="%d-%d"|math:$equipment.notowned:$amount_init}}
|
||||
{{elseif $type_mvt_init == 'retour'}}
|
||||
{{:assign var="equipment.out" value="%d+%d"|math:$equipment.out:$amount_init}}
|
||||
{{/if}}
|
||||
|
||||
{{if $type_mvt_final == 'définitif'}}
|
||||
{{:assign var="equipment.stock" value="%d+%d"|math:$equipment.stock:$mvt_new.amount|intval}}
|
||||
{{elseif $type_mvt_final == 'temporaire'}}
|
||||
{{:assign var="equipment.notowned" value="%d+%d"|math:$equipment.notowned:$mvt_new.amount|intval}}
|
||||
{{elseif $type_mvt_final == 'retour'}}
|
||||
{{:assign var="equipment.out" value="%d-%d"|math:$equipment.out:$mvt_new.amount|intval}}
|
||||
{{/if}}
|
||||
<p class="block error">
|
||||
Modification demandée impossible :
|
||||
« {{$op_label}} de {{$equipment.name}} (qté : {{$amount_init}}) en date du {{$date_init}} » vers
|
||||
« {{$new_op_label}}
|
||||
de {{$equipment.name}} (qté : {{$mvt_new.amount}}) à la date du {{$mvt_new.date|date_short}} »
|
||||
</p>
|
||||
{{else}}
|
||||
{{if $type_mvt_init == 'définitif'}}
|
||||
{{:assign var="equipment.stock" value="%d+%d"|math:$equipment.stock:$amount_init}}
|
||||
{{elseif $type_mvt_init == 'temporaire'}}
|
||||
{{:assign var="equipment.out" value="%d-%d"|math:$equipment.out:$amount_init}}
|
||||
{{elseif $type_mvt_init == 'retour'}}
|
||||
{{:assign var="equipment.notowned" value="%d+%d"|math:$equipment.notowned:$amount_init}}
|
||||
{{* calculer la nouvelle quantité du matériel *}}
|
||||
{{:assign var="type_mvt_init" from="config.%s_nature.%s.type"|args:$mvt_new.direction:$operation_init}}
|
||||
{{:assign var="type_mvt_final" from="config.%s_nature.%s.type"|args:$mvt_new.direction:$mvt_new.operation}}
|
||||
|
||||
{{if $mvt_new.direction == 'input'}}
|
||||
{{if $type_mvt_init == 'définitif'}}
|
||||
{{:assign var="equipment.stock" value="%d-%d"|math:$equipment.stock:$amount_init}}
|
||||
{{elseif $type_mvt_init == 'temporaire'}}
|
||||
{{:assign var="equipment.notowned" value="%d-%d"|math:$equipment.notowned:$amount_init}}
|
||||
{{elseif $type_mvt_init == 'retour'}}
|
||||
{{:assign var="equipment.out" value="%d+%d"|math:$equipment.out:$amount_init}}
|
||||
{{/if}}
|
||||
|
||||
{{if $type_mvt_final == 'définitif'}}
|
||||
{{:assign var="equipment.stock" value="%d+%d"|math:$equipment.stock:$mvt_new.amount|intval}}
|
||||
{{elseif $type_mvt_final == 'temporaire'}}
|
||||
{{:assign var="equipment.notowned" value="%d+%d"|math:$equipment.notowned:$mvt_new.amount|intval}}
|
||||
{{elseif $type_mvt_final == 'retour'}}
|
||||
{{:assign var="equipment.out" value="%d-%d"|math:$equipment.out:$mvt_new.amount|intval}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{if $type_mvt_init == 'définitif'}}
|
||||
{{:assign var="equipment.stock" value="%d+%d"|math:$equipment.stock:$amount_init}}
|
||||
{{elseif $type_mvt_init == 'temporaire'}}
|
||||
{{:assign var="equipment.out" value="%d-%d"|math:$equipment.out:$amount_init}}
|
||||
{{elseif $type_mvt_init == 'retour'}}
|
||||
{{:assign var="equipment.notowned" value="%d+%d"|math:$equipment.notowned:$amount_init}}
|
||||
{{/if}}
|
||||
|
||||
{{if $type_mvt_final == 'définitif'}}
|
||||
{{:assign var="equipment.stock" value="%d-%d"|math:$equipment.stock:$mvt_new.amount|intval}}
|
||||
{{elseif $type_mvt_final == 'temporaire'}}
|
||||
{{:assign var="equipment.out" value="%d+%d"|math:$equipment.out:$mvt_new.amount|intval}}
|
||||
{{elseif $type_mvt_final == 'retour'}}
|
||||
{{:assign var="equipment.notowned" value="%d-%d"|math:$equipment.notowned:$mvt_new.amount|intval}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{if $type_mvt_final == 'définitif'}}
|
||||
{{:assign var="equipment.stock" value="%d-%d"|math:$equipment.stock:$mvt_new.amount|intval}}
|
||||
{{elseif $type_mvt_final == 'temporaire'}}
|
||||
{{:assign var="equipment.out" value="%d+%d"|math:$equipment.out:$mvt_new.amount|intval}}
|
||||
{{elseif $type_mvt_final == 'retour'}}
|
||||
{{:assign var="equipment.notowned" value="%d-%d"|math:$equipment.notowned:$mvt_new.amount|intval}}
|
||||
{{if $equipment.stock == 0}}
|
||||
{{* vérifier s'il y a au moins une entrée définitive *}}
|
||||
{{#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"
|
||||
type="equipment"
|
||||
category=$equipment.category
|
||||
name=$equipment.name
|
||||
status="available"
|
||||
stock=$equipment.stock
|
||||
out=$equipment.out
|
||||
notowned=$equipment.notowned
|
||||
}}
|
||||
|
||||
{{* enregistrer le mouvement modifié *}}
|
||||
{{if $user == null}}
|
||||
{{:assign user_id=$mvt_new.user}}
|
||||
{{else}}
|
||||
{{:assign user_id=$user.id}}
|
||||
{{/if}}
|
||||
|
||||
{{:save
|
||||
key=$_GET.key
|
||||
validate_schema="movement.schema.json"
|
||||
type="movement"
|
||||
direction=$mvt_new.direction
|
||||
operation=$_POST.operation
|
||||
amount=$mvt_new.amount|intval
|
||||
equipment=$eqpmt_key
|
||||
date=$mvt_new.date
|
||||
comment=$mvt_new.comment
|
||||
user=$user_id
|
||||
storage=$_POST.storage
|
||||
}}
|
||||
{{:redirect force="../historique.html?ok=1&key=%s&prop=%s&msg=modification"|args:$eqpmt_key:$prop}}
|
||||
{{/if}}
|
||||
|
||||
{{:save
|
||||
key=$equipment.key
|
||||
validate_schema="../equipment.schema.json"
|
||||
type="equipment"
|
||||
category=$equipment.category
|
||||
name=$equipment.name
|
||||
status="available"
|
||||
stock=$equipment.stock
|
||||
out=$equipment.out
|
||||
notowned=$equipment.notowned
|
||||
}}
|
||||
|
||||
{{* enregistrer le mouvement modifié *}}
|
||||
{{if $user == null}}
|
||||
{{:assign user_id=$mvt_new.user}}
|
||||
{{else}}
|
||||
{{:assign user_id=$user.id}}
|
||||
{{/if}}
|
||||
|
||||
{{:save
|
||||
key=$_GET.key
|
||||
validate_schema="movement.schema.json"
|
||||
type="movement"
|
||||
direction=$mvt_new.direction
|
||||
operation=$_POST.operation
|
||||
amount=$mvt_new.amount|intval
|
||||
equipment=$eqpmt_key
|
||||
date=$mvt_new.date
|
||||
comment=$mvt_new.comment
|
||||
user=$user_id
|
||||
storage=$_POST.storage
|
||||
}}
|
||||
{{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=modification"|args:$eqpmt_key:$prop}}
|
||||
{{/form}}
|
||||
|
||||
{{:admin_header title="Modifier un mouvement" current="module_equipment"}}
|
@ -21,7 +21,7 @@
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="../_get_config.html" keep="config"}}
|
||||
|
||||
{{* calculer la quantité sortie temporairement *}}
|
||||
{{* calculer la quantité sortie *}}
|
||||
{{#foreach from=$config.output_nature key=key}}
|
||||
{{if $type == "temporaire"}}
|
||||
{{:assign var="temp_outputs." value=$key|quote_sql}}
|
||||
@ -107,68 +107,68 @@
|
||||
|
||||
{{* 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
|
||||
}}
|
||||
{{if $erreur}}
|
||||
{{:assign message="Impossible d'enregistrer ce mouvement."}}
|
||||
{{if $pb.mvt.key != $mvt_new.key}}
|
||||
{{:assign var="err_mvt_label" from="config.input_nature.%s.label"|args:$pb.mvt.operation}}
|
||||
{{:assign date_pb=$pb.mvt.date|date_short}}
|
||||
{{:assign var=message2 value=" Mouvement incompatible avec « %s » : « %s (qté : %s) en date du %s »."|args:$err_mvt_label:$equipment.name:$pb.mvt.amount:$date_pb}}
|
||||
{{:assign message=$message|cat:$message2}}
|
||||
{{/if}}
|
||||
{{:error message=$message}}
|
||||
{{/if}}
|
||||
|
||||
{{* calculer la nouvelle quantité du matériel *}}
|
||||
{{:assign var="type_mvt" from="config.input_nature.%s.type"|args:$_POST.operation}}
|
||||
{{:assign var="equipment.out" value="%d-%d"|math:$equipment.out:$_POST.amount|intval}}
|
||||
|
||||
{{:save
|
||||
key=$equipment.key
|
||||
validate_schema="../equipment.schema.json"
|
||||
type="equipment"
|
||||
category=$equipment.category
|
||||
name=$equipment.name
|
||||
status="available"
|
||||
stock=$equipment.stock
|
||||
out=$equipment.out
|
||||
notowned=$equipment.notowned
|
||||
}}
|
||||
|
||||
{{* enregistrer le mouvement modifié *}}
|
||||
{{:assign mvt_key=""|uuid}}
|
||||
{{:save
|
||||
key=$mvt_key
|
||||
validate_schema="movement.schema.json"
|
||||
type="movement"
|
||||
direction="input"
|
||||
operation=$_POST.operation
|
||||
amount=$_POST.amount|intval
|
||||
equipment=$equipment.key
|
||||
date=$_POST.date|parse_date
|
||||
comment=$_POST.comment|trim
|
||||
user=$mvt_new.user
|
||||
}}
|
||||
{{* enregistrer la liaison entre le retour et la sortie temporaire *}}
|
||||
{{:save
|
||||
key=""|uuid
|
||||
validate_schema="link.schema.json"
|
||||
type="link"
|
||||
direction="output"
|
||||
temp_key=$_GET.key
|
||||
return=$mvt_key
|
||||
}}
|
||||
{{if $_GET.user == null}}
|
||||
{{:redirect force="../equipment_history.html?ok=1&key=%s&prop=1&msg=retour"|args:$mvt_new.equipment}}
|
||||
<p class="block error">Impossible d'enregistrer ce mouvement.
|
||||
{{if $pb.mvt.key != $mvt_new.key}}
|
||||
{{:assign var="err_mvt_label" from="config.input_nature.%s.label"|args:$pb.mvt.operation}}
|
||||
<br />Mouvement incompatible avec
|
||||
« {{$err_mvt_label}} » : « {{$equipment.name}} (qté : {{$pb.mvt.amount}})
|
||||
en date du {{$pb.mvt.date|date_short}} ».
|
||||
{{/if}}
|
||||
</p>
|
||||
{{else}}
|
||||
{{:redirect force="/admin/users/details.php?id=%s"|args:$_GET.user}}
|
||||
{{* calculer la nouvelle quantité du matériel *}}
|
||||
{{:assign var="type_mvt" from="config.input_nature.%s.type"|args:$_POST.operation}}
|
||||
{{:assign var="equipment.out" value="%d-%d"|math:$equipment.out:$_POST.amount|intval}}
|
||||
|
||||
{{:save
|
||||
key=$equipment.key
|
||||
validate_schema="../equipment.schema.json"
|
||||
type="equipment"
|
||||
category=$equipment.category
|
||||
name=$equipment.name
|
||||
status="available"
|
||||
stock=$equipment.stock
|
||||
out=$equipment.out
|
||||
notowned=$equipment.notowned
|
||||
}}
|
||||
|
||||
{{* enregistrer le mouvement modifié *}}
|
||||
{{:assign mvt_key=""|uuid}}
|
||||
{{:save
|
||||
key=$mvt_key
|
||||
validate_schema="movement.schema.json"
|
||||
type="movement"
|
||||
direction="input"
|
||||
operation=$_POST.operation
|
||||
amount=$_POST.amount|intval
|
||||
equipment=$equipment.key
|
||||
date=$_POST.date|parse_date
|
||||
comment=$_POST.comment|trim
|
||||
user=$mvt_new.user
|
||||
}}
|
||||
{{* enregistrer la liaison entre le retour et la sortie temporaire *}}
|
||||
{{:save
|
||||
key=""|uuid
|
||||
validate_schema="link.schema.json"
|
||||
type="link"
|
||||
direction="output"
|
||||
temp_key=$_GET.key
|
||||
return=$mvt_key
|
||||
}}
|
||||
{{if $_GET.user == null}}
|
||||
{{: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}}
|
||||
{{/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 *}}
|
@ -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}}
|
@ -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}}
|
@ -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}}
|
||||
|
@ -8,7 +8,7 @@
|
||||
{{if $_POST.name == null}}
|
||||
{{:error message="Le nom du lieu de stockage est obligatoire"}}
|
||||
{{/if}}
|
||||
{{#load type="storage" where="$$.name = :name" :name=$_POST.name|trim limit=1}}
|
||||
{{#load type="storage" where="$$.name = :name COLLATE U_NOCASE" :name=$_POST.name|trim limit=1}}
|
||||
{{:error message="Ce nom est déjà utilisé"}}
|
||||
{{/load}}
|
||||
|
||||
@ -16,8 +16,8 @@
|
||||
key=""|uuid
|
||||
validate_schema="storage.schema.json"
|
||||
type="storage"
|
||||
name=$_POST.name|trim
|
||||
location=$_POST.location|trim
|
||||
name=$_POST.name|tolower|ucwords
|
||||
location=$_POST.location
|
||||
}}
|
||||
{{:redirect force="index.html?ok=1&msg=ajout"}}
|
||||
{{/form}}
|
||||
|
@ -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}}
|
||||
|
@ -4,9 +4,9 @@
|
||||
Afficher les lieux de stockage
|
||||
*}}
|
||||
|
||||
{{:admin_header title="Configuration" current="module_equipment"}}
|
||||
{{:admin_header title="Lieux de stockage" custom_css="./style.css" current="module_equipment"}}
|
||||
|
||||
{{:include file="../_nav.html" current="config" subcurrent="storage"}}
|
||||
{{:include file="../_nav.html" current="storage"}}
|
||||
|
||||
{{if $_GET.ok}}
|
||||
{{if $_GET.msg == "ajout"}}
|
||||
@ -33,7 +33,6 @@
|
||||
<td>{{$name}}</td>
|
||||
<td>{{$location}}</td>
|
||||
<td class="actions">
|
||||
{{:linkbutton label="Modifier" shape="edit" href="modify_storage.html?key=%s"|args:$key target="_dialog"}}
|
||||
{{:linkbutton label="Supprimer" shape="delete" href="delete_storage.html?key=%s"|args:$key target="_dialog"}}
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -1,53 +0,0 @@
|
||||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{* récupérer les infos du lieu de stockage *}}
|
||||
{{#load key=$_GET.key assign="storage"}}
|
||||
{{else}}
|
||||
{{:error message="Lieu de stockage introuvable"}}
|
||||
{{/load}}
|
||||
|
||||
{{* Traiter l'envoi du formulaire *}}
|
||||
{{#form on="save"}}
|
||||
{{* voir si le nom a changé *}}
|
||||
{{if $_POST.name|trim == $storage.name}}
|
||||
{{* voir si l'emplacement a changé *}}
|
||||
{{if $_POST.location|trim != $storage.location}}
|
||||
{{:assign modif=true}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{* voir s'il existe un lieu de stockage de même nom *}}
|
||||
{{#load type="storage" where="$$.name = :name" :name=$_POST.name|trim limit=1}}
|
||||
{{:error message="Modification impossible car ce nom (« %s ») est déjà utilisé !"|args:$name|trim}}
|
||||
{{else}}
|
||||
{{:assign modif=true}}
|
||||
{{/load}}
|
||||
{{/if}}
|
||||
|
||||
{{if $modif}}
|
||||
{{:save
|
||||
key=$storage.key
|
||||
validate_schema="storage.schema.json"
|
||||
type="storage"
|
||||
name=$_POST.name|trim
|
||||
location=$_POST.location|trim
|
||||
}}
|
||||
{{/if}}
|
||||
{{:redirect force="./index.html?ok=1&msg=modification"}}
|
||||
{{/form}}
|
||||
|
||||
{{:admin_header title="Modifier un lieu de stockage" current="module_equipment"}}
|
||||
{{:form_errors}}
|
||||
|
||||
{{* formulaire de modification d'un lieu de stockage *}}
|
||||
<form method="post" action="" data-focus="1">
|
||||
<fieldset class="modif_storage">
|
||||
<legend>Modifier le lieu de stockage « {{$storage.name}} »</legend>
|
||||
<dl>
|
||||
{{:input type="text" name="name" label="Nom" default=$storage.name required=true maxlength="100"}}
|
||||
{{:input type="textarea" name="location" label="Emplacement" default=$storage.location cols="40", rows="3" required=false}}
|
||||
</dl>
|
||||
<p class="submit">
|
||||
{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}}
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
Loading…
Reference in New Issue
Block a user