validierung positionsumer
This commit is contained in:
parent
4648c27f0c
commit
edc1be0d25
6 changed files with 65 additions and 3 deletions
|
|
@ -23,6 +23,9 @@ import org.imixs.workflow.exceptions.PluginException;
|
|||
public class InvoicePlugin extends AbstractPlugin {
|
||||
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})";
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static Logger logger = Logger.getLogger(InvoicePlugin.class.getName());
|
||||
|
|
@ -47,6 +50,15 @@ public class InvoicePlugin extends AbstractPlugin {
|
|||
+ " 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!
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
package com.alexanderlogistics;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
/**
|
||||
* This test generates random test data
|
||||
*
|
||||
* @author rsoika
|
||||
*
|
||||
*/
|
||||
public class TestPostionsnummernRegex {
|
||||
|
||||
/**
|
||||
* Test positionnummern 'XX-YYY-####-###'
|
||||
*/
|
||||
@Test
|
||||
public void testPutFileToFTP() {
|
||||
|
||||
Assert.assertTrue("AA-BBC-1234-991".matches(InvoicePlugin.REGEX_POSNUMER));
|
||||
Assert.assertFalse("aa-BBC-1234-991".matches(InvoicePlugin.REGEX_POSNUMER));
|
||||
Assert.assertFalse("CC-BBC-1234-991 ".matches(InvoicePlugin.REGEX_POSNUMER));
|
||||
|
||||
Assert.assertTrue("IM-ZEL-2101-005".matches(InvoicePlugin.REGEX_POSNUMER));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -69,7 +69,7 @@
|
|||
<Code Type="cs"><xsl:value-of select="$currency" /></Code>
|
||||
</Codes>
|
||||
</Currency>
|
||||
<Value><xsl:value-of select="item[@name='order.total.net']/value" /></Value>
|
||||
<Value><xsl:value-of select="item[@name='order.total.netto']/value" /></Value>
|
||||
<ExchangeRate><xsl:value-of select="item[@name='invoice.exchangerate']/value" /></ExchangeRate>
|
||||
</Amount>
|
||||
</NetAmount>
|
||||
|
|
|
|||
|
|
@ -34,10 +34,21 @@
|
|||
<Code Type="cs">EUR</Code>
|
||||
</Codes>
|
||||
</Currency>
|
||||
<Value>1035.70</Value>
|
||||
<Value>84.03</Value>
|
||||
<ExchangeRate>1.00345</ExchangeRate>
|
||||
</Amount>
|
||||
</NetAmount>
|
||||
<VATAmount>
|
||||
<Amount>
|
||||
<Currency>
|
||||
<Codes>
|
||||
<Code Type="cs">EUR</Code>
|
||||
</Codes>
|
||||
</Currency>
|
||||
<Value>15.97</Value>
|
||||
<ExchangeRate>1.00345</ExchangeRate>
|
||||
</Amount>
|
||||
</VATAmount>
|
||||
<VATInformation>
|
||||
<VATAmount>
|
||||
<Amount isDomesticCurrency="true">
|
||||
|
|
|
|||
|
|
@ -218,6 +218,16 @@
|
|||
<item name="invoice.total">
|
||||
<value xsi:type="xs:decimal">1035.70</value>
|
||||
</item>
|
||||
<item name="order.total.netto">
|
||||
<value xsi:type="xs:decimal">84.03</value>
|
||||
</item>
|
||||
<item name="invoice.total">
|
||||
<value xsi:type="xs:decimal">100.00</value>
|
||||
</item>
|
||||
<item name="order.total.tax">
|
||||
<value xsi:type="xs:decimal">15.97</value>
|
||||
</item>
|
||||
|
||||
<item name="invoice.exchangerate">
|
||||
<value xsi:type="xs:decimal">1.00345</value>
|
||||
</item>
|
||||
|
|
|
|||
Loading…
Reference in a new issue