[Vtigercrm-commits] [vtiger-commits] r7305 - /vtigercrm/trunk/include/utils/ListViewUtils.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Tue Jun 20 10:35:20 EDT 2006


Author: saraj
Date: Tue Jun 20 08:35:16 2006
New Revision: 7305

Log:
changes made to fix the issue 685 and 686

Modified:
    vtigercrm/trunk/include/utils/ListViewUtils.php

Modified: vtigercrm/trunk/include/utils/ListViewUtils.php
==============================================================================
--- vtigercrm/trunk/include/utils/ListViewUtils.php (original)
+++ vtigercrm/trunk/include/utils/ListViewUtils.php Tue Jun 20 08:35:16 2006
@@ -1314,6 +1314,8 @@
 					$focus->record_id = $_REQUEST['recordid'];
 					if($module == 'Leads')
 						$value = '<a href="a" LANGUAGE=javascript onclick=\'add_leaddata_to_relatedlist("'.$entity_id.'","'.$focus->record_id.'"); window.close()\'>'.$temp_val.'</a>';
+					elseif($module == 'Users')
+						$value = '<a href="a" LANGUAGE=javascript onclick=\'add_userdata_to_relatedlist("'.$entity_id.'","'.$focus->record_id.'"); window.close()\'>'.$temp_val.'</a>';
 					else
 						$value = '<a href="a" LANGUAGE=javascript onclick=\'add_data_to_relatedlist("'.$entity_id.'","'.$focus->record_id.'"); window.close()\'>'.$temp_val.'</a>';
 				}
@@ -1690,7 +1692,7 @@
 			LEFT JOIN vtiger_users
 				ON vtiger_users.id = vtiger_crmentity.smownerid
 			WHERE vtiger_crmentity.deleted = 0
-			AND vtiger_leaddetails.converted = 0 ";
+			AND vtiger_leaddetails.converted = 0 ".$where;
                if($is_admin==false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[$tab_id] == 3)
                 {
 			$sec_parameter=getListViewSecurityParameter($module);
@@ -2041,7 +2043,7 @@
 	}
 	if($module == "Users")
 	{
-		$query = "select id,user_name,roleid,first_name,last_name,email1,phone_mobile,phone_work,is_admin,status from vtiger_users inner join vtiger_user2role on vtiger_user2role.userid=vtiger_users.id where deleted=0";
+		$query = "select id,user_name,roleid,first_name,last_name,email1,phone_mobile,phone_work,is_admin,status from vtiger_users inner join vtiger_user2role on vtiger_user2role.userid=vtiger_users.id where deleted=0 ".$where ;
 	}
 	
 
@@ -2521,15 +2523,51 @@
 	global $adb;
 	$skip_id = Array();
 	$where_relquery = "";
-
 	if($currentmodule=="Contacts" && $returnmodule == "Potentials")
 	{
-		$query = "SELECT contactid FROM vtiger_contpotentialrel WHERE potentialid = ".$recordid;
+		$reltable = 'vtiger_contpotentialrel';
+		$condition = 'WHERE potentialid = '.$recordid;
+		$field = $selectfield = 'contactid';
+		$table = 'vtiger_contactdetails';
 	}
 	elseif($currentmodule=="Contacts" && $returnmodule == "Vendors")
 	{
-		$query = "SELECT contactid FROM vtiger_vendorcontactrel WHERE vendorid = ".$recordid;
-	}
+		$reltable = 'vtiger_vendorcontactrel';
+		$condition = 'WHERE vendorid = '.$recordid;
+		$field = $selectfield = 'contactid';
+		$table = 'vtiger_contactdetails';
+	}
+	elseif($currentmodule=="Contacts" && $returnmodule == "Campaigns")
+	{
+		$reltable = 'vtiger_campaigncontrel';
+		$condition = 'WHERE campaignid = '.$recordid;
+		$field = $selectfield = 'contactid';
+		$table = 'vtiger_contactdetails';
+	}
+	elseif($currentmodule=="Contacts" && $returnmodule == "Activities")
+	{
+		$reltable = 'vtiger_seactivityrel';
+		$condition = 'WHERE activityid = '.$recordid;
+		$selectfield = 'crmid';
+		$field = 'contactid';
+		$table = 'vtiger_contactdetails';
+	}
+	elseif($currentmodule=="Leads" && $returnmodule == "Campaigns")
+	{
+		$reltable = 'vtiger_campaignleadrel';
+		$condition = 'WHERE campaignid = '.$recordid;;
+		$field = $selectfield = 'leadid';
+		$table = 'vtiger_leaddetails';
+	}
+	elseif($currentmodule=="Users" && $returnmodule == "Activities")
+	{
+		$reltable = 'vtiger_salesmanactivityrel';
+		$condition = 'WHERE activityid = '.$recordid;;
+		$selectfield = 'smid';
+		$field = 'id';
+		$table = 'vtiger_users';
+	}
+	$query = "SELECT ".$selectfield." FROM ".$reltable." ".$condition;
 
 	if($query !='')
 	{
@@ -2538,10 +2576,10 @@
 		{
 			for($k=0;$k < $adb->num_rows($result);$k++)
 			{
-				$skip_id[]=$adb->query_result($result,$k,"contactid");
+				$skip_id[]=$adb->query_result($result,$k,$selectfield);
 			}
 			$skipids = constructList($skip_id,'INTEGER');
-			$where_relquery = "and vtiger_contactdetails.contactid not in ".$skipids;
+			$where_relquery = "and ".$table.".".$field." not in ".$skipids;
 		}
 	}
 	$log->debug("Exiting getRelCheckquery method ...");





More information about the vtigercrm-commits mailing list