Skip to content

Commit

Permalink
Edit Event: Meeting Contacts
Browse files Browse the repository at this point in the history
- record which meetings have their contacts changed in the Notes
  • Loading branch information
tomas-muller committed Dec 5, 2024
1 parent 70d5445 commit ede87cb
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 9 deletions.
32 changes: 23 additions & 9 deletions JavaSource/org/unitime/timetable/events/SaveEventBackend.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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);
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions WebContent/help/Release-Notes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit ede87cb

Please sign in to comment.