This commit is contained in:
Ralph Soika 2023-02-01 16:23:01 +01:00
parent c0c50bc178
commit 2c5695f8fc

View file

@ -65,12 +65,12 @@ public class MahnlaufExecuteAdapter implements SignalAdapter {
List<String> refList = mahnLaufWorkitem.getItemValue("$workitemref"); List<String> refList = mahnLaufWorkitem.getItemValue("$workitemref");
// sind die Wärhungen idendtisch (mischmasch geht niht) // sind die Wärhungen idendtisch (mischmasch geht niht)
String lastCurrency=""; String lastCurrency = "";
for (String uniqueId : refList) { for (String uniqueId : refList) {
ItemCollection invoice = workflowService.getWorkItem(uniqueId); ItemCollection invoice = workflowService.getWorkItem(uniqueId);
String invoiceCurrency=invoice.getItemValueString("invoice.currency"); String invoiceCurrency = invoice.getItemValueString("invoice.currency");
if (lastCurrency.isEmpty()) { if (lastCurrency.isEmpty()) {
lastCurrency=invoiceCurrency; lastCurrency = invoiceCurrency;
} else { } else {
if (!lastCurrency.equals(invoiceCurrency)) { if (!lastCurrency.equals(invoiceCurrency)) {
throw new PluginException(MahnlaufRefAddAdapter.class.getName(), MahnlaufService.ERROR_WORKFLOW, throw new PluginException(MahnlaufRefAddAdapter.class.getName(), MahnlaufService.ERROR_WORKFLOW,
@ -79,10 +79,8 @@ public class MahnlaufExecuteAdapter implements SignalAdapter {
} }
} }
double saldo = 0; double saldo = 0;
int dunningLevel=0; int dunningLevel = 0;
String currency = ""; String currency = "";
for (String uniqueId : refList) { for (String uniqueId : refList) {
ItemCollection invoice = workflowService.getWorkItem(uniqueId); ItemCollection invoice = workflowService.getWorkItem(uniqueId);
@ -113,23 +111,25 @@ public class MahnlaufExecuteAdapter implements SignalAdapter {
mahnlaufService.processInvoice(invoice.event(MahnlaufService.EVENT_MAHNLAUF_EXECUTE)); mahnlaufService.processInvoice(invoice.event(MahnlaufService.EVENT_MAHNLAUF_EXECUTE));
} }
switch (invoice.getTaskID()) { switch (invoice.getTaskID()) {
case 5200: case 5200:
dunningLevel=1; if (dunningLevel < 1)
dunningLevel = 1;
break; break;
case 5210: case 5210:
dunningLevel=2; if (dunningLevel < 2)
dunningLevel = 2;
break; break;
case 5220: case 5220:
dunningLevel=3; if (dunningLevel < 3)
dunningLevel = 3;
break; break;
default: default:
dunningLevel=1; if (dunningLevel < 1)
dunningLevel = 1;
break; break;
} }
// create a workitem stub for the mail message // create a workitem stub for the mail message
ItemCollection invoiceStub = new ItemCollection(); ItemCollection invoiceStub = new ItemCollection();
invoiceStub.setItemValue("invoice.number", invoice.getItemValue("invoice.number")); invoiceStub.setItemValue("invoice.number", invoice.getItemValue("invoice.number"));
@ -178,19 +178,18 @@ public class MahnlaufExecuteAdapter implements SignalAdapter {
break; break;
} }
return mahnLaufWorkitem; return mahnLaufWorkitem;
} }
/** /**
* Returns true if the reminder date is today or in the past * Returns true if the reminder date is today or in the past
*
* @param uniqueid * @param uniqueid
* @return * @return
*/ */
public boolean isInDue(ItemCollection invoice) { public boolean isInDue(ItemCollection invoice) {
LocalDate date = invoice.getItemValueLocalDate("invoice.reminder"); LocalDate date = invoice.getItemValueLocalDate("invoice.reminder");
return date.compareTo(LocalDate.now())<=0; return date.compareTo(LocalDate.now()) <= 0;
} }
} }