update mahnlauf
This commit is contained in:
parent
1870d0856a
commit
7bc51dd69b
12 changed files with 7384 additions and 351 deletions
6
MAIL_OAUTH2.md
Normal file
6
MAIL_OAUTH2.md
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
|
||||
|
||||
https://techcommunity.microsoft.com/t5/exchange/javamail-connecting-to-office-365-xoauth2-for-imap/m-p/1505026
|
||||
|
||||
|
||||
|
|
@ -104,8 +104,8 @@ public class OPListController implements Serializable {
|
|||
_dbtrNumber = _dbtrNumber.substring(1);
|
||||
}
|
||||
// (type:workitem OR type:workitemarchive)
|
||||
String query = "(type:workitem) AND ($modelversion:rechnungsausgang-*) AND (dbtr.number:"
|
||||
+ _dbtrNumber + ")";
|
||||
String query = "(type:workitem) AND ($modelversion:rechnungsausgang-*) AND (dbtr.number:" + _dbtrNumber
|
||||
+ ")";
|
||||
|
||||
try {
|
||||
invoiceList = documentService.find(query, 999, 0, "$created", false);
|
||||
|
|
@ -117,11 +117,15 @@ public class OPListController implements Serializable {
|
|||
// We are no longer in TASK_ERSTELLUNG, so
|
||||
// fetch only selected invoices
|
||||
invoiceList = new ArrayList<ItemCollection>();
|
||||
if (!workflowController.getWorkitem().isItemEmpty("$workitemref")) {
|
||||
List<String> selection = workflowController.getWorkitem().getItemValue("$workitemref");
|
||||
for (String id : selection) {
|
||||
if (id != null && !id.isEmpty()) {
|
||||
invoiceList.add(documentService.load(id));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// finally we set the 'selection' item depending on the $workitemList
|
||||
// and the payment amount form the 'payment.details'
|
||||
|
|
@ -234,15 +238,16 @@ public class OPListController implements Serializable {
|
|||
workflowController.getWorkitem().setItemValue("dbtr.number", dbtrNumber);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Hilfsmethode delegates to ZahlungseingangServcie
|
||||
*
|
||||
* @param payment
|
||||
* @return
|
||||
*/
|
||||
public List<ItemCollection> loadPaymentDetails(ItemCollection payment) {
|
||||
return zahlungseingangService.loadPaymentDetails(payment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Berechnet den gesammten OP Saldo
|
||||
*
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import java.io.InputStream;
|
|||
import java.text.DateFormat;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
|
@ -49,7 +50,7 @@ import org.imixs.workflow.exceptions.PluginException;
|
|||
import org.imixs.workflow.exceptions.QueryException;
|
||||
|
||||
/**
|
||||
* The CargosoftExportScheduler exportier eine csv Datei auf eine FTP Laufwerk
|
||||
* The CargosoftExportScheduler exportiert eine csv Datei auf eine FTP Laufwerk
|
||||
* mit allen noch offenen Rechnungen. Diese Datei wird von Cargosoft ann
|
||||
* verwendet um den Kreditramen für einen kunden zu ermitteln. Es werden
|
||||
* praktisch von Cargosoft nur die offenen Salen aus unserer CSV Datei pro
|
||||
|
|
@ -135,25 +136,35 @@ public class CargosoftExportScheduler implements Scheduler {
|
|||
}
|
||||
// Saldo; S/H Saldo
|
||||
betrag = doc.getItemValueDouble("invoice.saldo");
|
||||
if (betrag >= 0) {
|
||||
|
||||
// convert to hauswahrung
|
||||
double rate = doc.getItemValueDouble("invoice.rate");
|
||||
double hausWaehrung = betrag;
|
||||
if (rate != 0.0) {
|
||||
hausWaehrung = betrag / rate;
|
||||
}
|
||||
|
||||
if (hausWaehrung >= 0) {
|
||||
// Soll
|
||||
line = line + decimalFormat.format(betrag) + ";S;";
|
||||
line = line + decimalFormat.format(hausWaehrung) + ";S;";
|
||||
} else {
|
||||
// Haben
|
||||
line = line + decimalFormat.format(Math.abs(betrag)) + ";H;";
|
||||
line = line + decimalFormat.format(Math.abs(hausWaehrung)) + ";H;";
|
||||
}
|
||||
|
||||
// WKZ
|
||||
String wkz = doc.getItemValueString("invoice.currency");
|
||||
if (!"EUR".equals(wkz)) {
|
||||
line = line + wkz + ";" + rateFormat.format(doc.getItemValueDouble("invoice.rate")) + ";"
|
||||
+ decimalFormat.format(doc.getItemValueDouble("invoice.base.amount")) + ";";
|
||||
line = line + //
|
||||
wkz + ";" + //
|
||||
decimalFormat.format(doc.getItemValueDouble("invoice.base.amount")) + ";" + //
|
||||
rateFormat.format(doc.getItemValueDouble("invoice.rate")) + ";";
|
||||
} else {
|
||||
line = line + ";0,000000;0,00;";
|
||||
line = line + ";0,00;0,000000;";
|
||||
}
|
||||
|
||||
line = line + ";;;;;;" +doc.getItemValueString("invoice.text");
|
||||
// auffüllen mit 77 mal ';'
|
||||
int i = 77;
|
||||
int i = 69;
|
||||
while (i > 0) {
|
||||
line = line + ";";
|
||||
i--;
|
||||
|
|
@ -165,7 +176,10 @@ public class CargosoftExportScheduler implements Scheduler {
|
|||
}
|
||||
|
||||
// transfer file via FTP...
|
||||
FileData fileData = new FileData("OPD28.txt", String.valueOf(buffer).getBytes(), null, null);
|
||||
DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmm");
|
||||
// MMM d, yyyy HH:mm a
|
||||
FileData fileData = new FileData("OPD_" + formatter.format(new Date()) + ".txt",
|
||||
String.valueOf(buffer).getBytes(), null, null);
|
||||
|
||||
put(configuration, fileData);
|
||||
|
||||
|
|
|
|||
|
|
@ -44,12 +44,17 @@ public class MahnlaufExecuteAdapter implements SignalAdapter {
|
|||
public ItemCollection execute(ItemCollection mahnLaufWorkitem, ItemCollection event)
|
||||
throws AdapterException, PluginException {
|
||||
|
||||
if (mahnLaufWorkitem.isItemEmpty("$workitemref")) {
|
||||
throw new PluginException(MahnlaufRefAddAdapter.class.getName(), MahnlaufService.ERROR_WORKFLOW,
|
||||
"Es wurden keine Rechnungen ausgewählt. Der Mahnlauf kann nicht gestartet werden.");
|
||||
}
|
||||
|
||||
// get all Invoices of this Mahnlauf
|
||||
List<String> refList = mahnLaufWorkitem.getItemValue("$workitemref");
|
||||
|
||||
for (String uniqueId : refList) {
|
||||
ItemCollection invoice = workflowService.getWorkItem(uniqueId);
|
||||
if (invoice != null && (invoice.getTaskID()>=MahnlaufService.TASK_MAHNLAUF_START && invoice.getTaskID()<=MahnlaufService.TASK_MAHNLAUF_END)) {
|
||||
if (invoice != null && (invoice.getTaskID() >= MahnlaufService.TASK_MAHNLAUF_START
|
||||
&& invoice.getTaskID() <= MahnlaufService.TASK_MAHNLAUF_END)) {
|
||||
mahnlaufService.processInvoice(invoice.event(MahnlaufService.EVENT_MAHNLAUF_EXECUTE));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ import org.imixs.workflow.exceptions.PluginException;
|
|||
import org.imixs.workflow.exceptions.QueryException;
|
||||
import org.imixs.workflow.sepa.services.SepaWorkflowService;
|
||||
|
||||
import com.alexanderlogistics.KreditorDebitorService;
|
||||
|
||||
/**
|
||||
* The MahnlaufRefAddAdapter links an invoice with a Mahnlauf for the
|
||||
* dbtr.number item . If there is currently no open Mahnlauf for this key, the
|
||||
|
|
@ -38,6 +40,9 @@ public class MahnlaufRefAddAdapter implements SignalAdapter {
|
|||
@EJB
|
||||
ModelService modelService;
|
||||
|
||||
@EJB
|
||||
KreditorDebitorService kreditorDebitorService;
|
||||
|
||||
@EJB
|
||||
WorkflowService workflowService = null;
|
||||
|
||||
|
|
@ -55,6 +60,12 @@ public class MahnlaufRefAddAdapter implements SignalAdapter {
|
|||
public ItemCollection execute(ItemCollection invoice, ItemCollection event)
|
||||
throws AdapterException, PluginException {
|
||||
|
||||
|
||||
if (invoice.getTaskID()<MahnlaufService.TASK_MAHNLAUF_START || invoice.getTaskID()>MahnlaufService.TASK_MAHNLAUF_END) {
|
||||
throw new PluginException(MahnlaufRefAddAdapter.class.getName(),
|
||||
MahnlaufService.ERROR_CONFIG, "Der Mahnlauf kann nur für Rechnungen erstellt werden die bereits die Fälligkeit erreicht haben.");
|
||||
}
|
||||
|
||||
String dbtrNumber = invoice.getItemValueString(MahnlaufService.ITEM_DBTR_NUMBER);
|
||||
ItemCollection mahnLaufWorkitem;
|
||||
try {
|
||||
|
|
@ -139,7 +150,15 @@ public class MahnlaufRefAddAdapter implements SignalAdapter {
|
|||
|
||||
// copy dbtr_iban
|
||||
mahnlaufWorkitem.setItemValue(MahnlaufService.ITEM_DBTR_NAME, invoice.getItemValue(MahnlaufService.ITEM_DBTR_NAME));
|
||||
mahnlaufWorkitem.setItemValue(MahnlaufService.ITEM_DBTR_EMAIL, invoice.getItemValue(MahnlaufService.ITEM_DBTR_EMAIL));
|
||||
|
||||
|
||||
// lookup email....
|
||||
String dbtrNumber=invoice.getItemValueString("dbtr.number");
|
||||
ItemCollection dbtrItemCol=kreditorDebitorService.findDebitor("D"+dbtrNumber);
|
||||
if (dbtrItemCol!=null) {
|
||||
mahnlaufWorkitem.setItemValue(MahnlaufService.ITEM_DBTR_EMAIL, dbtrItemCol.getItemValueString("cdtr.mail"));// dbtr.mail
|
||||
}
|
||||
|
||||
mahnlaufWorkitem.setItemValue(MahnlaufService.ITEM_DBTR_NUMBER, invoice.getItemValue(MahnlaufService.ITEM_DBTR_NUMBER));
|
||||
|
||||
mahnlaufWorkitem.setItemValue("invoice.language", invoice.getItemValue("invoice.language"));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
|
||||
xmlns:f="http://xmlns.jcp.org/jsf/core"
|
||||
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
|
||||
xmlns:h="http://xmlns.jcp.org/jsf/html">
|
||||
|
||||
<!-- Zeit alle verknüften Zahlungen an -->
|
||||
|
||||
|
||||
<h:panelGroup layout="block" styleClass="imixs-form-section"
|
||||
id="paymentlist">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<table class="imixsdatatable ">
|
||||
|
||||
|
||||
<tr>
|
||||
<th style="">Mahnungen</th>
|
||||
</tr>
|
||||
|
||||
<ui:param name="dunnings"
|
||||
value="#{workitemLinkController.getExternalReferences('$workflowgroup:Mahnlauf')}"></ui:param>
|
||||
<ui:repeat var="dunning_stub" value="#{dunnings}">
|
||||
<ui:param name="dunning"
|
||||
value="#{opListController.loadInvoice(dunning_stub.getUniqueID())}"></ui:param>
|
||||
|
||||
<tr>
|
||||
<td><h:link outcome="/pages/workitems/workitem">
|
||||
#{dunning.item['$workflowsummary']}
|
||||
<f:param name="id" value="#{dunning.item['$uniqueid']}" />
|
||||
</h:link></td>
|
||||
|
||||
|
||||
</tr>
|
||||
</ui:repeat>
|
||||
|
||||
|
||||
</table>
|
||||
</h:panelGroup>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ui:composition>
|
||||
|
|
@ -67,7 +67,6 @@
|
|||
<td style="text-align: right; color: red;"><h:outputText
|
||||
value="#{invoice.item['invoice.saldo']}">
|
||||
<f:convertNumber minFractionDigits="2" locale="de" />
|
||||
|
||||
</h:outputText></td>
|
||||
|
||||
|
||||
|
|
@ -75,13 +74,18 @@
|
|||
|
||||
|
||||
<!-- CheckBox -->
|
||||
<td style="text-align: center;"><h:selectBooleanCheckbox class="invoice_selector" rendered="#{!readonly}"
|
||||
<td style="text-align: center;">
|
||||
|
||||
<ui:fragment rendered="#{invoice.taskID ge 5100 and invoice.taskID lt 5299}">
|
||||
<h:selectBooleanCheckbox class="invoice_selector" rendered="#{!readonly}"
|
||||
value="#{invoice.item['selected']}"
|
||||
onclick="initInvoicePayment(this)">
|
||||
<f:ajax event="change" execute="#{opListContainer.clientId}"
|
||||
listener="#{opListController.updateChildList(workitem)}"
|
||||
render="#{opListContainer.clientId}"></f:ajax>
|
||||
</h:selectBooleanCheckbox></td>
|
||||
</h:selectBooleanCheckbox>
|
||||
</ui:fragment>
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
|
||||
|
||||
|
||||
<table class="imixsdatatable ">
|
||||
|
||||
|
||||
|
|
@ -29,7 +28,7 @@
|
|||
</tr>
|
||||
|
||||
<ui:param name="payments"
|
||||
value="#{workitemLinkController.getExternalReferences('($WorkflowGroup:Zahlungseingang)')}"></ui:param>
|
||||
value="#{workitemLinkController.getExternalReferences('$workflowgroup:Zahlungseingang')}"></ui:param>
|
||||
<ui:repeat var="payment_stub" value="#{payments}">
|
||||
<ui:param name="payment"
|
||||
value="#{opListController.loadInvoice(payment_stub.getUniqueID())}"></ui:param>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,82 @@
|
|||
package com.alexanderlogistics;
|
||||
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.NoSuchProviderException;
|
||||
import javax.mail.Session;
|
||||
import javax.mail.Store;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
/**
|
||||
* This test generates random test data
|
||||
*
|
||||
* @author rsoika
|
||||
*
|
||||
*/
|
||||
public class TestIMAPOauth2 {
|
||||
|
||||
final static String FILE = "/DTVF_SKBeschrift_21010.csv";
|
||||
|
||||
private final static Logger logger = Logger.getLogger(TestIMAPOauth2.class.getName());
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test imap connect via oauth
|
||||
*
|
||||
* https://techcommunity.microsoft.com/t5/exchange/javamail-connecting-to-office-365-xoauth2-for-imap/m-p/1505026
|
||||
*/
|
||||
@Test
|
||||
public void testIMAP() {
|
||||
try {
|
||||
Properties properties = new Properties();
|
||||
properties.put("mail.imap.ssl.enable", "true");
|
||||
properties.put("mail.imap.auth.mechanisms", "XOAUTH2");
|
||||
properties.put("mail.imap.auth.mechanisms", "XOAUTH2");
|
||||
properties.put("mail.imap.sasl.mechanisms", "XOAUTH2");
|
||||
properties.put("mail.imap.sasl.enable", "true");
|
||||
// properties.put("mail.imap.sasl.enable", "true"); un-commented still results
|
||||
// are same
|
||||
properties.put("mail.imap.auth.login.disable", "true");
|
||||
properties.put("mail.imap.auth.plain.disable", "true");
|
||||
properties.put("mail.debug", "true");
|
||||
properties.put("mail.debug.auth", "true");
|
||||
|
||||
String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
|
||||
properties.setProperty("mail.imap.socketFactory.class", SSL_FACTORY);
|
||||
properties.setProperty("mail.imap.socketFactory.fallback", "false");
|
||||
properties.setProperty("mail.imap.socketFactory.port", "993");
|
||||
properties.setProperty("mail.imap.starttls.enable", "true");
|
||||
|
||||
|
||||
Session session = Session.getInstance(properties);
|
||||
session.setDebug(true);
|
||||
|
||||
String userEmail = "imixs@alexander-logistics.com";
|
||||
// i^i$oe-!+o1o0io(
|
||||
String accessToken = "accessToken";
|
||||
|
||||
Store store;
|
||||
|
||||
store = session.getStore("imap");
|
||||
|
||||
String url="outlook.office365.com";
|
||||
//String url="https://outlook.office.com/IMAP.AccessAsUser.All";
|
||||
store.connect(url, 993, userEmail, accessToken);
|
||||
} catch (MessagingException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
Assert.fail();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
6850
office-alexander-logistics-app/src/test/resources/datev/OPD28.csv
Normal file
6850
office-alexander-logistics-app/src/test/resources/datev/OPD28.csv
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -413,6 +413,7 @@ Bei Fragen wenden Sie sich bitte an info@imixs.com
|
|||
<imixs-form-section label="Positionen" path="alexander/section_datevbuchung" />
|
||||
|
||||
<imixs-form-section label="Zahlungseingänge" path="alexander/section_payments" />
|
||||
<imixs-form-section label="Mahnläufe" path="alexander/section_dunnings" />
|
||||
</imixs-form>]]></bpmn2:documentation>
|
||||
<bpmn2:dataState id="DataState_1"/>
|
||||
</bpmn2:dataObject>
|
||||
|
|
|
|||
Loading…
Reference in a new issue