diff --git a/entity/Address_entity/recordcontainers/db/onDBInsert.js b/entity/Address_entity/recordcontainers/db/onDBInsert.js index 199ad53da66642101b7ce8a6a5bfe6397f72fb4d..bc66933dac2bbe757bf545283d13fa4ef9f373f3 100644 --- a/entity/Address_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Address_entity/recordcontainers/db/onDBInsert.js @@ -1,3 +1,4 @@ +import("Sql_lib"); import("system.logging"); import("KeywordRegistry_basic"); import("DataPrivacy_lib"); @@ -7,7 +8,7 @@ import("Keyword_lib"); var rowdata = vars.get("$local.rowdata"); var addrType = rowdata["ADDRESS.ADDR_TYPE"]; - +var id = rowdata["ADDRESS.CONTACT_ID"]; var typeParam = vars.get("$param.ContactType_param"); if (!typeParam && vars.exists("$param.PersonContactId_param") && vars.getString("$param.PersonContactId_param")) @@ -22,7 +23,27 @@ if (typeParam === "contact") else if (typeParam === "organisation") scopeType = "Organisation" -new StandardObject("Address", vars.get("$local.uid"), scopeType, rowdata["ADDRESS.CONTACT_ID"]) - .onObjectInsert(vars.exists("$param.ReplaceStandardAddress_param") ? vars.get("$param.ReplaceStandardAddress_param") : undefined) +new StandardObject("Address", vars.get("$local.uid"), scopeType, id) + .onObjectInsert(vars.exists("$param.ReplaceStandardAddress_param") ? vars.get("$param.ReplaceStandardAddress_param") : undefined); + +//adds the orgaddress as standard address to all the contact's that were created before the org had an address +if(scopeType == "Organisation") +{ + var contacts = newSelect("CONTACTID") + .from("CONTACT") + .where("CONTACT.ORGANISATION_ID", newSelect("CONTACT.ORGANISATION_ID") + .from("CONTACT") + .where("CONTACT.CONTACTID", id) + .cell()) + .and("CONTACT.PERSON_ID is not null") + .arrayColumn(); + + if(contacts.length > 0) + for (var i = 0; i < contacts.length; i++) + { + new StandardObject("Address", vars.get("$local.uid"), "Person", contacts[i]) + .onObjectInsert(vars.exists("$param.ReplaceStandardAddress_param") ? vars.get("$param.ReplaceStandardAddress_param") : undefined); + } +} DataPrivacyUtils.notifyNeedDataPrivacyUpdate(rowdata["ADDRESS.CONTACT_ID"], vars.get("$param.ShowDsgvoMessage_param")); diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod index ee00b16f3d6133e3ef370e383e87e3abef6b16fb..432892893ed595fb844e03f4dbc8b9a0dde681c0 100644 --- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod +++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod @@ -6782,6 +6782,9 @@ <entry> <key>data</key> </entry> + <entry> + <key>${SQL_LIB_FIELD_WRONG_FORMAT}</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 7dd5d2d36f49bffcd5aea44659df52f988a76f78..3c6f8c82f5df6f048e0bca5d8897cc2d783bd0fd 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -305,7 +305,7 @@ </entry> <entry> <key>${SQL_LIB_FIELD_WRONG_FORMAT} field: %0</key> - <value>Das Feld %0 hat ein falsches Format. Das Datenbankfeld muss wie "tablename.columnname" ("ORGANISATION.NAME") oder als Array mit Column-alias formatiert sein: ["ORGANISATION", "NAME", "myorgAlias"]</value> + <value>" ("%0") hat ein falsches Format. Das Datenbankfeld muss wie "tablename.columnname" ("ORGANISATION.NAME") oder als Array mit Column-alias formatiert sein: ["ORGANISATION", "NAME", "myorgAlias"]</value> </entry> <entry> <key>Attribute \"%0\" can't be used more than %1.</key> @@ -7770,6 +7770,7 @@ Bitte Datumseingabe prüfen</value> </entry> <entry> <key>Quick Entry</key> + <value>Schnelleingabe</value> </entry> <entry> <key>Additional Contacts</key> @@ -8667,6 +8668,10 @@ Bitte Datumseingabe prüfen</value> <key>set New</key> <value>Neu setzen</value> </entry> + <entry> + <key>${SQL_LIB_FIELD_WRONG_FORMAT}</key> + <value>Das Feld "</value> + </entry> <entry> <key>Product Group</key> <value>Produktgruppe</value> diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod index 06a6494ca0a53643c3a58a6b8e3abbfd68f8dd2c..c9f3d6218ca9737e04f033689869d23b2fd5b8cc 100644 --- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod +++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod @@ -3397,7 +3397,7 @@ </entry> <entry> <key>${SQL_LIB_FIELD_WRONG_FORMAT} field: %0</key> - <value>Field %0 is in an incorrect format. The database field has to be like "tablename.columnname" ("ORGANISATION.NAME") or as array with column-alias: ["ORGANISATION", "NAME", "myorgAlias"]</value> + <value> "%0" is in an incorrect format. The database field has to be like "tablename.columnname" ("ORGANISATION.NAME") or as array with column-alias: ["ORGANISATION", "NAME", "myorgAlias"]</value> </entry> <entry> <key>New Support ticket</key> @@ -6826,6 +6826,10 @@ <entry> <key>set New</key> </entry> + <entry> + <key>${SQL_LIB_FIELD_WRONG_FORMAT}</key> + <value>The Field</value> + </entry> <entry> <key>Product Group</key> </entry> diff --git a/process/Sql_lib/process.js b/process/Sql_lib/process.js index 6f66eddba14a1eb66543e240cb9292a85e696295..236c602ce076fd048866492e633ddf4c5871878b 100644 --- a/process/Sql_lib/process.js +++ b/process/Sql_lib/process.js @@ -535,7 +535,7 @@ SqlCondition.prototype._prepare = function(field, value, cond, fieldType) { } else { - throw new Error(translate.withArguments("${SQL_LIB_FIELD_WRONG_FORMAT} field: %0", [field])); + throw new Error(translate.text("${SQL_LIB_FIELD_WRONG_FORMAT}") + field + translate.withArguments("${SQL_LIB_FIELD_WRONG_FORMAT} field: %0", [field])); } } else @@ -547,7 +547,7 @@ SqlCondition.prototype._prepare = function(field, value, cond, fieldType) { } else { - throw new Error(translate.withArguments("${SQL_LIB_FIELD_WRONG_FORMAT} field: %0", [field.toSource()])); + throw new Error(translate.text("${SQL_LIB_FIELD_WRONG_FORMAT}") + field.toSource() + translate.withArguments("${SQL_LIB_FIELD_WRONG_FORMAT} field: %0", [field.toSource()])); } } @@ -3940,7 +3940,7 @@ SqlUtils.parseField = function(pField) if (pointPos > 0 && pointPos < pField.length-1) alias = pField; else - throw new Error(translate.withArguments("${SQL_LIB_FIELD_WRONG_FORMAT} field: %0", [pField])); + throw new Error(translate.text("${SQL_LIB_FIELD_WRONG_FORMAT}") + pField + translate.withArguments("${SQL_LIB_FIELD_WRONG_FORMAT} field: %0", [pField])); } else { @@ -3953,7 +3953,7 @@ SqlUtils.parseField = function(pField) pField = pField[0] + "." + pField[1]; } else - throw new Error(translate.withArguments("${SQL_LIB_FIELD_WRONG_FORMAT} field: %0", [field.toSource()])); + throw new Error(translate.text("${SQL_LIB_FIELD_WRONG_FORMAT}") + field.toSource() + translate.withArguments("${SQL_LIB_FIELD_WRONG_FORMAT} field: %0", [field.toSource()])); } return [alias, pField] }