Skip to content
Snippets Groups Projects
Commit 453a8e37 authored by Sascha Schmidt's avatar Sascha Schmidt
Browse files

Default title

parent 5f61a782
No related branches found
No related tags found
No related merge requests found
import("system.logging");
import("EmailUtil_lib");
import("Organisation_lib");
import("Employee_lib");
......@@ -840,7 +841,8 @@ ContactUtils.getContactSalutationSubSql = function(pGetHeadline, pGetLetterSalut
}
}
return newSelect("case when CONTACT.PERSON_ID is null then " + salutationColumn + " else " + personSelect + "end")
return sqlHelper.isNull(
"(" + newSelect("case when CONTACT.PERSON_ID is null then " + salutationColumn + " else " + personSelect + "end")
.from("SALUTATION")
.where("SALUTATION.ISOLANGUAGE = CONTACT.ISOLANGUAGE")
.and(newWhere("SALUTATION.SEX = PERSON.GENDER").or("SALUTATION.SEX is null"))
......@@ -848,7 +850,9 @@ ContactUtils.getContactSalutationSubSql = function(pGetHeadline, pGetLetterSalut
.and(newWhere("SALUTATION.SALUTATION = PERSON.SALUTATION").or("SALUTATION.SALUTATION is null"))
.orderBy("SALUTATION.SEX desc, SALUTATION.TITLE desc")
.toString()
+ " " + sqlHelper.limit(1);
+ " " + sqlHelper.limit(1)
+ ")"
, sqlHelper.concatWithSeparator(["PERSON.TITLE", "PERSON.FIRSTNAME", "PERSON.LASTNAME"], " "));
}
/**
......
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