From 948880dcf2e807bc9fa22c7cea69f064e533f872 Mon Sep 17 00:00:00 2001 From: Francisco del Castillo Date: Tue, 8 Oct 2024 13:36:48 +0200 Subject: [PATCH] AB#1064 bugfix for adding event to report --- client/src/models/Event.js | 2 +- client/src/pages/reports/Form.js | 1 + client/src/pages/reports/New.js | 4 +--- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/client/src/models/Event.js b/client/src/models/Event.js index 350d886bab..25ec371125 100644 --- a/client/src/models/Event.js +++ b/client/src/models/Event.js @@ -371,7 +371,7 @@ export default class Event extends Model { super(Model.fillObject(props, Event.yupSchema)) } - static FILTERED_CLIENT_SIDE_FIELDS = [] + static FILTERED_CLIENT_SIDE_FIELDS = ["tasks", "organizations", "people"] static filterClientSideFields(obj, ...additionalFields) { return Model.filterClientSideFields( diff --git a/client/src/pages/reports/Form.js b/client/src/pages/reports/Form.js index c7ce29a034..8ae4880443 100644 --- a/client/src/pages/reports/Form.js +++ b/client/src/pages/reports/Form.js @@ -614,6 +614,7 @@ const ReportForm = ({ name="event" component={FieldHelper.SpecialField} onChange={value => { + value = Event.filterClientSideFields(value) // validation will be done by setFieldValue setFieldTouched("event", true, false) // onBlur doesn't work when selecting an option setFieldValue("event", value, true) diff --git a/client/src/pages/reports/New.js b/client/src/pages/reports/New.js index 3141b799b2..8fabb1945c 100644 --- a/client/src/pages/reports/New.js +++ b/client/src/pages/reports/New.js @@ -84,9 +84,7 @@ const ReportNewConditional = ({ const event = new Event(data.event) const tasks = [] event.tasks.forEach(task => tasks.push(new Task(task))) - // We do not want tasks to go with event Probably there is a better way to do this? - event.tasks = [] - report.event = event + report.event = Event.filterClientSideFields(event) report.location = event.location report.tasks = tasks }