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<EventContact>()); Set<EventContact> existingContacts = new HashSet<EventContact>(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<EventContact> 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 @@ <line>This fixes an issue caused by a recent change, having the events and rooms parameters incorrectly interpreted.</line> </description> </item> + <item> + <name>Edit Event: Meeting Contacts</name> + <description> + <line>Record which meetings have their contacts changed in the Notes.</line> + </description> + </item> </category> <category> <title>Administration</title>