fixed validierung

This commit is contained in:
Ralph Soika 2021-02-08 12:37:10 +01:00
parent 14f75ad67b
commit 8083db6b31
3 changed files with 3042 additions and 16 deletions

View file

@ -21,9 +21,13 @@ import org.imixs.workflow.exceptions.PluginException;
*
*/
public class InvoicePlugin extends AbstractPlugin {
public static final int TASK_SACHPRUEFUNG = 5200;
public static final int EVENT_FREIGEBEN = 20;
public static final String CHILD_ITEM_PROPERTY = "_ChildItems";
public static final String ERROR_MISSING_DATA = "MISSING_DATA";
// XX-YYY-####-###
public static final String REGEX_POSNUMER = "([A-Z]{2}-[A-Z]{3}-[0-9]{4}-[0-9]{3})";
@ -39,8 +43,9 @@ public class InvoicePlugin extends AbstractPlugin {
@Override
public ItemCollection run(ItemCollection workitem, ItemCollection documentActivity) throws PluginException {
// die prüfung der positionsnummern und Category erfolgt nur im Status 5200 !
if (workitem.getTaskID() == 5200) {
// 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.getEventID() == EVENT_FREIGEBEN) {
List<ItemCollection> childs = explodeChildList(workitem);
for (ItemCollection posItem : childs) {
if (posItem.getItemValueString("name").trim().isEmpty()) {
@ -49,23 +54,22 @@ public class InvoicePlugin extends AbstractPlugin {
"Eingabefehler - Die Positionsnummer in Zeile " + posItem.getItemValueString("numpos")
+ " muss aufgefüllt sein!");
}
// validate pos for regex pattern 'XX-YYY-####-###'
if (! posItem.getItemValueString("name").matches(REGEX_POSNUMER)) {
// throw a plugin exception - because name is missing!
if (!posItem.getItemValueString("name").matches(REGEX_POSNUMER)) {
// 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 im Format 'XX-YYY-####-###' eingeben werden!");
}
if (posItem.getItemValueString("category").trim().isEmpty()) {
// throw a plugin exception - because name is missing!
throw new PluginException(InvoicePlugin.class.getName(), ERROR_MISSING_DATA,
"Eingabefehler - Die Leistungsart in Zeile " + posItem.getItemValueString("numpos")
+ " muss aufgefüllt sein!");
}
if (posItem.getItemValueString("tax").trim().isEmpty()) {
// throw a plugin exception - because name is missing!
throw new PluginException(InvoicePlugin.class.getName(), ERROR_MISSING_DATA,

View file

@ -1058,12 +1058,12 @@ Betrag: <itemvalue>_amount</itemvalue> (Brutto € <itemvalue>_amount_brutto</it
<bpmn2:sequenceFlow id="SequenceFlow_16" name="Nein" sourceRef="ExclusiveGateway_4" targetRef="ExclusiveGateway_6">
<bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" id="FormalExpression_4">!workitem['space.team'] || workitem['space.team'][0]==&quot;&quot;</bpmn2:conditionExpression>
</bpmn2:sequenceFlow>
<bpmn2:exclusiveGateway id="ExclusiveGateway_3" name="Process Manager" gatewayDirection="Diverging">
<bpmn2:exclusiveGateway id="ExclusiveGateway_3" name="Payment Type" gatewayDirection="Diverging">
<bpmn2:incoming>SequenceFlow_18</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
<bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing>
</bpmn2:exclusiveGateway>
<bpmn2:sequenceFlow id="SequenceFlow_1" name="Ja" sourceRef="ExclusiveGateway_3" targetRef="Task_5000">
<bpmn2:sequenceFlow id="SequenceFlow_1" name="SEPA Lauf" sourceRef="ExclusiveGateway_3" targetRef="Task_5000">
<bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" id="FormalExpression_6">workitem['payment.type'] &amp;&amp; workitem['payment.type'][0]!=&quot;direct_debit&quot;</bpmn2:conditionExpression>
</bpmn2:sequenceFlow>
<bpmn2:exclusiveGateway id="ExclusiveGateway_5" gatewayDirection="Converging">
@ -1071,7 +1071,7 @@ Betrag: <itemvalue>_amount</itemvalue> (Brutto € <itemvalue>_amount_brutto</it
<bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
</bpmn2:exclusiveGateway>
<bpmn2:sequenceFlow id="SequenceFlow_5" name="Nein" sourceRef="ExclusiveGateway_3" targetRef="ExclusiveGateway_5">
<bpmn2:sequenceFlow id="SequenceFlow_5" name="Lastschrift" sourceRef="ExclusiveGateway_3" targetRef="ExclusiveGateway_5">
<bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" id="FormalExpression_5">workitem['payment.type'] &amp;&amp; workitem['payment.type'][0]==&quot;direct_debit&quot;</bpmn2:conditionExpression>
</bpmn2:sequenceFlow>
<bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_2" imixs:activityid="100" name="[forward]">
@ -2236,7 +2236,7 @@ result.isValid=true;
<bpmn2:sequenceFlow id="SequenceFlow_49" sourceRef="EventBasedGateway_1" targetRef="IntermediateCatchEvent_19"/>
<bpmn2:association id="Association_2" sourceRef="DataObject_2" targetRef="Task_2"/>
<bpmn2:textAnnotation id="TextAnnotation_2">
<bpmn2:text>Wurde ein Prozess Manager festgelegt, erfolgt eine Genehmigung.</bpmn2:text>
<bpmn2:text>Es handelt sich um einen SEPA Lauf. Die Rechnung muss explizit freigegeben werden.</bpmn2:text>
</bpmn2:textAnnotation>
<bpmn2:association id="Association_3" sourceRef="TextAnnotation_2" targetRef="Task_5000"/>
<bpmn2:textAnnotation id="TextAnnotation_3">
@ -2425,7 +2425,7 @@ und invoice.total >0 (keine Gutschriften)</bpmn2:text>
<bpmndi:BPMNShape id="BPMNShape_ExclusiveGateway_3" bpmnElement="ExclusiveGateway_3" isMarkerVisible="true">
<dc:Bounds height="50.0" width="50.0" x="828.0" y="683.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_7" labelStyle="BPMNLabelStyle_1">
<dc:Bounds height="28.0" width="50.0" x="828.0" y="733.0"/>
<dc:Bounds height="14.0" width="77.0" x="815.0" y="733.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_ExclusiveGateway_5" bpmnElement="ExclusiveGateway_5" isMarkerVisible="true">
@ -2760,7 +2760,7 @@ und invoice.total >0 (keine Gutschriften)</bpmn2:text>
<di:waypoint xsi:type="dc:Point" x="853.0" y="816.0"/>
<di:waypoint xsi:type="dc:Point" x="853.0" y="900.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_22">
<dc:Bounds height="14.0" width="13.0" x="847.0" y="818.0"/>
<dc:Bounds height="14.0" width="57.0" x="825.0" y="818.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_5" sourceElement="BPMNShape_ExclusiveGateway_3" targetElement="BPMNShape_ExclusiveGateway_5">
@ -2768,7 +2768,7 @@ und invoice.total >0 (keine Gutschriften)</bpmn2:text>
<di:waypoint xsi:type="dc:Point" x="959.0" y="708.0"/>
<di:waypoint xsi:type="dc:Point" x="1040.0" y="708.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_27">
<dc:Bounds height="14.0" width="26.0" x="947.0" y="709.0"/>
<dc:Bounds height="14.0" width="55.0" x="932.0" y="709.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_6" sourceElement="BPMNShape_ExclusiveGateway_6" targetElement="BPMNShape_IntermediateCatchEvent_4">

File diff suppressed because it is too large Load diff