correction erreur modification mouvement
This commit is contained in:
parent
467a094b14
commit
638855e6fc
@ -180,8 +180,7 @@
|
||||
THEN (SELECT $$.name FROM @TABLE as storage WHERE storage.key = @TABLE.$$.storage)
|
||||
ELSE ''
|
||||
END AS 'Stockage';
|
||||
$$.comment AS 'Commentaire';
|
||||
id AS 'Id'
|
||||
$$.comment AS 'Commentaire'
|
||||
"|args:$config.user_fields.name_sql
|
||||
equipment=$equipment_key
|
||||
order=1
|
||||
@ -218,11 +217,15 @@
|
||||
target="_dialog"}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{if $direction == "input" && $type_mvt == "retour"}}
|
||||
{{* interdire dupliquer *}}
|
||||
{{else}}
|
||||
{{:linkbutton
|
||||
label="Dupliquer"
|
||||
href="mouvements/dupliquer_mouvement.html?key=%s&prop=%s"|args:$key:$_GET.prop
|
||||
shape="plus"
|
||||
target="_dialog"}}
|
||||
{{/if}}
|
||||
{{:linkbutton
|
||||
label="Modifier"
|
||||
href="mouvements/modifier_mouvement.html?key=%s"|args:$key
|
||||
|
@ -75,12 +75,14 @@
|
||||
{{:error message="Impossible de saisir une date dans le futur (%s)"|args:$_POST.date}}
|
||||
{{/if}}
|
||||
|
||||
{{if $mvt_new.direction != "output" && $_POST.user != null}}
|
||||
{{if $mvt_new.direction == "input" && $_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}}
|
||||
@ -115,11 +117,16 @@
|
||||
{{: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}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{:assign var="movements_new." from=movement}}
|
||||
{{/load}}
|
||||
{{if ! $insere}}
|
||||
@ -171,7 +178,7 @@
|
||||
out=$equipment.out
|
||||
notowned=$equipment.notowned
|
||||
}}
|
||||
{{* vérification réussie : enregistrer le mouvement modifié *}}
|
||||
{{* vérification réussie : enregistrer le nouveau mouvement *}}
|
||||
{{:assign mvt_key=""|uuid}}
|
||||
{{:save
|
||||
key=$mvt_key
|
||||
@ -184,9 +191,9 @@
|
||||
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=copie"|args:$eqpmt_key:$prop}}
|
||||
{{/if}}
|
||||
{{/form}}
|
||||
|
||||
{{:admin_header title="Dupliquer un mouvement" current="module_equipment"}}
|
||||
|
@ -15,6 +15,7 @@
|
||||
{{* 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}}
|
||||
@ -87,7 +88,6 @@
|
||||
- insérer le mvt modifié à sa place par date croissante
|
||||
*}}
|
||||
{{:assign insere=false}}
|
||||
{{:assign entree_def=false}}
|
||||
{{#load
|
||||
where="
|
||||
$$.type = 'movement'
|
||||
@ -107,11 +107,16 @@
|
||||
{{: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}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{:assign var="movements_new." from=movement}}
|
||||
{{/if}}
|
||||
{{/load}}
|
||||
@ -128,13 +133,10 @@
|
||||
|
||||
{{if $erreur}}
|
||||
{{:assign var="new_op_label" from="config.%s_nature.%s.label"|args:$mvt_new.direction:$mvt_new.operation}}
|
||||
<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}}
|
||||
{{: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}}
|
||||
@ -175,6 +177,7 @@
|
||||
|
||||
{{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}}
|
||||
@ -224,7 +227,6 @@
|
||||
storage=$_POST.storage
|
||||
}}
|
||||
{{:redirect force="../historique.html?ok=1&key=%s&prop=%s&msg=modification"|args:$eqpmt_key:$prop}}
|
||||
{{/if}}
|
||||
{{/form}}
|
||||
|
||||
{{:admin_header title="Modifier un mouvement" current="module_equipment"}}
|
||||
|
Loading…
Reference in New Issue
Block a user