From 129561afb5ca5f1a165ab1e947e993e264238f4b Mon Sep 17 00:00:00 2001
From: satish <satish.dvnk@vtiger.com>
Date: Mon, 29 May 2017 21:38:51 +0530
Subject: [PATCH] Fixes #554 - VT 6.5 to 7 migration error

---
 modules/Migration/schema/660_to_700.php | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/Migration/schema/660_to_700.php b/modules/Migration/schema/660_to_700.php
index 4d37e1f5b..e65117aee 100644
--- a/modules/Migration/schema/660_to_700.php
+++ b/modules/Migration/schema/660_to_700.php
@@ -623,9 +623,9 @@ if(defined('VTIGER_UPGRADE')) {
 	do {
 		$commentsResult = $db->pquery('SELECT vtiger_modcomments.modcommentsid FROM vtiger_modcomments 
 												LEFT JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_modcomments.related_to 
-												WHERE vtiger_crmentity.setype NOT IN ('.generateQuestionMarks($internalCommentModules).') 
-												OR vtiger_crmentity.setype IS NULL AND modcommentsid > ? LIMIT 500', array_merge($internalCommentModules, array($lastMaxCRMId)));
-		if (!$db->num_rows($result)) {
+												WHERE (vtiger_crmentity.setype NOT IN ('.generateQuestionMarks($internalCommentModules).') 
+												OR vtiger_crmentity.setype IS NULL) AND modcommentsid > ? LIMIT 500', array_merge($internalCommentModules, array($lastMaxCRMId)));
+		if (!$db->num_rows($commentsResult)) {
 			break;
 		}
 
@@ -645,7 +645,7 @@ if(defined('VTIGER_UPGRADE')) {
 		$commentsResult = NULL;
 		unset($commentsResult);
 	} while (true);
-	
+
 	//Start - Add Contact Name to Default filter of project
 	$cvidQuery = $db->pquery('SELECT cvid FROM vtiger_customview where viewname=? AND entitytype=?', array('All', 'Project'));
 	$row = $db->fetch_array($cvidQuery);
-- 
GitLab