From f0d76b0572cfe35d55d5ddcd8e08edd40783b5a7 Mon Sep 17 00:00:00 2001
From: Uma <uma.s@vtiger.com>
Date: Fri, 7 Aug 2020 18:40:33 +0530
Subject: [PATCH] Fixes #1438 Textarea fields data save

---
 modules/Vtiger/uitypes/Text.php | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/modules/Vtiger/uitypes/Text.php b/modules/Vtiger/uitypes/Text.php
index 054024fea..5207531bf 100644
--- a/modules/Vtiger/uitypes/Text.php
+++ b/modules/Vtiger/uitypes/Text.php
@@ -16,14 +16,10 @@ class Vtiger_Text_UIType extends Vtiger_Base_UIType {
 	 * @return <Object>
 	 */
 	public function getDisplayValue($value, $record=false, $recordInstance = false,$removeTags = false) {
-		//This API replaces newlines to html br tags, and spaces with &nbsp;
-		// It should not replace spaces within html tags
-		$value = decode_html(preg_replace('/\r\n|\r|\n|&NewLine;|&amp;NewLine;/','<br>',$value));
-		if($removeTags){
-            $value = strip_tags($value,'<br>');
-        }
-		$value = purifyHtmlEventAttributes($value, true);
-		return $value;
+		if(in_array($this->get('field')->getFieldName(),array('signature','commentcontent'))) {
+			return $value;
+		}
+		return nl2br(purifyHtmlEventAttributes($value, true));
 	}
     
     /**
-- 
GitLab