From c32e09a2b3b627b88ee98f3dbe12c39bff217425 Mon Sep 17 00:00:00 2001 From: James Cole Date: Mon, 29 Mar 2021 06:53:30 +0200 Subject: [PATCH] Fix #4551 --- .../src/components/transactions/Create.vue | 18 +++++++++++++++++- frontend/src/components/transactions/Edit.vue | 18 +++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/transactions/Create.vue b/frontend/src/components/transactions/Create.vue index c3c945fce7..f96d7b5953 100644 --- a/frontend/src/components/transactions/Create.vue +++ b/frontend/src/components/transactions/Create.vue @@ -730,7 +730,6 @@ export default { // meta data budget_id: array.budget_id, category_name: array.category, - tags: array.tags, // optional date fields (6x): interest_date: array.interest_date, @@ -750,11 +749,28 @@ export default { zoom_level: array.zoom_level, longitude: array.longitude, latitude: array.latitude, + tags: [], // from thing: order: 0, reconciled: false, }; + + if (0 !== array.tags.length) { + for (let i in array.tags) { + if (array.tags.hasOwnProperty(i) && /^0$|^[1-9]\d*$/.test(i) && i <= 4294967294) { + // array.tags + let current = array.tags[i]; + if(typeof current === 'object' && null !== current) { + currentSplit.tags.push(current.text); + } + if(typeof current === 'string') { + currentSplit.tags.push(current); + } + } + } + } + // bills and piggy banks if (0 !== array.piggy_bank_id) { currentSplit.piggy_bank_id = array.piggy_bank_id; diff --git a/frontend/src/components/transactions/Edit.vue b/frontend/src/components/transactions/Edit.vue index 84cdbf0197..f86b9c1df1 100644 --- a/frontend/src/components/transactions/Edit.vue +++ b/frontend/src/components/transactions/Edit.vue @@ -500,7 +500,23 @@ export default { // console.log('tags are different'); // console.log(currentTransaction.tags); // console.log(originalTransaction.tags); - diff.tags = currentTransaction.tags; + diff.tags = [];//currentTransaction.tags; + + if (0 !== currentTransaction.tags.length) { + for (let ii in currentTransaction.tags) { + if (currentTransaction.tags.hasOwnProperty(ii) && /^0$|^[1-9]\d*$/.test(ii) && ii <= 4294967294) { + // array.tags + let currentTag = currentTransaction.tags[ii]; + if(typeof currentTag === 'object' && null !== currentTag) { + diff.tags.push(currentTag.text); + } + if(typeof currentTag === 'string') { + diff.tags.push(currentTag); + } + } + } + } + shouldSubmit = true; }