modification schéma entrées/sorties temporaires liées

This commit is contained in:
Jean-Christophe Engel 2025-03-22 11:33:35 +01:00
parent 16d6ac752a
commit 3ba67d0c65
5 changed files with 18 additions and 16 deletions

View File

@ -132,7 +132,7 @@
mvt.key AS mvt_key, mvt.key AS mvt_key,
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS reste json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS reste
FROM module_data_equipment AS mvt FROM module_data_equipment AS mvt
LEFT JOIN module_data_equipment AS link ON mvt.key = json_extract(link.document, '$.output') LEFT JOIN module_data_equipment AS link ON mvt.key = json_extract(link.document, '$.temp_key')
LEFT JOIN module_data_equipment AS mvt2 ON mvt2.key = json_extract(link.document, '$.return') LEFT JOIN module_data_equipment AS mvt2 ON mvt2.key = json_extract(link.document, '$.return')
WHERE WHERE
json_extract(mvt.document, '$.operation') IN !op json_extract(mvt.document, '$.operation') IN !op
@ -223,7 +223,7 @@
mvt.key AS mvt_key, mvt.key AS mvt_key,
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS present json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS present
FROM module_data_equipment AS mvt FROM module_data_equipment AS mvt
LEFT JOIN module_data_equipment AS link ON mvt.key = json_extract(link.document, '$.input') LEFT JOIN module_data_equipment AS link ON mvt.key = json_extract(link.document, '$.temp_key')
LEFT JOIN module_data_equipment AS mvt2 ON mvt2.key = json_extract(link.document, '$.return') LEFT JOIN module_data_equipment AS mvt2 ON mvt2.key = json_extract(link.document, '$.return')
WHERE WHERE
json_extract(mvt.document, '$.operation') IN !op json_extract(mvt.document, '$.operation') IN !op

View File

@ -33,7 +33,7 @@
{{#select {{#select
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS present json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS present
FROM module_data_equipment AS mvt FROM module_data_equipment AS mvt
LEFT JOIN module_data_equipment AS link ON mvt.key = json_extract(link.document, '$.input') LEFT JOIN module_data_equipment AS link ON mvt.key = json_extract(link.document, '$.temp_key')
LEFT JOIN module_data_equipment AS mvt2 ON mvt2.key = json_extract(link.document, '$.return') LEFT JOIN module_data_equipment AS mvt2 ON mvt2.key = json_extract(link.document, '$.return')
WHERE WHERE
json_extract(mvt.document, '$.operation') IN !op json_extract(mvt.document, '$.operation') IN !op
@ -133,7 +133,8 @@
key=""|uuid key=""|uuid
validate_schema="link.schema.json" validate_schema="link.schema.json"
type="link" type="link"
input=$_GET.key direction="input"
temp_key=$_GET.key
return=$mvt_key return=$mvt_key
}} }}
{{:redirect force="../historique.html?ok=1&key=%s&prop=0&msg=retour"|args:$mvt_new.equipment}} {{:redirect force="../historique.html?ok=1&key=%s&prop=0&msg=retour"|args:$mvt_new.equipment}}

View File

@ -6,18 +6,18 @@
"type": "string", "type": "string",
"enum": ["link"] "enum": ["link"]
}, },
"input" : { "direction" : {
"description": "clé d'une entrée temporaire", "type" : "string",
"type": "string" "enum" : ["input", "output"]
}, },
"output" : { "temp_key" : {
"description": "clé d'une sortie temporaire", "description": "clé d'une entrée ou sortie temporaire",
"type": "string" "type": "string"
}, },
"return": { "return": {
"description": "clé d'un retour", "description": "clé du retour associé",
"type": "string" "type": "string"
} }
}, },
"required": ["type", "return"] "required": ["type", "direction", "temp_key", "return"]
} }

View File

@ -3,7 +3,7 @@
{{* {{*
Enregistrer un retour de sortie temporaire Enregistrer un retour de sortie temporaire
paramètres : paramètres :
- key : clé du mouvement - key : clé de la sortie temporaire
*}} *}}
{{* infos du mouvement *}} {{* infos du mouvement *}}
@ -33,7 +33,7 @@
{{#select {{#select
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS exterieur json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS exterieur
FROM module_data_equipment AS mvt FROM module_data_equipment AS mvt
LEFT JOIN module_data_equipment AS link ON mvt.key = json_extract(link.document, '$.output') LEFT JOIN module_data_equipment AS link ON mvt.key = json_extract(link.document, '$.temp_key')
LEFT JOIN module_data_equipment AS mvt2 ON mvt2.key = json_extract(link.document, '$.return') LEFT JOIN module_data_equipment AS mvt2 ON mvt2.key = json_extract(link.document, '$.return')
WHERE WHERE
json_extract(mvt.document, '$.operation') IN !op json_extract(mvt.document, '$.operation') IN !op
@ -133,7 +133,8 @@
key=""|uuid key=""|uuid
validate_schema="link.schema.json" validate_schema="link.schema.json"
type="link" type="link"
output=$_GET.key direction="output"
temp_key=$_GET.key
return=$mvt_key return=$mvt_key
}} }}
{{:redirect force="../historique.html?ok=1&key=%s&prop=1&msg=retour"|args:$mvt_new.equipment}} {{:redirect force="../historique.html?ok=1&key=%s&prop=1&msg=retour"|args:$mvt_new.equipment}}

View File

@ -26,7 +26,7 @@
{{:assign var="type_operation" from="config.input_nature.%s.type"|args:$mvt_suppr.operation}} {{:assign var="type_operation" from="config.input_nature.%s.type"|args:$mvt_suppr.operation}}
{{if $type_operation == 'temporaire'}} {{if $type_operation == 'temporaire'}}
{{#load type="link" where="$$.input = :key OR $$.return = :key" :key=$_GET.key}} {{#load type="link" where="$$.temp_key = :key OR $$.return = :key" :key=$_GET.key}}
{{:assign link_key=$key}} {{:assign link_key=$key}}
{{/load}} {{/load}}
{{if $link_key != null}} {{if $link_key != null}}
@ -75,7 +75,7 @@
{{:assign var="type_operation" from="config.output_nature.%s.type"|args:$mvt_suppr.operation}} {{:assign var="type_operation" from="config.output_nature.%s.type"|args:$mvt_suppr.operation}}
{{if $type_operation == 'temporaire'}} {{if $type_operation == 'temporaire'}}
{{#load type="link" where="$$.output = :key OR $$.return = :key" :key=$_GET.key}} {{#load type="link" where="$$.temp_key = :key OR $$.return = :key" :key=$_GET.key}}
{{:assign link_key=$key}} {{:assign link_key=$key}}
{{/load}} {{/load}}
{{if $link_key != null}} {{if $link_key != null}}