From 73430075259147d51ce62b29ef334ddab20f30eb Mon Sep 17 00:00:00 2001
From: satish <satish.dvnk@vtiger.com>
Date: Tue, 27 Jun 2017 19:10:52 +0530
Subject: [PATCH] Fixes #597 - VT7.0.1 Read more and Roll-up not working on
 summary page comments

---
 layouts/v7/modules/Vtiger/resources/Detail.js | 11 +++++++----
 modules/Vtiger/views/Detail.php               |  2 +-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/layouts/v7/modules/Vtiger/resources/Detail.js b/layouts/v7/modules/Vtiger/resources/Detail.js
index f4dc16c66..67fe3ed17 100644
--- a/layouts/v7/modules/Vtiger/resources/Detail.js
+++ b/layouts/v7/modules/Vtiger/resources/Detail.js
@@ -2114,9 +2114,12 @@ Vtiger.Class("Vtiger_Detail_Js",{
 		var moduleName = currentTarget.attr('module');
 		var recordId = currentTarget.attr('record');
 		var rollupId = currentTarget.attr('rollupid');
-		var rollupstatus = currentTarget.attr('rollup-status');
+		var rollup_status = currentTarget.attr('rollup-status');
+		var rollupstatus = 0;
+		if (rollup_status == 0) {
+			rollupstatus = 1;
+		}
 		var viewtype = currentTarget.data('view');
-		var startindex = parseInt(currentTarget.attr('startindex'));
 		var contents, url, params;
 
 		if(viewtype == 'relatedlist') {
@@ -2133,7 +2136,7 @@ Vtiger.Class("Vtiger_Detail_Js",{
 		} else {
 			url = 'index.php?module='+moduleName+'&relatedModule=ModComments&view=Detail&record='+
 					recordId+'&mode=showRecentComments'+'&rollupid='+rollupId
-					+'&rollup_status=0&parent='+moduleName+'&rollup-toggle=1&limit=5';
+					+'&rollup_status='+rollupstatus+'&parent='+moduleName+'&rollup-toggle=1&limit=5';
 			contents = jQuery('div[data-name="ModComments"] div.widget_contents');
 			params = {
 				'type' : 'GET',
@@ -2144,7 +2147,7 @@ Vtiger.Class("Vtiger_Detail_Js",{
 				contents.html(data);
 				vtUtils.enableTooltips();
 				self.registerRollupCommentsSwitchEvent();
-				jQuery('#rollupcomments').bootstrapSwitch('state', !rollupstatus, true);
+				jQuery('#rollupcomments').bootstrapSwitch('state', rollupstatus, true);
 			});
 		}
 	},
diff --git a/modules/Vtiger/views/Detail.php b/modules/Vtiger/views/Detail.php
index e3d668df0..2d478f277 100644
--- a/modules/Vtiger/views/Detail.php
+++ b/modules/Vtiger/views/Detail.php
@@ -472,7 +472,7 @@ class Vtiger_Detail_View extends Vtiger_Index_View {
 
 		if($rollupsettings['rollup_status']) {
 			$parentRecordModel = Vtiger_Record_Model::getInstanceById($parentId, $moduleName);
-			$recentComments = $parentRecordModel->getRollupCommentsForModule(0, 5);
+			$recentComments = $parentRecordModel->getRollupCommentsForModule(0, 6);
 		}else {
 			$recentComments = ModComments_Record_Model::getRecentComments($parentId, $pagingModel);
 		}
-- 
GitLab