Added insert template

This commit is contained in:
M66B
2019-04-27 15:58:28 +02:00
parent c57d49b643
commit 4920a76e19
5 changed files with 75 additions and 4 deletions

View File

@@ -77,10 +77,14 @@ public class EntityAnswer implements Serializable {
}
}
String text = answer.text;
text = text.replace("$name$", name == null ? "" : name);
text = text.replace("$firstname$", first == null ? "" : first);
text = text.replace("$lastname$", last == null ? "" : last);
return replacePlaceholders(answer.text, name, first, last, email);
}
static String replacePlaceholders(
String text, String fullName, String firstName, String lastName, String email) {
text = text.replace("$name$", fullName == null ? "" : fullName);
text = text.replace("$firstname$", firstName == null ? "" : firstName);
text = text.replace("$lastname$", lastName == null ? "" : lastName);
text = text.replace("$email$", email == null ? "" : email);
return text;