diff --git a/historique.html b/historique.html index 39311a6..b9273f9 100644 --- a/historique.html +++ b/historique.html @@ -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 diff --git a/mouvements/input_return.html b/mouvements/input_return.html index dd778f4..5c615b5 100644 --- a/mouvements/input_return.html +++ b/mouvements/input_return.html @@ -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}} diff --git a/mouvements/link.schema.json b/mouvements/link.schema.json index 0048f8a..57c6846 100644 --- a/mouvements/link.schema.json +++ b/mouvements/link.schema.json @@ -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"] } diff --git a/mouvements/output_return.html b/mouvements/output_return.html index 30f0878..595774b 100644 --- a/mouvements/output_return.html +++ b/mouvements/output_return.html @@ -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}} diff --git a/mouvements/supprimer_mouvement.html b/mouvements/supprimer_mouvement.html index e603a2f..0d94d55 100644 --- a/mouvements/supprimer_mouvement.html +++ b/mouvements/supprimer_mouvement.html @@ -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}}