Skip to content
Snippets Groups Projects
Commit 38c1367e authored by Johannes Goderbauer's avatar Johannes Goderbauer
Browse files

only set ORGANISATION_ID to private-dummy-organisation on save

parent 5a57c55f
No related branches found
No related tags found
No related merge requests found
Showing with 33 additions and 81 deletions
......@@ -4,6 +4,7 @@
<title>Contact</title>
<majorModelMode>DISTRIBUTED</majorModelMode>
<documentation>%aditoprj%/entity/Contact_entity/documentation.adoc</documentation>
<onValidation>%aditoprj%/entity/Contact_entity/onValidation.js</onValidation>
<iconId>VAADIN:USERS</iconId>
<recordContainer>db</recordContainer>
<entityFields>
......@@ -26,7 +27,6 @@
<title>Company</title>
<consumer>Organisations</consumer>
<mandatory v="false" />
<valueProcess>%aditoprj%/entity/Contact_entity/entityfields/organisation_id/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/Contact_entity/entityfields/organisation_id/displayValueProcess.js</displayValueProcess>
<onValidation>%aditoprj%/entity/Contact_entity/entityfields/organisation_id/onValidation.js</onValidation>
<onValueChange>%aditoprj%/entity/Contact_entity/entityfields/organisation_id/onValueChange.js</onValueChange>
......
......@@ -5,21 +5,26 @@ import("system.vars");
import("Entity_lib");
import("Sql_lib");
var personId = vars.get("$field.PERSON_ID");
var personId = vars.getString("$field.PERSON_ID");
var organisationId = ProcessHandlingUtils.getOnValidationValue("$field.ORGANISATION_ID");
//workaround for organisationId: $local.value will return the name of the organisation which is not what we want
//but the field already contains the changed value; so let's load the field instead of the $local.value-variable
//this is a bug within the ADITO-kernel
//TODO: change the workaround behaviour when $local.value is retrieved correct
organisationId = vars.get("$field.ORGANISATION_ID")
organisationId = vars.getString("$field.ORGANISATION_ID")
if (personId && organisationId)
if (personId)
{
if (organisationId == "")
organisationId = "0";
var alreadyExistantContactId = db.cell(SqlCondition.begin()
.andPrepare("CONTACT.PERSON_ID", personId)
.andPrepare("CONTACT.ORGANISATION_ID", organisationId)
.buildSql("select CONTACT.CONTACTID from CONTACT"));
if (alreadyExistantContactId != "")
result.string(translate.text("This combination of person and organisation does already exist and can not be created once more."));
if (organisationId.trim() == "0")
result.string(translate.text("This private person doeas already exist and can not be created once more."));
else
result.string(translate.text("This combination of person and organisation does already exist and can not be created once more."));
}
\ No newline at end of file
import("system.vars");
import("system.neon");
//since the standard address can be only values of org the standard address has to be reset on org change
vars.set("$field.ADDRESS_ID", "");
if(vars.exists("$local.value") && !vars.get("$local.value"))
{
neon.setFieldValue("$field.ORGANISATION_ID", "0");
}
vars.set("$field.ADDRESS_ID", "");
\ No newline at end of file
import("system.result");
import("system.vars");
import("system.neon");
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.getString("$field.ORGANISATION_ID") == "")
{
result.string("0");
}
\ No newline at end of file
import("system.neon");
import("system.vars");
import("system.neon");
if(vars.exists("$local.value") && !vars.get("$local.value"))
//TODO: workaround till there exists somtehing that can be done "beforeSave"; a validation of the whole entity is done before saving so let's use this process at the moment
if(!vars.get("$field.ORGANISATION_ID"))
{
neon.setFieldValue("$field.ORGANISATION_ID", "0");
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@
<description>former Pers</description>
<majorModelMode>DISTRIBUTED</majorModelMode>
<documentation>%aditoprj%/entity/Person_entity/documentation.adoc</documentation>
<onValidation>%aditoprj%/entity/Person_entity/onValidation.js</onValidation>
<iconId>VAADIN:USERS</iconId>
<imageProcess>%aditoprj%/entity/Person_entity/imageProcess.js</imageProcess>
<titleProcess>%aditoprj%/entity/Person_entity/titleProcess.js</titleProcess>
......@@ -156,7 +157,6 @@
<searchable v="true" />
<valueProcess>%aditoprj%/entity/Person_entity/entityfields/organisation_id/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/Person_entity/entityfields/organisation_id/displayValueProcess.js</displayValueProcess>
<onValueChange>%aditoprj%/entity/Person_entity/entityfields/organisation_id/onValueChange.js</onValueChange>
</entityField>
<entityConsumer>
<name>PersAddresses</name>
......
......@@ -8,8 +8,4 @@ if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.
{
result.string(vars.get("$param.OrgId_param"));
}
else if(!vars.get("$field.ORGANISATION_ID"))
{
result.string("0")
}
}
\ No newline at end of file
import("system.vars");
if (!vars.get("$field.ORGANISATION_ID"))
vars.set("$field.ORGANISATION_ID", "0");
\ No newline at end of file
......@@ -1020,9 +1020,6 @@
<entry>
<key>Seite</key>
</entry>
<entry>
<key>Note</key>
</entry>
<entry>
<key>Senden per E-Mail</key>
</entry>
......@@ -2646,9 +2643,6 @@
<entry>
<key>${MIN_MAX_ERROR} field: %0, value: %1, min: %2, max: %3</key>
</entry>
<entry>
<key>The title already exists!</key>
</entry>
<entry>
<key>Password</key>
</entry>
......@@ -2661,15 +2655,6 @@
<entry>
<key>Email</key>
</entry>
<entry>
<key>Test</key>
</entry>
<entry>
<key>testV</key>
</entry>
<entry>
<key>test</key>
</entry>
<entry>
<key>{$OBJECTLINK_TYPE}</key>
</entry>
......@@ -2682,9 +2667,6 @@
<entry>
<key>Password and confirmation must be the same!</key>
</entry>
<entry>
<key>Login</key>
</entry>
<entry>
<key>Begin</key>
</entry>
......@@ -2703,6 +2685,9 @@
<entry>
<key>Username already exists!</key>
</entry>
<entry>
<key>This private person doeas already exist and can not be created once more.</key>
</entry>
</keyValueMap>
<font name="Dialog" style="0" size="11" />
<sqlModels>
......
......@@ -142,10 +142,6 @@
<key>Medium</key>
<value>Medium</value>
</entry>
<entry>
<key>The title already exists!</key>
<value>Der Titel existiert bereits!</value>
</entry>
<entry>
<key>Internet</key>
<value>Internet</value>
......@@ -1497,10 +1493,6 @@
<entry>
<key>Seite</key>
</entry>
<entry>
<key>Note</key>
<value>Notiz</value>
</entry>
<entry>
<key>Senden per E-Mail</key>
</entry>
......@@ -3446,15 +3438,6 @@
<key>Email</key>
<value>E-Mail</value>
</entry>
<entry>
<key>Test</key>
</entry>
<entry>
<key>testV</key>
</entry>
<entry>
<key>test</key>
</entry>
<entry>
<key>{$OBJECTLINK_TYPE}</key>
<value>Art</value>
......@@ -3467,9 +3450,6 @@
<key>Password and confirmation must be the same!</key>
<value>Die Passwörter stimmen nicht überein!</value>
</entry>
<entry>
<key>Login</key>
</entry>
<entry>
<key>Begin</key>
<value>Beginn</value>
......@@ -3478,6 +3458,10 @@
<key>Maturity</key>
<value>Fällig</value>
</entry>
<entry>
<key>This private person doeas already exist and can not be created once more.</key>
<value>Diese Privatperson existiert bereits und kann daher nicht noch ein mal angelegt werden.</value>
</entry>
</keyValueMap>
<font name="Dialog" style="0" size="11" />
</language>
......@@ -1038,9 +1038,6 @@
<entry>
<key>Seite</key>
</entry>
<entry>
<key>Note</key>
</entry>
<entry>
<key>Senden per E-Mail</key>
</entry>
......@@ -2674,9 +2671,6 @@
<key>${MIN_MAX_ERROR} field: %0, value: %1, min: %2, max: %3</key>
<value>%0 has to be between %2 and %3.</value>
</entry>
<entry>
<key>The title already exists!</key>
</entry>
<entry>
<key>Password</key>
</entry>
......@@ -2689,15 +2683,6 @@
<entry>
<key>Email</key>
</entry>
<entry>
<key>Test</key>
</entry>
<entry>
<key>testV</key>
</entry>
<entry>
<key>test</key>
</entry>
<entry>
<key>{$OBJECTLINK_TYPE}</key>
<value>Type</value>
......@@ -2712,9 +2697,6 @@
<entry>
<key>Password and confirmation must be the same!</key>
</entry>
<entry>
<key>Login</key>
</entry>
<entry>
<key>Begin</key>
</entry>
......@@ -2733,6 +2715,9 @@
<entry>
<key>Username already exists!</key>
</entry>
<entry>
<key>This private person doeas already exist and can not be created once more.</key>
</entry>
</keyValueMap>
<font name="Dialog" style="0" size="11" />
</language>
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