From 362fd964d00e6a95a973096bfb1ebbe147719afc Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 21 Oct 2022 02:10:37 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20=C3=A9dition=20de=20sorts=20d'Actor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit L'édition était impossible parce que le formData ne contient pas de noeud system, mais des propriétés 'system.portee', ... --- module/item-sheet.js | 4 ++-- module/item-sort.js | 25 ++++++++++--------------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/module/item-sheet.js b/module/item-sheet.js index 1a92be79..0a2302b0 100644 --- a/module/item-sheet.js +++ b/module/item-sheet.js @@ -250,9 +250,9 @@ export class RdDItemSheet extends ItemSheet { /* -------------------------------------------- */ /** @override */ - _updateObject(event, formData) { // Deprecated en v0.8 à clarifier + _updateObject(event, formData) { // Données de bonus de cases ? - formData = RdDItemSort.buildBonusCaseStringFromFormData(formData); + formData['system.bonuscase'] = RdDItemSort.buildBonusCaseStringFromFormData(formData.bonusValue, formData.caseValue); return this.item.update(formData); } diff --git a/module/item-sort.js b/module/item-sort.js index 5047cc23..befbb6b0 100644 --- a/module/item-sort.js +++ b/module/item-sort.js @@ -63,26 +63,21 @@ export class RdDItemSort extends Item { /** Met à jour les données de formulaire * si static des bonus de cases sont présents * */ - static buildBonusCaseStringFromFormData( formData ) { - if ( formData.bonusValue ) { + static buildBonusCaseStringFromFormData( bonuses, cases ) { + if ( bonuses ) { let list = []; let caseCheck = {}; - for(let i=0; i 0 && caseCheck[coord] == undefined ) { - caseCheck[coord] = bonus; - list.push( coord+":"+bonus ); - } + for (let i=0; i 0 && caseCheck[coord] == undefined ) { + caseCheck[coord] = bonus; + list.push( coord+":"+bonus ); } } - formData.bonusValue = undefined; - formData.caseValue = undefined; - formData.system.bonuscase = list.toString(); // Reset + return list.toString(); } - return formData; + return undefined; } /* -------------------------------------------- */