From 8ccd38230a56e68d584a61215b7c948cb72e461b Mon Sep 17 00:00:00 2001 From: j-dimension Date: Sun, 13 Oct 2024 18:49:02 +0200 Subject: [PATCH 1/2] no e-invoice creation for specific invoice types (e.g. offer). issue #2165 --- .../client/editors/files/InvoiceDialog.java | 45 +++++++++++-------- .../jlawyer/client/utils/FileConverter.java | 3 +- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/InvoiceDialog.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/InvoiceDialog.java index 7df687d91..b8ac14fb1 100644 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/InvoiceDialog.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/InvoiceDialog.java @@ -2483,26 +2483,35 @@ private void cmdCreateInvoiceDocumentActionPerformed(java.awt.event.ActionEvent JOptionPane.showMessageDialog(this, "Es ist kein Rechnungssender definiert, E-Rechnung kann nicht erstellt werden.", com.jdimension.jlawyer.client.utils.DesktopUtils.POPUP_TITLE_WARNING, JOptionPane.WARNING_MESSAGE); return; } - - // Options to display - String[] options = {"Elektronische Rechnung (an Unternehmen)", "XRechnung (an öffentliche Auftraggeber)"}; - - // Show option dialog - int choice = JOptionPane.showOptionDialog( - this, // Parent component (null for no parent) - "Rechnung erstellen als:", // Message to display - "Rechnungsdokument erstellen", // Title of the dialog - JOptionPane.DEFAULT_OPTION, // Option type (default for custom buttons) - JOptionPane.QUESTION_MESSAGE, // Message type (question icon) - null, // Icon (null for default icon) - options, // Options array - options[0] // Initial value (default selection) - ); - - if (choice < 0) { - return; + + + // by default, create document from document template + int choice=0; + + // if the invoice type indicates a real invoice where there is a turnover, we need to create an electronic invoice + if(this.currentEntry.getInvoiceType().isTurnOver()) { + // Options to display + String[] options = {"Elektronische Rechnung (an Unternehmen)", "XRechnung (an öffentliche Auftraggeber)"}; + + // Show option dialog + choice = JOptionPane.showOptionDialog( + this, // Parent component (null for no parent) + "Rechnung erstellen als:", // Message to display + "Rechnungsdokument erstellen", // Title of the dialog + JOptionPane.DEFAULT_OPTION, // Option type (default for custom buttons) + JOptionPane.QUESTION_MESSAGE, // Message type (question icon) + null, // Icon (null for default icon) + options, // Options array + options[0] // Initial value (default selection) + ); + + if (choice < 0) { + return; + } } + + AppUserBean senderUser = null; try { JLawyerServiceLocator locator = JLawyerServiceLocator.getInstance(ClientSettings.getInstance().getLookupProperties()); diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/utils/FileConverter.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/utils/FileConverter.java index 24e758a09..558a912b1 100755 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/utils/FileConverter.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/utils/FileConverter.java @@ -736,7 +736,8 @@ public String convertToPDF(String file, ArchiveFileDocumentsBean doc) throws Exc throw new Exception("Diesem Dokument ist mit mehreren Rechnungen verknüpft, elektronische Rechnung kann nicht erstellt werden."); } - if (invoices.size() == 1) { + // only create e-invoice if the invoice type indicates a turnover / flow of money + if (invoices.size() == 1 && invoices.get(0).getInvoiceType()!=null && invoices.get(0).getInvoiceType().isTurnOver()) { // generate electronic invoice Invoice sourceInvoice = invoices.get(0); if (StringUtils.isEmpty(sourceInvoice.getSender())) { From ac783dbecb030577714565c63329aea4a01762d0 Mon Sep 17 00:00:00 2001 From: j-dimension Date: Tue, 15 Oct 2024 11:40:27 +0200 Subject: [PATCH 2/2] increased default timeouts. issue #2395 --- .../client/configuration/AssistantSetupDialog.form | 4 ++-- .../client/configuration/AssistantSetupDialog.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/configuration/AssistantSetupDialog.form b/j-lawyer-client/src/com/jdimension/jlawyer/client/configuration/AssistantSetupDialog.form index a9cc90af1..9b992816a 100644 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/configuration/AssistantSetupDialog.form +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/configuration/AssistantSetupDialog.form @@ -60,7 +60,7 @@ - + @@ -366,7 +366,7 @@ - + diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/configuration/AssistantSetupDialog.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/configuration/AssistantSetupDialog.java index f190d5876..260249069 100644 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/configuration/AssistantSetupDialog.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/configuration/AssistantSetupDialog.java @@ -732,7 +732,7 @@ private void resetDetails() { this.txtUser.setText(""); this.txtConfigurations.setText(""); this.spnConnectTimeout.setValue(3); - this.spnReadTimeout.setValue(5); + this.spnReadTimeout.setValue(120); } @@ -887,7 +887,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { spnConnectTimeout.setModel(new javax.swing.SpinnerNumberModel(3, 1, 10, 1)); - spnReadTimeout.setModel(new javax.swing.SpinnerNumberModel(5, 1, 60, 1)); + spnReadTimeout.setModel(new javax.swing.SpinnerNumberModel(120, 1, 300, 1)); jLabel10.setText("lesen"); @@ -933,7 +933,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(spnConnectTimeout, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel12))) - .addGap(0, 200, Short.MAX_VALUE)) + .addGap(0, 185, Short.MAX_VALUE)) .addComponent(txtConfigurations, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtName) .addComponent(txtUrl, javax.swing.GroupLayout.Alignment.LEADING))) @@ -1044,7 +1044,7 @@ private void cmdAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST: ac.setName(newNameObject.toString()); ac.setUrl(""); ac.setConnectionTimeout(5); - ac.setReadTimeout(60); + ac.setReadTimeout(120); ac.setUserName(null); ac.setPassword(null); ac.setConfiguration("");