From dd57b5b397ddcc5134b3763b2cdea3af7e9d23f5 Mon Sep 17 00:00:00 2001
From: Madhu S R <madhu.sr@vtigersolutions.com>
Date: Sun, 21 Apr 2024 20:45:37 +0530
Subject: [PATCH] Fixes: Verifying if the email module is active to link the
 view mail composer box to onclick for  the email field value

---
 include/ListView/ListViewController.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/ListView/ListViewController.php b/include/ListView/ListViewController.php
index 2a4b6bd7e..233f3eb15 100644
--- a/include/ListView/ListViewController.php
+++ b/include/ListView/ListViewController.php
@@ -234,6 +234,10 @@ class ListViewController {
 			$clickToCallLabel = vtranslate("LBL_CLICK_TO_CALL");
 		}
 
+		$emailModuleInstance = Vtiger_Module_Model::getInstance("Emails");
+		//checking the email module is active.
+		$isEmailModuleActive = $emailModuleInstance ? $emailModuleInstance->isActive() : false;
+
 		$data = array();
 		for ($i = 0; $i < $rowCount; ++$i) {
 			//Getting the recordId
@@ -412,7 +416,8 @@ class ListViewController {
 					}
 				} elseif ($fieldDataType == 'email') {
 					global $current_user;
-					if($current_user->internal_mailer == 1){
+					// checking email module is active and internal mail composer is on
+					if($isEmailModuleActive && $current_user->internal_mailer == 1){
 						//check added for email link in user detailview
 						$value = "<a class='emailField' data-rawvalue=\"$rawValue\" onclick=\"Vtiger_Helper_Js.getInternalMailer($recordId,".
 						"'$fieldName','$module');\">".textlength_check($value)."</a>";
-- 
GitLab