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 aff2c4c..0cb5cf5 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 @@ -66,6 +66,7 @@ public class InvoicePlugin extends AbstractPlugin { } boolean isPublicEvent = !("0".equals(event.getItemValueString("keypublicresult"))); + boolean isCargoRechnung = ("Rechnungseingang".equals(workitem.getWorkflowGroup())); // Payment.type muss immer eingetragne werden! if (isPublicEvent && workitem.getTaskID() >= TASK_ERFASSUNG && workitem.getEventID() < 900) { @@ -79,23 +80,25 @@ public class InvoicePlugin extends AbstractPlugin { validateInvoiceNumber(workitem); } - if (workitem.getTaskID() == TASK_ERFASSUNG || - ( ( workitem.getTaskID() == TASK_SACHPRUEFUNG || workitem.getTaskID() == TASK_SACHPRUEFUNG_DELEGATION) - && workitem.getEventID() == EVENT_FREIGEBEN) - ) { + if (workitem.getTaskID() == TASK_ERFASSUNG || ((workitem.getTaskID() == TASK_SACHPRUEFUNG + || workitem.getTaskID() == TASK_SACHPRUEFUNG_DELEGATION) + && workitem.getEventID() == EVENT_FREIGEBEN)) { // Buchungsperiode auf plausi prüfen - if ("workitem".equals(workitem.getType())) { + if (isCargoRechnung && "workitem".equals(workitem.getType())) { validateBuchungsperiode(workitem.getItemValueString(ITEM_INVOICE_PERIOD)); } // Cargosoft Kreditorennnummer prüfen - validateCargosoftCdtrNumber(workitem); + if (isCargoRechnung) { + validateCargosoftCdtrNumber(workitem); + } } } // die prüfung der positionsnummern und Category erfolgt nur im Status // Sachprüfung (5200) und nur beim Freigeben (20)! - if ( (workitem.getTaskID() == TASK_SACHPRUEFUNG || workitem.getTaskID() == TASK_SACHPRUEFUNG_DELEGATION) - && workitem.getEventID() == EVENT_FREIGEBEN) { + if (isCargoRechnung + && ((workitem.getTaskID() == TASK_SACHPRUEFUNG || workitem.getTaskID() == TASK_SACHPRUEFUNG_DELEGATION) + && workitem.getEventID() == EVENT_FREIGEBEN)) { List childs = explodeChildList(workitem); for (ItemCollection posItem : childs) { if (posItem.getItemValueString("name").trim().isEmpty()) { @@ -148,7 +151,7 @@ public class InvoicePlugin extends AbstractPlugin { // Im folgenden überprüfen wir ob eine Buchungszeile vorkommt in der keine oder // die Hauptbuchunsperiode ausgewählt wurde. Ist das nicht der Fal gibt es eine // Fehlermeldung für den Anwendere - if (childs.size() > 0) { + if (isCargoRechnung && childs.size() > 0) { String hauptBuchungsperiode = workitem.getItemValueString("invoice.period"); boolean buchungsperiodenValid = false; for (ItemCollection posItem : childs) { @@ -273,7 +276,7 @@ public class InvoicePlugin extends AbstractPlugin { // search creditor number in cargosoft... // die cargosoft Kreditornummer beginnt seltsamerweise mit einem K..... try { - String query = "(type:cargosoftkreditor) AND (name:K" + crdtrNumber + " OR name:" + crdtrNumber +")"; + String query = "(type:cargosoftkreditor) AND (name:K" + crdtrNumber + " OR name:" + crdtrNumber + ")"; List result = this.getWorkflowService().getDocumentService().find(query, 1, 0); if (result == null || result.size() == 0) { throw new PluginException(InvoicePlugin.class.getName(), ERROR_MISSING_DATA,