From 2bfd13e7193f88a9b4566b03537eb09666fafaef Mon Sep 17 00:00:00 2001 From: j-dimension Date: Wed, 16 Oct 2024 02:22:49 +0200 Subject: [PATCH] avoid templates from being triggered when reply is used (overwrites the reply content / quote). issue #2326 --- .../client/bea/SendBeaMessageDialog.java | 4 ++-- .../cloud/ShareDocumentsToCloudAction.java | 2 +- .../client/drebis/freetext/FreeTextStep.java | 2 +- .../client/editors/addresses/AddressPanel.java | 2 +- .../client/editors/files/ArchiveFilePanel.java | 4 ++-- .../editors/files/InvolvedPartyEntryPanel.java | 2 +- .../client/editors/files/PartiesPanel.java | 8 ++++++-- .../jlawyer/client/mail/SendEmailDialog.java | 17 +++++++++++++---- .../jlawyer/client/mail/ViewEmailDialog.java | 10 +++++----- 9 files changed, 32 insertions(+), 19 deletions(-) diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/bea/SendBeaMessageDialog.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/bea/SendBeaMessageDialog.java index 9a57c1d9e..18f1d5f56 100755 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/bea/SendBeaMessageDialog.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/bea/SendBeaMessageDialog.java @@ -1073,7 +1073,7 @@ public void setAzSender(String fileNumber) { public void addParty(AddressBean addr, PartyTypeBean ptb) { - this.pnlParties.addParty(new PartiesPanelEntry(addr, ptb)); + this.pnlParties.addParty(new PartiesPanelEntry(addr, ptb), true); this.addRecipientCandidate(addr, ptb); @@ -1084,7 +1084,7 @@ public void addParty(ArchiveFileAddressesBean aab) { return; } - this.pnlParties.addParty(new PartiesPanelEntry(aab)); + this.pnlParties.addParty(new PartiesPanelEntry(aab), true); this.addRecipientCandidate(aab.getAddressKey(), aab.getReferenceType()); diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/cloud/ShareDocumentsToCloudAction.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/cloud/ShareDocumentsToCloudAction.java index 74184b8e5..90f947b74 100644 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/cloud/ShareDocumentsToCloudAction.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/cloud/ShareDocumentsToCloudAction.java @@ -815,7 +815,7 @@ public boolean execute() throws Exception { if (parties != null) { ArrayList involved = parties; for (ArchiveFileAddressesBean aab : involved) { - dlg.addParty(aab); + dlg.addParty(aab, true); } } diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/drebis/freetext/FreeTextStep.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/drebis/freetext/FreeTextStep.java index e2de8db47..1f02ad3e3 100755 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/drebis/freetext/FreeTextStep.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/drebis/freetext/FreeTextStep.java @@ -1046,7 +1046,7 @@ public void setData(WizardDataContainer data) { List involved=locator.lookupArchiveFileServiceRemote().getInvolvementDetailsForCase(caseId); for(ArchiveFileAddressesBean aab: involved) { - this.partiesPanel.addParty(new PartiesPanelEntry(aab)); + this.partiesPanel.addParty(new PartiesPanelEntry(aab), true); } this.formPlaceHolders = locator.lookupFormsServiceRemote().getPlaceHoldersForCase(contextArchiveFile.getId()); diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/addresses/AddressPanel.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/addresses/AddressPanel.java index 279c40946..94fbb6fbe 100755 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/addresses/AddressPanel.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/addresses/AddressPanel.java @@ -3207,7 +3207,7 @@ private void cmdSendEmailActionPerformed(java.awt.event.ActionEvent evt) {//GEN- // we do not know what role this person has - so put it as all three types List allPartyTypes = locator.lookupSystemManagementRemote().getPartyTypes(); for (PartyTypeBean ptb : allPartyTypes) { - dlg.addParty(dto, ptb); + dlg.addParty(dto, ptb, true); } } catch (Exception ex) { JOptionPane.showMessageDialog(this, "Fehler beim Ermitteln der Beteiligtentypen: " + ex.getMessage(), com.jdimension.jlawyer.client.utils.DesktopUtils.POPUP_TITLE_ERROR, JOptionPane.ERROR_MESSAGE); diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ArchiveFilePanel.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ArchiveFilePanel.java index daabb8918..ca838e2dd 100755 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ArchiveFilePanel.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ArchiveFilePanel.java @@ -5057,7 +5057,7 @@ private void mnuSendDocumentActionPerformed(java.awt.event.ActionEvent evt) {//G dlg.setArchiveFile(dto, caseFolder); for (ArchiveFileAddressesBean aab : this.pnlInvolvedParties.getInvolvedParties()) { - dlg.addParty(aab); + dlg.addParty(aab, true); } try { @@ -5119,7 +5119,7 @@ private void mnuSendDocumentPDFActionPerformed(java.awt.event.ActionEvent evt) { dlg.setArchiveFile(dto, caseFolder); for (ArchiveFileAddressesBean aab : this.pnlInvolvedParties.getInvolvedParties()) { - dlg.addParty(aab); + dlg.addParty(aab, true); } ProgressIndicator pi = new ProgressIndicator(EditorsRegistry.getInstance().getMainWindow(), true); diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/InvolvedPartyEntryPanel.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/InvolvedPartyEntryPanel.java index 0f591940b..c742502c4 100644 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/InvolvedPartyEntryPanel.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/InvolvedPartyEntryPanel.java @@ -1326,7 +1326,7 @@ private void mnuSendEmailActionPerformed(java.awt.event.ActionEvent evt) {//GEN- dlg.setTo(this.a.getEmail()); ArrayList involved = this.container.getInvolvedParties(); for (ArchiveFileAddressesBean aab : involved) { - dlg.addParty(aab); + dlg.addParty(aab, true); } FrameUtils.centerDialog(dlg, null); diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/PartiesPanel.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/PartiesPanel.java index ce852c959..26f2f0a89 100644 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/PartiesPanel.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/PartiesPanel.java @@ -678,7 +678,6 @@ You should also get your employer (if you work as a programmer) or school, import javax.swing.JOptionPane; import javax.swing.JTable; import javax.swing.event.TableModelEvent; -import javax.swing.event.TableModelListener; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableCellRenderer; import org.apache.log4j.Logger; @@ -810,7 +809,11 @@ public void initialize(List involved) { } } - public void addParty(PartiesPanelEntry entry) { + public void addParty(PartiesPanelEntry entry, boolean evaluateTemplates) { + boolean currentIgnoreTableChanges=this.ignoreTableChanges; + if(!evaluateTemplates) + ignoreTableChanges=true; + PartiesPanelTableModel model = (PartiesPanelTableModel) this.tblParties.getModel(); ArrayList row = new ArrayList(); row.add(entry); @@ -825,6 +828,7 @@ public void addParty(PartiesPanelEntry entry) { Object[] rowArray = row.toArray(); model.addRow(rowArray); + ignoreTableChanges=currentIgnoreTableChanges; } public PartiesPanelEntry getSelectedParty(PartyTypeBean ptb) { diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/SendEmailDialog.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/SendEmailDialog.java index 972eac01f..971d9d19a 100755 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/SendEmailDialog.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/SendEmailDialog.java @@ -775,6 +775,7 @@ public class SendEmailDialog extends javax.swing.JDialog implements SendCommunic private AssistantConfig transcribeConfig = null; private boolean replyOrForward=false; + private boolean initializing=false; // can be set by code that constructs the SendEmailDialog to "inject" a recently created link to a Nextcloud share // will be made available as a placeholder @@ -793,8 +794,10 @@ public class SendEmailDialog extends javax.swing.JDialog implements SendCommunic */ public SendEmailDialog(boolean replyOrForward, JDialog parent, boolean modal) { super(parent, modal); + this.initializing=true; this.replyOrForward=replyOrForward; this.initialize(); + this.initializing=false; } /** @@ -806,8 +809,10 @@ public SendEmailDialog(boolean replyOrForward, JDialog parent, boolean modal) { */ public SendEmailDialog(boolean replyOrForward, JFrame parent, boolean modal) { super(parent, modal); + this.initializing=true; this.replyOrForward=replyOrForward; this.initialize(); + this.initializing=false; } private void initialize() { @@ -1107,20 +1112,20 @@ public void setFrom(MailboxSetup ms) { } } - public void addParty(AddressBean addr, PartyTypeBean ptb) { + public void addParty(AddressBean addr, PartyTypeBean ptb, boolean evaluateTemplates) { - this.pnlParties.addParty(new PartiesPanelEntry(addr, ptb)); + this.pnlParties.addParty(new PartiesPanelEntry(addr, ptb), evaluateTemplates); this.addRecipientCandidate(addr, ptb); } - public void addParty(ArchiveFileAddressesBean p) { + public void addParty(ArchiveFileAddressesBean p, boolean evaluateTemplates) { if (p == null) { return; } - this.pnlParties.addParty(new PartiesPanelEntry(p)); + this.pnlParties.addParty(new PartiesPanelEntry(p), evaluateTemplates); this.addRecipientCandidate(p.getAddressKey(), p.getReferenceType()); @@ -2201,6 +2206,10 @@ private void cmdRecipientsActionPerformed(java.awt.event.ActionEvent evt) {//GEN }//GEN-LAST:event_cmdRecipientsActionPerformed private void cmbTemplatesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbTemplatesActionPerformed + // when performing a reply, do not evaluate the template + if(this.initializing && this.replyOrForward) + return; + MailboxSetup ms = this.getSelectedMailbox(); Object selected = this.cmbTemplates.getSelectedItem(); diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/ViewEmailDialog.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/ViewEmailDialog.java index 0a752f1af..f7b4d39a3 100755 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/ViewEmailDialog.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/ViewEmailDialog.java @@ -838,7 +838,7 @@ private void cmdReplyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS dlg = EmailUtils.reply(this.outlookMsg, this.content.getBody(), this.content.getContentType()); } dlg.setArchiveFile(this.contextArchiveFile, this.contextFolder); - this.setPartiesToSendDialog(dlg); + this.setPartiesToSendDialog(dlg, false); FrameUtils.centerDialog(dlg, null); dlg.setVisible(true); @@ -852,7 +852,7 @@ private void cmdReplyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS private void cmdReplyAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdReplyAllActionPerformed SendEmailDialog dlg = new SendEmailDialog(true, EditorsRegistry.getInstance().getMainWindow(), false); dlg.setArchiveFile(this.contextArchiveFile, this.contextFolder); - this.setPartiesToSendDialog(dlg); + this.setPartiesToSendDialog(dlg, false); if (this.emlMsg != null) { MessageContainer msgC = this.emlMsg; @@ -953,7 +953,7 @@ private void cmdReplyAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F }//GEN-LAST:event_cmdReplyAllActionPerformed - private void setPartiesToSendDialog(SendEmailDialog dlg) { + private void setPartiesToSendDialog(SendEmailDialog dlg, boolean evaluateTemplates) { if (this.contextArchiveFile != null) { try { ClientSettings settings = ClientSettings.getInstance(); @@ -961,7 +961,7 @@ private void setPartiesToSendDialog(SendEmailDialog dlg) { ArchiveFileServiceRemote afs = locator.lookupArchiveFileServiceRemote(); List list = afs.getInvolvementDetailsForCase(this.contextArchiveFile.getId(), false); for (ArchiveFileAddressesBean aab : list) { - dlg.addParty(aab); + dlg.addParty(aab, evaluateTemplates); } } catch (Throwable t) { log.error("Unable to add recipient candidates", t); @@ -972,7 +972,7 @@ private void setPartiesToSendDialog(SendEmailDialog dlg) { private void cmdForwardActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdForwardActionPerformed SendEmailDialog dlg = new SendEmailDialog(true, EditorsRegistry.getInstance().getMainWindow(), false); dlg.setArchiveFile(this.contextArchiveFile, this.contextFolder); - this.setPartiesToSendDialog(dlg); + this.setPartiesToSendDialog(dlg, false); if (this.emlMsg != null) { MessageContainer msgC = this.emlMsg;