diff --git a/mouvements/dupliquer_mouvement.html b/mouvements/dupliquer_mouvement.html index 660284e..aea6877 100644 --- a/mouvements/dupliquer_mouvement.html +++ b/mouvements/dupliquer_mouvement.html @@ -141,31 +141,30 @@ }} {{if $erreur}} {{:assign var="mvt_label" from="%s_labels.%s"|args:$mvt_new.direction:$mvt_new.operation}} -
- Impossible d'enregistrer ce mouvement : « {{$mvt_label}} - de {{$equipment.name}} (qté : {{$mvt_new.amount}}) à la date du {{$mvt_new.date|date_short}} » -
- {{else}} - {{* 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}} + {{: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}} + {{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}} {{:save key=$equipment.key diff --git a/mouvements/output_return.html b/mouvements/output_return.html index d3d688d..aa011b0 100644 --- a/mouvements/output_return.html +++ b/mouvements/output_return.html @@ -21,7 +21,7 @@ {{* récupérer la config des entrées/sorties *}} {{:include file="../_get_config.html" keep="config"}} -{{* calculer la quantité sortie *}} +{{* calculer la quantité sortie temporairement *}} {{#foreach from=$config.output_nature key=key}} {{if $type == "temporaire"}} {{:assign var="temp_outputs." value=$key|quote_sql}} @@ -112,59 +112,59 @@ movements=$movements_new }} {{if $erreur}} -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}}
-
Mouvement incompatible avec
- « {{$err_mvt_label}} » : « {{$equipment.name}} (qté : {{$pb.mvt.amount}})
- en date du {{$pb.mvt.date|date_short}} ».
- {{/if}}
-