From cf9bfd952b5550c02140f062c8dc8d9e394eea3d Mon Sep 17 00:00:00 2001 From: Ralph Soika Date: Thu, 14 Jan 2021 16:47:06 +0100 Subject: [PATCH] update --- .../com/alexanderlogistics/InvoicePlugin.java | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/InvoicePlugin.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/InvoicePlugin.java index 59ac5e1..8f59abe 100644 --- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/InvoicePlugin.java +++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/InvoicePlugin.java @@ -13,8 +13,8 @@ import org.imixs.workflow.exceptions.PluginException; * Das InvoicePlugin prüft die Eingaben auf gültigkeit, so dass diese problemlos * nach Cargosoft expoertier werden können. *

- * Konkret geht es darum, das in den ChildItems keine leeren Zeilen vorkommen - * dürfen. + * Konkret geht es darum, das im Status 5200 in den ChildItems keine leeren + * Zeilen vorkommen dürfen. * * @author rsoika * @version 1.0 @@ -30,28 +30,32 @@ public class InvoicePlugin extends AbstractPlugin { /** * Test childworkitems for empty lines * - * @throws PluginException - if txtCooperateSpace not filled. + * @throws PluginException - if data is missing * **/ @Override public ItemCollection run(ItemCollection workitem, ItemCollection documentActivity) throws PluginException { - List childs = explodeChildList(workitem); - for (ItemCollection posItem : childs) { - if (posItem.getItemValueString("name").trim().isEmpty()) { - // throw a plugin exception - because name is missing! - throw new PluginException(InvoicePlugin.class.getName(), ERROR_MISSING_DATA, - "Eingabefehler - Die Positionsnummer in Zeile " + posItem.getItemValueString("numpos") - + " muss aufgefüllt sein!"); - } + // die prüfung der positionsnummern erfolgt nur im Status 5200 ! + if (workitem.getTaskID() == 5200) { + List childs = explodeChildList(workitem); + for (ItemCollection posItem : childs) { + if (posItem.getItemValueString("name").trim().isEmpty()) { + // throw a plugin exception - because name is missing! + throw new PluginException(InvoicePlugin.class.getName(), ERROR_MISSING_DATA, + "Eingabefehler - Die Positionsnummer in Zeile " + posItem.getItemValueString("numpos") + + " muss aufgefüllt sein!"); + } - if (posItem.getItemValueFloat("amount") == 0) { - // throw a plugin exception - because name is missing! - throw new PluginException(InvoicePlugin.class.getName(), ERROR_MISSING_DATA, - "Eingabefehler - Der Nettobetrag in in Zeile " + posItem.getItemValueString("numpos") - + " darf nicht 0 sein!"); + if (posItem.getItemValueFloat("amount") == 0) { + // throw a plugin exception - because name is missing! + throw new PluginException(InvoicePlugin.class.getName(), ERROR_MISSING_DATA, + "Eingabefehler - Der Nettobetrag in in Zeile " + posItem.getItemValueString("numpos") + + " darf nicht 0 sein!"); + } } } + return workitem; }