50 lines
1.2 KiB
Java
50 lines
1.2 KiB
Java
package com.alexanderlogistics;
|
|
|
|
import javax.inject.Inject;
|
|
|
|
import org.imixs.workflow.ItemCollection;
|
|
import org.imixs.workflow.engine.plugins.AbstractPlugin;
|
|
import org.imixs.workflow.exceptions.PluginException;
|
|
|
|
/**
|
|
* Das InvoiceOutgoingPlugin aktualisiert die Debitor E-Mail Adresse
|
|
*
|
|
* Auch das feld _img wird in Abhängigkeit vom item 'invoice.protest' gesetzt
|
|
*
|
|
* @author rsoika
|
|
* @version 1.0
|
|
*
|
|
*/
|
|
public class InvoiceOutgoingPlugin extends AbstractPlugin {
|
|
|
|
@Inject
|
|
KreditorDebitorService kreditorService;
|
|
|
|
/**
|
|
*
|
|
* @throws PluginException - if data is missing
|
|
*
|
|
**/
|
|
@Override
|
|
public ItemCollection run(ItemCollection workitem, ItemCollection event) throws PluginException {
|
|
|
|
// Update Invoice.positions
|
|
InvoiceUtil.updateInvoicePositions(workitem);
|
|
|
|
String dbtrNumber = workitem.getItemValueString("dbtr.number");
|
|
ItemCollection debitor = kreditorService.findDebitor(dbtrNumber);
|
|
if (debitor != null) {
|
|
// update mail
|
|
workitem.setItemValue("dbtr.mail", debitor.getItemValueString("cdtr.mail"));
|
|
}
|
|
|
|
String img = "";
|
|
if (workitem.getItemValueBoolean("invoice.protest")) {
|
|
img = img + "<img title='Reklamiert' src=\"/layout/icons/icon106.png\">";
|
|
|
|
}
|
|
workitem.setItemValue("_img", img);
|
|
return workitem;
|
|
}
|
|
|
|
}
|