diff --git a/entity/LetterRecipient_entity/LetterRecipient_entity.aod b/entity/LetterRecipient_entity/LetterRecipient_entity.aod index 63ec8c14576769c9f89e4cedc7152fb2fc92b02c..e8f4ac96e66e694bab194186688c63f7c8bfa300 100644 --- a/entity/LetterRecipient_entity/LetterRecipient_entity.aod +++ b/entity/LetterRecipient_entity/LetterRecipient_entity.aod @@ -6,6 +6,7 @@ <siblings> <element>Address_entity</element> </siblings> + <onValidation>%aditoprj%/entity/LetterRecipient_entity/onValidation.js</onValidation> <titlePlural>Recipients</titlePlural> <recordContainer>db</recordContainer> <entityFields> diff --git a/entity/LetterRecipient_entity/onValidation.js b/entity/LetterRecipient_entity/onValidation.js new file mode 100644 index 0000000000000000000000000000000000000000..b165c8bd18fd2983e52e191b2ec9e71b404cbb7f --- /dev/null +++ b/entity/LetterRecipient_entity/onValidation.js @@ -0,0 +1,16 @@ +import("system.translate"); +import("system.result"); +import("Sql_lib"); +import("system.vars"); + +var contactId = vars.get("$field.CONTACT_ID"); + +var standardAddress = newSelect("CONTACT.ADDRESS_ID") + .from("CONTACT") + .where("CONTACT.CONTACTID", contactId) + .cell(); + +if(!standardAddress) +{ + result.string(translate.text("The selected Contact doesn't have an address set.")); +} \ No newline at end of file diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index 48811b948ee655e2b6693d365778101ae1e9fabd..662da014d5034596c4170f196f73536c410c0250 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -202,6 +202,10 @@ <key>Sender address</key> <value>Senderadresse</value> </entry> + <entry> + <key>The selected Contact doesn't have an address set.</key> + <value>Der ausgewählte Kontakt hat keine Adresse festgelegt.</value> + </entry> <entry> <key>Complete tasks</key> <value>Aufgaben abschließen</value>