mailList= kreditor.getItemValue("cdtr.mail");
+ mailList= mailList.stream()
+ .filter(str -> str != null && !str.isEmpty())
+ .map(String::trim)
+ .collect(Collectors.toList());
+
+ for (String mail: mailList) {
+ 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.mail",mailList);
cargoCreditor.setItemValue("cdtr.iban", kreditor.getItemValueString("cdtr.iban"));
cargoCreditor.setItemValue("cdtr.bic", kreditor.getItemValueString("cdtr.bic"));
cargoCreditor.setItemValue("cdtr.iban2", kreditor.getItemValueString("cdtr.iban2"));
diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/mahnlauf/MahnlaufExecuteAdapter.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/mahnlauf/MahnlaufExecuteAdapter.java
index 3d0d509..41d3db7 100644
--- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/mahnlauf/MahnlaufExecuteAdapter.java
+++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/mahnlauf/MahnlaufExecuteAdapter.java
@@ -2,6 +2,7 @@ package com.alexanderlogistics.mahnlauf;
import java.time.LocalDate;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@@ -20,12 +21,17 @@ import org.imixs.workflow.exceptions.AdapterException;
import org.imixs.workflow.exceptions.ModelException;
import org.imixs.workflow.exceptions.PluginException;
+import com.alexanderlogistics.InvoiceUtil;
+
/**
* The MahnlaufExecuteAdapter triggers the event 300 for all linked invoices
*
* The Adapter also creates a child item '_invoices' with the details of the
* processed invoices. This item is used in the Workflow Model to construct a
* HTML Table wen sending the mail.
+ *
+ * The Adapter also splits the item 'dbtr.mail' into a multi value field if
+ * the value contains email addresses separated with new lines.
*
*
* @version 1.0
@@ -183,6 +189,16 @@ public class MahnlaufExecuteAdapter implements SignalAdapter {
break;
}
+
+ // Verify the dbtr.mail item (split into multi value)
+ List mailListe =mahnLaufWorkitem.getItemValue("dbtr.mail");
+ for (String mail: mailListe) {
+ logger.info(" teste mail:'" + mail + "'");
+ if (!InvoiceUtil.validateEmail(mail)) {
+ throw new PluginException(MahnlaufExecuteAdapter.class.getName(),
+ "INVALID_EMAIL", "Die Daten konnten nicht aktualisiert werden! Bitte geben Sie eine gültige E-Mail Adresse ein!");
+ }
+ }
return mahnLaufWorkitem;
}
diff --git a/office-alexander-logistics-app/src/main/webapp/pages/admin/kreditor.xhtml b/office-alexander-logistics-app/src/main/webapp/pages/admin/kreditor.xhtml
index da8a234..bdd4025 100644
--- a/office-alexander-logistics-app/src/main/webapp/pages/admin/kreditor.xhtml
+++ b/office-alexander-logistics-app/src/main/webapp/pages/admin/kreditor.xhtml
@@ -58,8 +58,11 @@
- E-Mail:
-
+ -
+
+ Trennen Sie mehrere Adressen durch neue Zeilen.
diff --git a/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/cargsoft-creditor-search.xhtml b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/cargsoft-creditor-search.xhtml
index d993ba3..e495037 100644
--- a/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/cargsoft-creditor-search.xhtml
+++ b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/cargsoft-creditor-search.xhtml
@@ -60,7 +60,7 @@
var inputElementZahlungsziel=$("input[data-item='cdtr.creditperiod']");
var inputElementZahlungszielCdtr=$("input[id$='cdtr_creditperiod']");
var inputElementInvoiceDate=$("input[id$='date_invoice']");
- var inputElementMail=$("input[data-item='cdtr.mail']");
+ var inputElementMail=$("input[data-item='cdtr.mail'],textarea[data-item='cdtr.mail']");
var inputElementIban=$("input[data-item='cdtr.iban']");
var inputElementBic=$("input[data-item='cdtr.bic']");
if (inputElementZahlungszielCdtr) {
diff --git a/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/cargsoft-debitor-search.xhtml b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/cargsoft-debitor-search.xhtml
index ae50437..bd03ede 100644
--- a/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/cargsoft-debitor-search.xhtml
+++ b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/cargsoft-debitor-search.xhtml
@@ -58,10 +58,18 @@
// append span with dbtr.name....
inputElement.after( "" + dbtrData.name + "
" );
+
var inputElementDbtrName=$("input[id$='dbtr_name']");
if (inputElementDbtrName) {
inputElementDbtrName.val(dbtrData.name);
}
+ // check if we have a mail...
+ if (dbtrData.mail) {
+ var inputElementMail=$("input[data-item='dbtr.mail'],textarea[data-item='dbtr.mail']");
+ if (inputElementMail) {
+ inputElementMail.val(dbtrData.mail);
+ }
+ }
// finally we do a trick and trigger the commandScript updateDbtrNumber which
diff --git a/pom.xml b/pom.xml
index 33ab287..62a1ce4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
4.0.0
com.alexander-logistics
office-alexander-logistics
- 1.2.11
+ 1.2.12
pom
Imixs Office Workflow - Custom Build
@@ -24,7 +24,7 @@
5.2.18
4.2.3
- 4.6.1
+ 4.6.2-SNAPSHOT
2.3.1
2.3.1-SNAPSHOT
diff --git a/workflow/mahnlauf-de-1.0.4.bpmn b/workflow/mahnlauf-de-1.0.4.bpmn
new file mode 100644
index 0000000..111caaa
--- /dev/null
+++ b/workflow/mahnlauf-de-1.0.4.bpmn
@@ -0,0 +1,1203 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+$workflowstatus
+
+]]>
+
+
+
+]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ StartEvent_1
+ Task_1
+ IntermediateCatchEvent_3
+ EndEvent_3
+ IntermediateCatchEvent_1
+ IntermediateCatchEvent_5
+ ExclusiveGateway_2
+ IntermediateCatchEvent_4
+ Task_2
+ ExclusiveGateway_1
+ IntermediateCatchEvent_2
+ IntermediateCatchEvent_8
+ IntermediateCatchEvent_7
+ Task_3
+ IntermediateCatchEvent_9
+ IntermediateCatchEvent_6
+
+
+
+
+ SequenceFlow_4
+
+
+
+
+
+ $lasteventdate - dbtr.name (dbtr.number)]]>
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $workflowgroup - $workflowstatus]]>
+ SequenceFlow_6
+ SequenceFlow_15
+ SequenceFlow_10
+ SequenceFlow_18
+
+
+
+
+
+ SequenceFlow_10
+ SequenceFlow_13
+
+
+
+
+
+ $lasteventdate - dbtr.name (dbtr.number)]]>
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $workflowgroup - $workflowstatus]]>
+ SequenceFlow_14
+ SequenceFlow_4
+ SequenceFlow_1
+ SequenceFlow_2
+ SequenceFlow_3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+ SequenceFlow_6
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+
+
+ SequenceFlow_14
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ home
+- Mahnwesen
]]>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+ SequenceFlow_2
+ SequenceFlow_16
+
+
+ DataOutput_1
+
+
+ DataOutput_1
+
+
+
+
+
+
+
+ SequenceFlow_17
+ SequenceFlow_8
+ SequenceFlow_9
+
+
+
+
+
+ Html-Header
+E-Mail - Mahnlauf-dunning.level (DE)
+
+description
+
+
+Debitor: dbtr.name (dbtr.number)
+
+
+
+
+| Rechnungsnummer |
+Datum |
+Fälligkeit |
+Rechnungsbetrag |
+Saldo |
+Mahnstufe |
+
+
+
+
+
+
+ | invoice.number |
+ invoice.date |
+ invoice.duedate |
+ invoice.total invoice.currency |
+ invoice.saldo invoice.currency |
+ $workflowstatus |
+
+
+
+ | | | Saldo | dunning.saldo dunning.currency |
+
+
+
+
+E-Mail - Mahnlauf Footer (DE)
+Html-Footer
+]]>
+
+
+ mail.subject_de]]>
+
+
+
+
+
+
+
+
+
+
+
+
+ SequenceFlow_8
+ SequenceFlow_11
+
+
+
+
+
+
+ Html-Header
+E-Mail - Mahnlauf-dunning.level (EN)
+
+description
+
+
+Debitor: dbtr.name (dbtr.number)
+
+
+
+
+| Invoice No. |
+Date |
+Expiry Date |
+Invoice Amount |
+Balance |
+Dunning Level |
+
+
+
+
+
+
+ | invoice.number |
+ invoice.date |
+ invoice.duedate |
+ invoice.total invoice.currency |
+ invoice.saldo invoice.currency |
+ workflowstatus_en |
+
+
+
+ | | | Saldo | dunning.saldo dunning.currency |
+
+
+
+E-Mail - Mahnlauf Footer (EN)
+Html-Footer
+]]>
+
+
+ mail.subject_en]]>
+
+
+
+
+
+
+
+
+
+
+
+
+ SequenceFlow_9
+ SequenceFlow_12
+
+
+
+
+ workitem['invoice.language'] && workitem['invoice.language'][0]=="DE"
+
+
+
+
+
+
+ SequenceFlow_11
+ SequenceFlow_12
+ SequenceFlow_15
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Mahnwesen]]>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+ SequenceFlow_1
+
+
+
+
+
+
+
+
+
+ $lasteventdate - dbtr.name (dbtr.number)]]>
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $workflowgroup - $workflowstatus]]>
+ SequenceFlow_5
+ SequenceFlow_13
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ home]]>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+
+
+ SequenceFlow_3
+ SequenceFlow_5
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+ SequenceFlow_16
+ SequenceFlow_19
+ SequenceFlow_17
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ home]]>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+ 0) {
+ var liste=workitem.get("dbtr.mail");
+ for (i = 0; i < liste.length; i++) {
+ validateMail(liste[i]);
+ }
+}
+
+
+function validateMail(mail) {
+ if (/^(?=.{1,64}@)[A-Za-z0-9_-]+(\.[A-Za-z0-9_-]+)*@[^-][A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(\.[A-Za-z]{2,})$/.test(mail)) {
+ // OK
+ } else {
+ result.isValid=false;
+ result.errorMessage='Bitte geben Sie eine gültige E-Mail Adresse ein ('+ mail + ')!';
+ }
+}
+]]>
+
+
+
+ SequenceFlow_18
+ SequenceFlow_19
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/workflow/validate_mail.js b/workflow/validate_mail.js
new file mode 100644
index 0000000..625d2f3
--- /dev/null
+++ b/workflow/validate_mail.js
@@ -0,0 +1,24 @@
+var result={};
+result.isValid=true;
+
+if (( workitem.get("txtcomment") == null || ''==workitem.get("txtcomment")[0]) ) {
+ result.isValid=false;
+ result.errorMessage='Bitte geben Sie einen Kommentar ein.';
+}
+
+if (workitem['dbtr.mail'] && workitem['dbtr.mail'].length>0) {
+ var liste=workitem.get("dbtr.mail");
+ for (i = 0; i < liste.length; i++) {
+ validateMail(liste[i]);
+ }
+}
+
+
+function validateMail(mail) {
+ if (/^(?=.{1,64}@)[A-Za-z0-9_-]+(\.[A-Za-z0-9_-]+)*@[^-][A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(\.[A-Za-z]{2,})$/.test(mail)) {
+ // OK
+ } else {
+ result.isValid=false;
+ result.errorMessage='Bitte geben Sie eine gültige E-Mail Adresse ein ('+ mail + ')!';
+ }
+}