diff --git a/global_history.html b/global_history.html
index f26b8f2..3d30b4b 100644
--- a/global_history.html
+++ b/global_history.html
@@ -46,11 +46,15 @@
FROM @TABLE AS mat
WHERE mat.key = @TABLE.$$.equipment) AS 'Matériel' ;
$$.amount AS 'Quantité';
- $$.comment AS 'Commentaire'"
+ $$.comment AS 'Commentaire';
+ CASE WHEN $$.user NOT NULL
+ THEN (SELECT %s AS nom FROM users WHERE id = $$.user)
+ ELSE ''
+ END as 'Dépositaire'
+ "|args:$config.user_fields.name_sql
order=1
desc=true
- }}
-
+}}
{{* filtrer selon la catégorie *}}
{{#load key=$equipment}}
{{:assign cat_key=$category}}
@@ -67,6 +71,7 @@
{{$col4}} |
{{$amount}} |
{{$comment}} |
+ {{:link href="/admin/users/details.php?id=%s"|args:$user label="%s"|args:$col7}} |
|
{{/list}}
diff --git a/historique.html b/historique.html
index 655c0ad..592abd3 100644
--- a/historique.html
+++ b/historique.html
@@ -126,7 +126,12 @@
"" as 'Stock';
"" as 'Sorti';
"" as 'Disponible';
- $$.comment AS 'Commentaire'"
+ $$.comment AS 'Commentaire';
+ CASE WHEN $$.user NOT NULL
+ THEN (SELECT %s AS nom FROM users WHERE id = $$.user)
+ ELSE ''
+ END as 'Dépositaire'
+ "|args:$config.user_fields.name_sql
equipment=$equipment_key
order=1
}}
@@ -148,6 +153,7 @@
{{$exterieur}} |
{{$dispo}} |
{{$comment}} |
+ {{:link href="/admin/users/details.php?id=%s"|args:$user label="%s"|args:$col9}} |
{{if $current != "archives"}}
{{:linkbutton
diff --git a/mouvements/dupliquer_mouvement.html b/mouvements/dupliquer_mouvement.html
index 66f4695..793a560 100644
--- a/mouvements/dupliquer_mouvement.html
+++ b/mouvements/dupliquer_mouvement.html
@@ -13,6 +13,23 @@
{{:error message="Aucun mouvement avec la clé %s"|args:$_GET.key}}
{{/load}}
+{{* 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}}
+ {{else}}
+ {{:assign prop=1}}
+ {{/if}}
+{{else}}
+ {{if $type_mvt == "retour"}}
+ {{:assign prop=0}}
+ {{else}}
+ {{:assign prop=1}}
+ {{/if}}
+{{/if}}
+
{{* infos pour affichage *}}
{{:assign amount_init=$mvt_new.amount}}
{{:assign date_init=$mvt_new.date|date_short}}
@@ -60,24 +77,19 @@
{{:error message="Impossible de saisir une date dans le futur (%s)"|args:$_POST.date}}
{{/if}}
+ {{if $mvt_new.direction != "output" || $type_mvt != "temporaire" && $_POST.user != null}}
+ {{:error message="Un membre ne peut être associé qu'à une sortie temporaire"}}
+ {{/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}}
+ {{/foreach}}
+
{{* préparer le mouvement copié *}}
{{:assign var="mvt_new.operation" value=$_POST.operation}}
- {{: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}}
- {{else}}
- {{:assign prop=1}}
- {{/if}}
- {{else}}
- {{if $type_mvt == "retour"}}
- {{:assign prop=0}}
- {{else}}
- {{:assign prop=1}}
- {{/if}}
- {{/if}}
-
{{:assign var="mvt_new.amount" value=$_POST.amount}}
{{:assign var="mvt_new.date" value=$_POST.date|parse_date}}
{{:assign var="mvt_new.comment" value=$_POST.comment}}
@@ -136,6 +148,7 @@
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}}
@@ -152,6 +165,12 @@
{{#load key=$eqpmt.category assign="category"}}{{/load}}
{{:assign var="op_label" from="config.%s_nature.%s.label"|args:$mvt_new.direction:$mvt_new.operation}}
+{{if $mvt_new.user != null}}
+ {{#select id, !name as nom FROM users WHERE id=:id; !name=$config.user_fields.name_sql :id=$mvt_new.user}}
+ {{:assign var="user.%s"|args:$id value=$nom}}
+ {{/select}}
+{{/if}}
+
{{* formulaire de copie du mouvement *}}
{{else}}
- Il y a 0 unité de ce matériel disponible à la date du {{$now|date_short}}
+ Il n'y a aucune unité de ce matériel disponible à la date du {{$now|date_short}}
{{/if}}
{{:admin_footer}}
+
+
+
|