absicherung Mail Adresse im Mahnlauf
This commit is contained in:
parent
9b8bc1e330
commit
ba221f51f6
5 changed files with 1227 additions and 2 deletions
|
|
@ -18,7 +18,9 @@ import javax.json.JsonObjectBuilder;
|
|||
|
||||
import org.imixs.workflow.ItemCollection;
|
||||
import org.imixs.workflow.engine.DocumentService;
|
||||
import org.imixs.workflow.exceptions.PluginException;
|
||||
import org.imixs.workflow.exceptions.QueryException;
|
||||
import org.imixs.workflow.faces.util.ErrorHandler;
|
||||
|
||||
/**
|
||||
* The CargosoftController CDI Bean provides Front-End methods for the cargosoft
|
||||
|
|
@ -311,8 +313,11 @@ public class CargosoftController implements Serializable {
|
|||
/**
|
||||
* Diese Method überträgt die geänderten Daten in das Kreidtoren/Debitoren
|
||||
* Objekt (cdtr.creditperiod,cdtr.iban,cdtr.bic)
|
||||
*
|
||||
* Zusätzlich wird geprüft ob die eingegebene Mail Adresse eine gültige SMTP Adresse ist
|
||||
* @throws PluginException
|
||||
*/
|
||||
public void updateZahlungsziel() {
|
||||
public void updateZahlungsziel() throws PluginException {
|
||||
|
||||
String cdtrNumber = kreditor.getItemValueString("cdtr.number");
|
||||
logger.fine("Zahlungsziel = " + cdtrNumber);
|
||||
|
|
@ -331,7 +336,15 @@ public class CargosoftController implements Serializable {
|
|||
} catch (NumberFormatException nfe) {
|
||||
// no op
|
||||
}
|
||||
cargoCreditor.setItemValue("cdtr.mail", kreditor.getItemValueString("cdtr.mail"));
|
||||
|
||||
|
||||
String mail= kreditor.getItemValueString("cdtr.mail").trim();
|
||||
if (!InvoiceUtil.validateEmail(mail)) {
|
||||
throw new PluginException(CargosoftController.class.getName(),
|
||||
"INVALID_EMAIL", "Die Daten konnten nicht aktualisiert werden! Bitte geben Sie eine gültige E-Mail Adresse ein!");
|
||||
}
|
||||
|
||||
cargoCreditor.setItemValue("cdtr.mail",mail);
|
||||
cargoCreditor.setItemValue("cdtr.iban", kreditor.getItemValueString("cdtr.iban"));
|
||||
cargoCreditor.setItemValue("cdtr.bic", kreditor.getItemValueString("cdtr.bic"));
|
||||
cargoCreditor.setItemValue("cdtr.iban2", kreditor.getItemValueString("cdtr.iban2"));
|
||||
|
|
@ -344,6 +357,12 @@ public class CargosoftController implements Serializable {
|
|||
}
|
||||
} catch (QueryException e) {
|
||||
logger.severe("Unable to find cargosoft kreditor " + e.getMessage());
|
||||
|
||||
} catch (PluginException pe) {
|
||||
|
||||
// add a new FacesMessage into the FacesContext
|
||||
ErrorHandler.handlePluginException(pe);
|
||||
throw pe;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.alexanderlogistics;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.regex.Pattern;
|
||||
/**
|
||||
* Rundungs Methode
|
||||
*
|
||||
|
|
@ -18,6 +19,24 @@ public class InvoiceUtil {
|
|||
return bd.doubleValue();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Hilfsmethode zum validieren der Mailadresse
|
||||
*
|
||||
* @param emailAddress
|
||||
* @return
|
||||
*/
|
||||
public static boolean validateEmail(String emailAddress) {
|
||||
//String regexPattern = "^(.+)@(\\S+)$";
|
||||
|
||||
String regexPattern = "^(?=.{1,64}@)[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+)*@"
|
||||
+ "[^-][A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*(\\.[A-Za-z]{2,})$";
|
||||
return Pattern.compile(regexPattern)
|
||||
.matcher(emailAddress)
|
||||
.matches();
|
||||
}
|
||||
|
||||
|
||||
@Deprecated
|
||||
public static double roundConservative(double value) {
|
||||
value = value * 100;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@
|
|||
|
||||
<f:view>
|
||||
<h:form id="zahlungsziel_form_id">
|
||||
<!-- ########## Error ########## -->
|
||||
<ui:include src="/pages/error_message.xhtml" />
|
||||
|
||||
<!-- Cargosoft Creditor Search integration -->
|
||||
<ui:include
|
||||
src="/pages/workitems/forms/alexander/cargsoft-creditor-search.xhtml">
|
||||
|
|
|
|||
|
|
@ -115,4 +115,18 @@ public class TestFormat {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSMTPMailAddress() {
|
||||
|
||||
Assert.assertTrue(InvoiceUtil.validateEmail("info@imixs.com"));
|
||||
|
||||
Assert.assertFalse(InvoiceUtil.validateEmail("in fo@imixs.com"));
|
||||
|
||||
Assert.assertFalse(InvoiceUtil.validateEmail("SM PSP Queries <PSP.Queries@dssmith.com>"));
|
||||
|
||||
Assert.assertTrue(InvoiceUtil.validateEmail("PSP.Queries@dssmith.com"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
1170
workflow/mahnlauf-de-1.0.2.bpmn
Normal file
1170
workflow/mahnlauf-de-1.0.2.bpmn
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue