package com.alexanderlogistics; import org.imixs.workflow.ItemCollection; import org.imixs.workflow.engine.plugins.AbstractPlugin; import org.imixs.workflow.exceptions.PluginException; import jakarta.inject.Inject; /** * 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 and country workitem.setItemValue("dbtr.mail", debitor.getItemValueString("cdtr.mail")); workitem.setItemValue("invoice.country", debitor.getItemValueString("_vendor_country")); } String img = ""; if (workitem.getItemValueBoolean("invoice.protest")) { img = img + ""; } workitem.setItemValue("_img", img); return workitem; } }