Skip to content
Snippets Groups Projects
Commit d134569b authored by Maximilian Schröger's avatar Maximilian Schröger
Browse files

Vertragsnummer und Produktnummer müssen eindeutig sein (DB-Constraint + Validierung in Fields)

parent 8795c239
No related branches found
No related tags found
No related merge requests found
......@@ -1280,7 +1280,7 @@
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<index v="true" />
<title></title>
<description></description>
</entityFieldDb>
......@@ -1481,7 +1481,7 @@
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<index v="true" />
<title></title>
<description></description>
</entityFieldDb>
......
......@@ -13,6 +13,7 @@
<tableName>CONTRACT</tableName>
<columnName>CONTRACTCODE</columnName>
<caption>Contract number</caption>
<onValidation>%aditoprj%/entity/Contract_entity/entityfields/contractcode/onValidation.js</onValidation>
</entityField>
<entityField>
<name>CONTRACTDUE</name>
......
import("system.translate");
import("system.result");
import("system.vars");
import("system.db");
var codeCount = db.cell("select count(CONTRACTCODE) from CONTRACT where CONTRACTCODE = '" + vars.get("$local.value") + "'"
+ " and CONTRACTID <> '" + vars.get("$field.CONTRACTID") + "'");
if(codeCount > 0)
{
result.string(translate.text("The contract number already exists!"));
}
\ No newline at end of file
import("system.db");
import("system.vars");
import("system.swing");
import("system.result");
import("system.translate");
import("system.result");
import("system.vars");
import("system.db");
//Productcode has to be unique
if(db.cell("select count(PRODUCTID) from PRODUCT where PRODUCTCODE = '" + vars.get("$local.value")
+ "' and PRODUCTID != '" + vars.get("$field.PRODUCTID") + "'") != 0)
var codeCount = db.cell("select count(PRODUCTCODE) from PRODUCT where PRODUCTCODE = '" + vars.get("$local.value") + "'"
+ " and PRODUCTID <> '" + vars.get("$field.PRODUCTID") + "'");
if(codeCount > 0)
{
result.string( translate.text("The product number exists already!") );
result.string(translate.text("The product number already exists!"));
}
\ No newline at end of file
......@@ -378,9 +378,6 @@
<entry>
<key>Contract number</key>
</entry>
<entry>
<key>The product number exists already!</key>
</entry>
<entry>
<key>Min. stock</key>
</entry>
......@@ -531,6 +528,12 @@
<entry>
<key>Reference</key>
</entry>
<entry>
<key>The contract number already exists!</key>
</entry>
<entry>
<key>The product number already exists!</key>
</entry>
</keyValueMap>
<font name="Dialog" style="0" size="11" />
<sqlModels>
......
......@@ -495,10 +495,6 @@
<key>Contract number</key>
<value>Vertragsnummer</value>
</entry>
<entry>
<key>The product number exists already!</key>
<value>Die Produktnummer exisitiert bereits!</value>
</entry>
<entry>
<key>Min. stock</key>
<value>Min.-Bestand</value>
......@@ -698,6 +694,14 @@
<key>Reference</key>
<value>Referenz</value>
</entry>
<entry>
<key>The contract number already exists!</key>
<value>Die Vertragsnummer existiert bereits!</value>
</entry>
<entry>
<key>The product number already exists!</key>
<value>Die Produktnummer existiert bereits!</value>
</entry>
</keyValueMap>
<font name="Dialog" style="0" size="11" />
</language>
......@@ -384,9 +384,6 @@
<entry>
<key>Contract number</key>
</entry>
<entry>
<key>The product number exists already!</key>
</entry>
<entry>
<key>Min. stock</key>
</entry>
......@@ -539,6 +536,12 @@
<entry>
<key>Reference</key>
</entry>
<entry>
<key>The contract number already exists!</key>
</entry>
<entry>
<key>The product number already exists!</key>
</entry>
</keyValueMap>
<font name="Dialog" style="0" size="11" />
</language>
......@@ -13,6 +13,8 @@
<include file="struct/create_prod2prod.xml"/>
<include file="struct/create_productprice.xml"/>
<include file="struct/create_stock.xml"/>
<include file="struct/contractChanges.xml"/>
<include file="struct/productChanges.xml"/>
<include file="misc/1535533490181_persChanges.xml"/>
<include file="struct/1535612802325_addressChange.xml"/>
<include file="data/example_org/ORG_privat.xml"/>
......
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<changeSet author="m.schroeger" id="eae40a20-2a4a-4a96-99f6-b66fb9f5e6c9">
<addUniqueConstraint tableName="CONTRACT" columnNames="CONTRACTCODE" constraintName="unique_CONTRACT_CONTRACTCODE"/>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<changeSet author="m.schroeger" id="9d7715ea-da67-4579-b591-ab4cd871e320">
<addUniqueConstraint tableName="PRODUCT" columnNames="PRODUCTCODE" constraintName="unique_PRODUCT_PRODUCTCODE"/>
<rollback>
<dropUniqueConstraint tableName="PRODUCT" constraintName="unique_PRODUCT_PRODUCTCODE"/>
</rollback>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment