From ede87cbcd542c14714aa537bf8a5f0864bbfbe60 Mon Sep 17 00:00:00 2001 From: tomas-muller Date: Thu, 5 Dec 2024 14:23:07 +0100 Subject: [PATCH] Edit Event: Meeting Contacts - record which meetings have their contacts changed in the Notes --- .../timetable/events/SaveEventBackend.java | 32 +++++++++++++------ WebContent/help/Release-Notes.xml | 6 ++++ 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/JavaSource/org/unitime/timetable/events/SaveEventBackend.java b/JavaSource/org/unitime/timetable/events/SaveEventBackend.java index 212da9a993..36c2ff16f3 100644 --- a/JavaSource/org/unitime/timetable/events/SaveEventBackend.java +++ b/JavaSource/org/unitime/timetable/events/SaveEventBackend.java @@ -378,18 +378,20 @@ else if (m.getLocation().getName() != null) if (updateMeetingContacts) { if (meeting.getMeetingContacts() == null) meeting.setMeetingContacts(new HashSet()); Set existingContacts = new HashSet(meeting.getMeetingContacts()); - meeting.getMeetingContacts().clear(); + boolean contactsChanged = false; if (m.hasMeetingContacts()) { - for (ContactInterface c: m.getMeetingContacts()) { + c: for (ContactInterface c: m.getMeetingContacts()) { if (c.getExternalId() == null) continue; - EventContact contact = null; - for (EventContact x: existingContacts) - if (c.getExternalId().equals(x.getExternalUniqueId())) { contact = x; break; } - if (contact == null) { - contact = hibSession.createQuery( - "from EventContact where externalUniqueId = :externalId", EventContact.class) - .setParameter("externalId", c.getExternalId()).setMaxResults(1).uniqueResult(); + for (Iterator i = existingContacts.iterator(); i.hasNext(); ) { + EventContact x = i.next(); + if (c.getExternalId().equals(x.getExternalUniqueId())) { + i.remove(); + continue c; + } } + EventContact contact = hibSession.createQuery( + "from EventContact where externalUniqueId = :externalId", EventContact.class) + .setParameter("externalId", c.getExternalId()).setMaxResults(1).uniqueResult(); if (contact == null) { contact = new EventContact(); contact.setExternalUniqueId(c.getExternalId()); @@ -402,7 +404,19 @@ else if (m.getLocation().getName() != null) hibSession.persist(contact); } meeting.getMeetingContacts().add(contact); + contactsChanged = true; } + if (!existingContacts.isEmpty()) { + meeting.getMeetingContacts().removeAll(existingContacts); + contactsChanged = true; + } + } else if (!meeting.getMeetingContacts().isEmpty()) { + meeting.getMeetingContacts().clear(); + contactsChanged = true; + } + if (contactsChanged) { + response.addUpdatedMeeting(m); + updatedMeetings.add(meeting); } } } diff --git a/WebContent/help/Release-Notes.xml b/WebContent/help/Release-Notes.xml index 53e8c800d7..50fc36adae 100644 --- a/WebContent/help/Release-Notes.xml +++ b/WebContent/help/Release-Notes.xml @@ -121,6 +121,12 @@ This fixes an issue caused by a recent change, having the events and rooms parameters incorrectly interpreted. + + Edit Event: Meeting Contacts + + Record which meetings have their contacts changed in the Notes. + + Administration