From c31e71066cfddd2af992e886be3d2f8b9fd3108f Mon Sep 17 00:00:00 2001
From: lord_alan <alanslists@gmail.com>
Date: Wed, 29 Jun 2016 11:38:36 +0100
Subject: [PATCH] Fix SQL to remove deleted records from result. refs #46

---
 modules/Vtiger/models/Module.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/Vtiger/models/Module.php b/modules/Vtiger/models/Module.php
index b716f5801..fca0b98c7 100644
--- a/modules/Vtiger/models/Module.php
+++ b/modules/Vtiger/models/Module.php
@@ -1441,7 +1441,7 @@ class Vtiger_Module_Model extends Vtiger_Module {
 				$sql = "SELECT vtiger_crmentity.crmid FROM vtiger_crmentity";
 				if($tablename == 'vtiger_crmentityrel'){
 					$sql .= " INNER JOIN $tablename ON ($tablename.relcrmid = vtiger_crmentity.crmid OR $tablename.crmid = vtiger_crmentity.crmid)
-						WHERE ($tablename.crmid IN (".  generateQuestionMarks($recordIds).")) OR ($tablename.relcrmid IN (".  generateQuestionMarks($recordIds)."))";
+						WHERE ($tablename.crmid IN (".  generateQuestionMarks($recordIds).") OR $tablename.relcrmid IN (".  generateQuestionMarks($recordIds)."))";
 					foreach ($recordIds as $key => $recordId) {
 						array_push($params, $recordId);
 					}
-- 
GitLab