From 7b71d5dc844aaa2a9452469847338e7d05d8f7e3 Mon Sep 17 00:00:00 2001 From: j-dimension Date: Mon, 25 Nov 2024 00:24:17 +0100 Subject: [PATCH] restore role last used. default values for lawyer and assistant are empty. issue #2693 --- .../editors/files/AddAddressSearchDialog.java | 2 +- .../jlawyer/client/mail/sidebar/NewCaseStep.java | 4 ++-- .../client/mail/sidebar/SelectAddressStep.java | 13 +++++++++++-- .../server/services/settings/UserSettingsKeys.java | 1 + 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/AddAddressSearchDialog.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/AddAddressSearchDialog.java index 539bf918d..e94c9aff5 100755 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/AddAddressSearchDialog.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/AddAddressSearchDialog.java @@ -740,7 +740,7 @@ public AddAddressSearchDialog(java.awt.Frame parent, boolean modal, String targe EditorsRegistry.getInstance().clearStatus(); } - if (this.partyTypes.size() > 0) { + if (!this.partyTypes.isEmpty()) { this.targetReferenceType = this.partyTypes.get(0); } diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/sidebar/NewCaseStep.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/sidebar/NewCaseStep.java index efccde33c..5ece1150a 100644 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/sidebar/NewCaseStep.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/sidebar/NewCaseStep.java @@ -776,8 +776,8 @@ public NewCaseStep() { ThreadUtils.addComponent(tagPanel, tb); } - this.cmbLawyer.setSelectedItem(UserSettings.getInstance().getCurrentUser().getPrincipalId()); - this.cmbAssistant.setSelectedItem(UserSettings.getInstance().getCurrentUser().getPrincipalId()); +// this.cmbLawyer.setSelectedItem(UserSettings.getInstance().getCurrentUser().getPrincipalId()); +// this.cmbAssistant.setSelectedItem(UserSettings.getInstance().getCurrentUser().getPrincipalId()); } diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/sidebar/SelectAddressStep.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/sidebar/SelectAddressStep.java index d32fe2e24..5c70d12b9 100644 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/sidebar/SelectAddressStep.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/sidebar/SelectAddressStep.java @@ -665,6 +665,7 @@ import com.jdimension.jlawyer.client.editors.files.AddressBeanListCellRenderer; import com.jdimension.jlawyer.client.settings.ClientSettings; +import com.jdimension.jlawyer.client.settings.UserSettings; import com.jdimension.jlawyer.client.wizard.*; import com.jdimension.jlawyer.persistence.AddressBean; import com.jdimension.jlawyer.persistence.PartyTypeBean; @@ -673,8 +674,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import org.apache.log4j.Logger; /** @@ -713,6 +712,13 @@ public SelectAddressStep() { for (String s : refTypeNames) { this.cmbRefType.addItem(s); } + + UserSettings uset=UserSettings.getInstance(); + String lastPartyType = uset.getSetting(UserSettings.CONF_CASE_LASTPARTYTYPE_NEWCASEASSISTANT, ""); + if(lastPartyType!=null) { + this.cmbRefType.setSelectedItem(lastPartyType); + } + } catch (Throwable t) { log.error("Unable to get party types", t); @@ -733,6 +739,9 @@ public void nextEvent() { this.data.put("newaddress.partytype", selectedType); this.data.put("newaddress.selectedaddress", this.cmbRecipient.getSelectedItem()); + + UserSettings uset=UserSettings.getInstance(); + uset.setSetting(UserSettings.CONF_CASE_LASTPARTYTYPE_NEWCASEASSISTANT, refType); } diff --git a/j-lawyer-server-common/src/com/jdimension/jlawyer/server/services/settings/UserSettingsKeys.java b/j-lawyer-server-common/src/com/jdimension/jlawyer/server/services/settings/UserSettingsKeys.java index 9a6fa6db2..24fd3a539 100644 --- a/j-lawyer-server-common/src/com/jdimension/jlawyer/server/services/settings/UserSettingsKeys.java +++ b/j-lawyer-server-common/src/com/jdimension/jlawyer/server/services/settings/UserSettingsKeys.java @@ -723,6 +723,7 @@ public class UserSettingsKeys { public static final String CONF_DOCUMENTS_LASTSORTMODE="client.documents.lastsortmode"; public static final String CONF_CASE_LASTPARTYTYPE = "user.case.lastpartytype"; + public static final String CONF_CASE_LASTPARTYTYPE_NEWCASEASSISTANT = "user.case.lastpartytype.newcase"; public static final String CONF_CASES_EXPORT_TOLOCAL="user.case.pdfexport.tolocal"; public static final String CONF_CASES_EXPORT_TOCASE="user.case.pdfexport.tocase";