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,
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS reste
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')
WHERE
json_extract(mvt.document, '$.operation') IN !op
@ -223,7 +223,7 @@
mvt.key AS mvt_key,
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS present
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')
WHERE
json_extract(mvt.document, '$.operation') IN !op

View File

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

View File

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

View File

@ -3,7 +3,7 @@
{{*
Enregistrer un retour de sortie temporaire
paramètres :
- key : clé du mouvement
- key : clé de la sortie temporaire
*}}
{{* infos du mouvement *}}
@ -33,7 +33,7 @@
{{#select
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS exterieur
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')
WHERE
json_extract(mvt.document, '$.operation') IN !op
@ -133,7 +133,8 @@
key=""|uuid
validate_schema="link.schema.json"
type="link"
output=$_GET.key
direction="output"
temp_key=$_GET.key
return=$mvt_key
}}
{{: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}}
{{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}}
{{/load}}
{{if $link_key != null}}
@ -75,7 +75,7 @@
{{:assign var="type_operation" from="config.output_nature.%s.type"|args:$mvt_suppr.operation}}
{{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}}
{{/load}}
{{if $link_key != null}}