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)
|
THEN (SELECT $$.name FROM @TABLE as storage WHERE storage.key = @TABLE.$$.storage)
|
||||||
ELSE ''
|
ELSE ''
|
||||||
END AS 'Stockage';
|
END AS 'Stockage';
|
||||||
$$.comment AS 'Commentaire';
|
$$.comment AS 'Commentaire'
|
||||||
id AS 'Id'
|
|
||||||
"|args:$config.user_fields.name_sql
|
"|args:$config.user_fields.name_sql
|
||||||
equipment=$equipment_key
|
equipment=$equipment_key
|
||||||
order=1
|
order=1
|
||||||
@ -218,11 +217,15 @@
|
|||||||
target="_dialog"}}
|
target="_dialog"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{if $direction == "input" && $type_mvt == "retour"}}
|
||||||
|
{{* interdire dupliquer *}}
|
||||||
|
{{else}}
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
label="Dupliquer"
|
label="Dupliquer"
|
||||||
href="mouvements/dupliquer_mouvement.html?key=%s&prop=%s"|args:$key:$_GET.prop
|
href="mouvements/dupliquer_mouvement.html?key=%s&prop=%s"|args:$key:$_GET.prop
|
||||||
shape="plus"
|
shape="plus"
|
||||||
target="_dialog"}}
|
target="_dialog"}}
|
||||||
|
{{/if}}
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
label="Modifier"
|
label="Modifier"
|
||||||
href="mouvements/modifier_mouvement.html?key=%s"|args:$key
|
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}}
|
{{:error message="Impossible de saisir une date dans le futur (%s)"|args:$_POST.date}}
|
||||||
{{/if}}
|
{{/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"}}
|
{{:error message="Un membre ne peut être associé qu'à une sortie"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{if $_POST.user|count > 1}}
|
{{if $_POST.user|count > 1}}
|
||||||
{{:error message="Un membre au plus peut être associé à une sortie"}}
|
{{:error message="Un membre au plus peut être associé à une sortie"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#foreach from=$_POST.user key="id" item="name"}}
|
{{#foreach from=$_POST.user key="id" item="name"}}
|
||||||
{{:assign var="user.id" value=$id}}
|
{{:assign var="user.id" value=$id}}
|
||||||
{{:assign var="user.name" value=$name}}
|
{{:assign var="user.name" value=$name}}
|
||||||
@ -115,11 +117,16 @@
|
|||||||
{{:assign var="movements_new." from=mvt_new}}
|
{{:assign var="movements_new." from=mvt_new}}
|
||||||
{{:assign insere=true}}
|
{{:assign insere=true}}
|
||||||
{{elseif $mvt_new.direction == "output" && $type_mvt == "temporaire"}}
|
{{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 var="movements_new." from=mvt_new}}
|
||||||
{{:assign insere=true}}
|
{{:assign insere=true}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
{{:assign var="movements_new." from=movement}}
|
{{:assign var="movements_new." from=movement}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
{{if ! $insere}}
|
{{if ! $insere}}
|
||||||
@ -171,7 +178,7 @@
|
|||||||
out=$equipment.out
|
out=$equipment.out
|
||||||
notowned=$equipment.notowned
|
notowned=$equipment.notowned
|
||||||
}}
|
}}
|
||||||
{{* vérification réussie : enregistrer le mouvement modifié *}}
|
{{* vérification réussie : enregistrer le nouveau mouvement *}}
|
||||||
{{:assign mvt_key=""|uuid}}
|
{{:assign mvt_key=""|uuid}}
|
||||||
{{:save
|
{{:save
|
||||||
key=$mvt_key
|
key=$mvt_key
|
||||||
@ -184,9 +191,9 @@
|
|||||||
date=$mvt_new.date
|
date=$mvt_new.date
|
||||||
comment=$mvt_new.comment
|
comment=$mvt_new.comment
|
||||||
user=$user.id
|
user=$user.id
|
||||||
|
storage=$_POST.storage
|
||||||
}}
|
}}
|
||||||
{{:redirect force="../historique.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}}
|
||||||
{{/if}}
|
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
{{:admin_header title="Dupliquer un mouvement" current="module_equipment"}}
|
{{:admin_header title="Dupliquer un mouvement" current="module_equipment"}}
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
{{* récupérer la config des entrées/sorties *}}
|
{{* récupérer la config des entrées/sorties *}}
|
||||||
{{:include file="../_get_config.html" keep="config, directions"}}
|
{{: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}}
|
{{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$mvt_new.direction:$mvt_new.operation}}
|
||||||
|
|
||||||
{{if $mvt_new.direction == "input"}}
|
{{if $mvt_new.direction == "input"}}
|
||||||
{{if $type_mvt == "temporaire"}}
|
{{if $type_mvt == "temporaire"}}
|
||||||
{{:assign prop=0}}
|
{{:assign prop=0}}
|
||||||
@ -87,7 +88,6 @@
|
|||||||
- insérer le mvt modifié à sa place par date croissante
|
- insérer le mvt modifié à sa place par date croissante
|
||||||
*}}
|
*}}
|
||||||
{{:assign insere=false}}
|
{{:assign insere=false}}
|
||||||
{{:assign entree_def=false}}
|
|
||||||
{{#load
|
{{#load
|
||||||
where="
|
where="
|
||||||
$$.type = 'movement'
|
$$.type = 'movement'
|
||||||
@ -107,11 +107,16 @@
|
|||||||
{{:assign var="movements_new." from=mvt_new}}
|
{{:assign var="movements_new." from=mvt_new}}
|
||||||
{{:assign insere=true}}
|
{{:assign insere=true}}
|
||||||
{{elseif $mvt_new.direction == "output" && $type_mvt == "temporaire"}}
|
{{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 var="movements_new." from=mvt_new}}
|
||||||
{{:assign insere=true}}
|
{{:assign insere=true}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
{{:assign var="movements_new." from=movement}}
|
{{:assign var="movements_new." from=movement}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
@ -128,13 +133,10 @@
|
|||||||
|
|
||||||
{{if $erreur}}
|
{{if $erreur}}
|
||||||
{{:assign var="new_op_label" from="config.%s_nature.%s.label"|args:$mvt_new.direction:$mvt_new.operation}}
|
{{:assign var="new_op_label" from="config.%s_nature.%s.label"|args:$mvt_new.direction:$mvt_new.operation}}
|
||||||
<p class="block error">
|
{{:assign new_date=$mvt_new.date|date_short}}
|
||||||
Modification demandée impossible :
|
{{: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}}
|
||||||
« {{$op_label}} de {{$equipment.name}} (qté : {{$amount_init}}) en date du {{$date_init}} » vers
|
{{/if}}
|
||||||
« {{$new_op_label}}
|
|
||||||
de {{$equipment.name}} (qté : {{$mvt_new.amount}}) à la date du {{$mvt_new.date|date_short}} »
|
|
||||||
</p>
|
|
||||||
{{else}}
|
|
||||||
{{* calculer la nouvelle quantité du matériel *}}
|
{{* 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_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}}
|
{{: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}}
|
{{if $equipment.stock == 0}}
|
||||||
{{* vérifier s'il y a au moins une entrée définitive *}}
|
{{* vérifier s'il y a au moins une entrée définitive *}}
|
||||||
|
{{:assign entree_def=false}}
|
||||||
{{#foreach from=$config.input_nature key=key}}
|
{{#foreach from=$config.input_nature key=key}}
|
||||||
{{if $type == 'définitif'}}
|
{{if $type == 'définitif'}}
|
||||||
{{:assign var="input_types." value=$key}}
|
{{:assign var="input_types." value=$key}}
|
||||||
@ -224,7 +227,6 @@
|
|||||||
storage=$_POST.storage
|
storage=$_POST.storage
|
||||||
}}
|
}}
|
||||||
{{:redirect force="../historique.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}}
|
||||||
{{/if}}
|
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
{{:admin_header title="Modifier un mouvement" current="module_equipment"}}
|
{{:admin_header title="Modifier un mouvement" current="module_equipment"}}
|
||||||
|
Loading…
Reference in New Issue
Block a user