Skip to content

Commit

Permalink
proper error message in case of invalid invoice total when request a …
Browse files Browse the repository at this point in the history
…girocode. close #2349
  • Loading branch information
j-dimension committed Mar 24, 2024
1 parent db8f0dd commit 632d44f
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2432,9 +2432,21 @@ private void cmdTimesheetPositionsActionPerformed(java.awt.event.ActionEvent evt

private void cmdGiroCodeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdGiroCodeActionPerformed
try {
GirocodeDialog gcd = new GirocodeDialog(this, true, cf.parse(this.lblInvoiceTotal.getText()).floatValue(), this.lblInvoiceNumber.getText());
FrameUtils.centerDialog(gcd, this);
gcd.setVisible(true);
float amount=0f;
boolean validAmount=false;
try {
amount=cf.parse(this.lblInvoiceTotal.getText()).floatValue();
validAmount=true;
} catch (Throwable t) {
log.error("error parsing invoice total: " + this.lblInvoiceTotal.getText(), t);
}
if(validAmount) {
GirocodeDialog gcd = new GirocodeDialog(this, true, amount, this.lblInvoiceNumber.getText());
FrameUtils.centerDialog(gcd, this);
gcd.setVisible(true);
} else {
JOptionPane.showMessageDialog(this, "Der Rechnungsbetrag ist ungültig.", com.jdimension.jlawyer.client.utils.DesktopUtils.POPUP_TITLE_HINT, JOptionPane.INFORMATION_MESSAGE);
}
} catch (Exception ex) {
log.error("error loading invoice document", ex);
JOptionPane.showMessageDialog(this, "Girocode kann nicht erstellt werden: " + ex.getMessage(), com.jdimension.jlawyer.client.utils.DesktopUtils.POPUP_TITLE_ERROR, JOptionPane.ERROR_MESSAGE);
Expand Down

0 comments on commit 632d44f

Please sign in to comment.