amélioration affichage erreur
This commit is contained in:
parent
99ed711eb7
commit
96251821da
@ -141,31 +141,30 @@
|
||||
}}
|
||||
{{if $erreur}}
|
||||
{{:assign var="mvt_label" from="%s_labels.%s"|args:$mvt_new.direction:$mvt_new.operation}}
|
||||
<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}}
|
||||
{{* 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
|
||||
|
@ -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}}
|
||||
<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.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}}
|
||||
{{: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="../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}}
|
||||
{{/form}}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user