From 8969866aec64171bec6862a9fbf9d8c8e38d5cea Mon Sep 17 00:00:00 2001 From: yuri Date: Tue, 10 Jan 2017 16:04:54 +0200 Subject: [PATCH] fix nl in email template text field --- application/Espo/Services/EmailTemplate.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/application/Espo/Services/EmailTemplate.php b/application/Espo/Services/EmailTemplate.php index 4325ec0900..a5399d0325 100644 --- a/application/Espo/Services/EmailTemplate.php +++ b/application/Espo/Services/EmailTemplate.php @@ -193,10 +193,15 @@ class EmailTemplate extends Record $value = implode(', ', $valueList); $value = $this->getLanguage()->translateOption($value, $field, $entity->getEntityType()); } else { - if ($entity->fields[$field]['type'] == 'date') { + if (!isset($entity->fields[$field]['type'])) continue; + $attributeType = $entity->fields[$field]['type']; + + if ($attributeType == 'date') { $value = $this->getDateTime()->convertSystemDate($value); - } else if ($entity->fields[$field]['type'] == 'datetime') { + } else if ($attributeType == 'datetime') { $value = $this->getDateTime()->convertSystemDateTime($value); + } else if ($attributeType == 'text') { + $value = nl2br($value); } } if (is_string($value) || $value === null || is_scalar($value) || is_callable([$value, '__toString'])) {