From fed3d55b31b9332972461dd0d64e88d2b10dd724 Mon Sep 17 00:00:00 2001 From: Steve Tsala <45661418+SteveGT96@users.noreply.github.com> Date: Tue, 26 Nov 2024 11:10:21 +0100 Subject: [PATCH] OP-1043 | Remove deleted group from user edit group jcombo box (#2096) * fix(OP-1043): Remove deleted group from user edit group jcombo box * chore: Reformat code --------- Co-authored-by: SteveGT96 --- src/main/java/org/isf/menu/gui/UserEdit.java | 22 ++++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/isf/menu/gui/UserEdit.java b/src/main/java/org/isf/menu/gui/UserEdit.java index 2c444058bd..55fa9c1833 100644 --- a/src/main/java/org/isf/menu/gui/UserEdit.java +++ b/src/main/java/org/isf/menu/gui/UserEdit.java @@ -340,20 +340,24 @@ private JComboBox getUserGroupComboBox() { if (userGroupComboBox == null) { userGroupComboBox = new JComboBox<>(); try { - List group = userBrowsingManager.getUserGroup(); + List groups = userBrowsingManager.getUserGroup(); if (insert) { - if (group != null) { - for (UserGroup elem : group) { - userGroupComboBox.addItem(elem); + if (groups != null) { + for (UserGroup group : groups) { + if (!group.isDeleted()) { + userGroupComboBox.addItem(group); + } } } } else { UserGroup selectedUserGroup = null; - if (group != null) { - for (UserGroup elem : group) { - userGroupComboBox.addItem(elem); - if (user.getUserGroupName().equals(elem)) { - selectedUserGroup = elem; + if (groups != null) { + for (UserGroup group : groups) { + if (!group.isDeleted()) { + userGroupComboBox.addItem(group); + if (user.getUserGroupName().equals(group)) { + selectedUserGroup = group; + } } } }