amélioration affichage erreur
This commit is contained in:
parent
99ed711eb7
commit
96251821da
@ -141,31 +141,30 @@
|
|||||||
}}
|
}}
|
||||||
{{if $erreur}}
|
{{if $erreur}}
|
||||||
{{:assign var="mvt_label" from="%s_labels.%s"|args:$mvt_new.direction:$mvt_new.operation}}
|
{{:assign var="mvt_label" from="%s_labels.%s"|args:$mvt_new.direction:$mvt_new.operation}}
|
||||||
<p class="block error">
|
{{:assign new_date=$mvt_new.date|date_short}}
|
||||||
Impossible d'enregistrer ce mouvement : « {{$mvt_label}}
|
{{: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}}
|
||||||
de {{$equipment.name}} (qté : {{$mvt_new.amount}}) à la date du {{$mvt_new.date|date_short}} »
|
{{/if}}
|
||||||
</p>
|
|
||||||
{{else}}
|
{{* calculer la nouvelle quantité du matériel *}}
|
||||||
{{* calculer la nouvelle quantité du matériel *}}
|
{{if $mvt_new.direction == "input"}}
|
||||||
{{if $mvt_new.direction == "input"}}
|
{{:assign var="type_mvt" from="config.input_nature.%s.type"|args:$_POST.operation}}
|
||||||
{{:assign var="type_mvt" from="config.input_nature.%s.type"|args:$_POST.operation}}
|
{{if $type_mvt == 'définitif'}}
|
||||||
{{if $type_mvt == 'définitif'}}
|
{{:assign var="equipment.stock" value="%d+%d"|math:$equipment.stock:$_POST.amount|intval}}
|
||||||
{{:assign var="equipment.stock" value="%d+%d"|math:$equipment.stock:$_POST.amount|intval}}
|
{{elseif $type_mvt == 'temporaire'}}
|
||||||
{{elseif $type_mvt == 'temporaire'}}
|
{{:assign var="equipment.notowned" value="%d+%d"|math:$equipment.notowned:$_POST.amount|intval}}
|
||||||
{{:assign var="equipment.notowned" value="%d+%d"|math:$equipment.notowned:$_POST.amount|intval}}
|
{{elseif $type_mvt == 'retour'}}
|
||||||
{{elseif $type_mvt == 'retour'}}
|
{{:assign var="equipment.out" value="%d-%d"|math:$equipment.out:$_POST.amount|intval}}
|
||||||
{{: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}}
|
{{/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
|
{{:save
|
||||||
key=$equipment.key
|
key=$equipment.key
|
||||||
|
@ -21,7 +21,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"}}
|
{{:include file="../_get_config.html" keep="config"}}
|
||||||
|
|
||||||
{{* calculer la quantité sortie *}}
|
{{* calculer la quantité sortie temporairement *}}
|
||||||
{{#foreach from=$config.output_nature key=key}}
|
{{#foreach from=$config.output_nature key=key}}
|
||||||
{{if $type == "temporaire"}}
|
{{if $type == "temporaire"}}
|
||||||
{{:assign var="temp_outputs." value=$key|quote_sql}}
|
{{:assign var="temp_outputs." value=$key|quote_sql}}
|
||||||
@ -112,59 +112,59 @@
|
|||||||
movements=$movements_new
|
movements=$movements_new
|
||||||
}}
|
}}
|
||||||
{{if $erreur}}
|
{{if $erreur}}
|
||||||
<p class="block error">Impossible d'enregistrer ce mouvement.
|
{{:assign message="Impossible d'enregistrer ce mouvement."}}
|
||||||
{{if $pb.mvt.key != $mvt_new.key}}
|
{{if $pb.mvt.key != $mvt_new.key}}
|
||||||
{{:assign var="err_mvt_label" from="config.input_nature.%s.label"|args:$pb.mvt.operation}}
|
{{:assign var="err_mvt_label" from="config.input_nature.%s.label"|args:$pb.mvt.operation}}
|
||||||
<br />Mouvement incompatible avec
|
{{:assign date_pb=$pb.mvt.date|date_short}}
|
||||||
« {{$err_mvt_label}} » : « {{$equipment.name}} (qté : {{$pb.mvt.amount}})
|
{{: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}}
|
||||||
en date du {{$pb.mvt.date|date_short}} ».
|
{{:assign message=$message|cat:$message2}}
|
||||||
{{/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}}
|
|
||||||
{{/if}}
|
{{/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}}
|
{{/if}}
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user