diff --git a/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod index 4ae9c67736e5f615e791061141b4fd1532d54153..fb04b3c8a9196fd01e846f8628d7646faa565da6 100644 --- a/aliasDefinition/Data_alias/Data_alias.aod +++ b/aliasDefinition/Data_alias/Data_alias.aod @@ -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> diff --git a/entity/Contract_entity/Contract_entity.aod b/entity/Contract_entity/Contract_entity.aod index 4678c726e364ae4a39010b44524b5b3699fc6492..24d0ce85178a4ea6630a65d0547cf71b071e4671 100644 --- a/entity/Contract_entity/Contract_entity.aod +++ b/entity/Contract_entity/Contract_entity.aod @@ -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> diff --git a/entity/Contract_entity/entityfields/contractcode/onValidation.js b/entity/Contract_entity/entityfields/contractcode/onValidation.js new file mode 100644 index 0000000000000000000000000000000000000000..5b26ae2f6e7dae262d52887628e7b09247f913f7 --- /dev/null +++ b/entity/Contract_entity/entityfields/contractcode/onValidation.js @@ -0,0 +1,11 @@ +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 diff --git a/entity/Product_entity/entityfields/productcode/onValidation.js b/entity/Product_entity/entityfields/productcode/onValidation.js index d04278044de550fbd08e060c16a18f49549ce076..5de6f5400bbaa5a1f6308a171078d3296d45d7bc 100644 --- a/entity/Product_entity/entityfields/productcode/onValidation.js +++ b/entity/Product_entity/entityfields/productcode/onValidation.js @@ -1,12 +1,11 @@ -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 diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod index b51d31b0de64ad3e7b198ae135c5ba3f40b08c23..85d20120736b91a257c334746d86e346629f15a5 100644 --- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod +++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod @@ -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> diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index 1e584c40ab02e20a4eff1d5e116e555f261a9448..bc03fe3d3286cee471e2507af28e1cb27808eecd 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -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> diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod index 4c60221d567bd302be3a1afb36643c31f15f5e39..23910819b7db0dd862c99b52ddf2abd4e359c637 100644 --- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod +++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod @@ -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> diff --git a/others/db_changes/masterChangelog.xml b/others/db_changes/masterChangelog.xml index 20602decea6f75ebb66d4af9b47d3ee0272275ad..ee76531830eadd8c20d9b6e685bc4fa4e5d4927c 100644 --- a/others/db_changes/masterChangelog.xml +++ b/others/db_changes/masterChangelog.xml @@ -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"/> diff --git a/others/db_changes/struct/contractChanges.xml b/others/db_changes/struct/contractChanges.xml new file mode 100644 index 0000000000000000000000000000000000000000..f7f2e2c301f1d2493348bd0943e6bf98687ffcd3 --- /dev/null +++ b/others/db_changes/struct/contractChanges.xml @@ -0,0 +1,7 @@ +<?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 diff --git a/others/db_changes/struct/productChanges.xml b/others/db_changes/struct/productChanges.xml new file mode 100644 index 0000000000000000000000000000000000000000..1c5f418ec6809f83845b156ee337ae878e2e26c0 --- /dev/null +++ b/others/db_changes/struct/productChanges.xml @@ -0,0 +1,9 @@ +<?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