[Vtigercrm-commits] [vtiger-commits] r10607 - /vtigercrm/branches/5.0.3/include/utils/DeleteUtils.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Tue Apr 10 01:56:48 EDT 2007


Author: richie
Date: Mon Apr  9 23:56:40 2007
New Revision: 10607

Log:
fix for Calendar: Deleted contact name has been showed in calendar list view,detail view and edit view. Fixes #3520 --minnie

Modified:
    vtigercrm/branches/5.0.3/include/utils/DeleteUtils.php

Modified: vtigercrm/branches/5.0.3/include/utils/DeleteUtils.php
==============================================================================
--- vtigercrm/branches/5.0.3/include/utils/DeleteUtils.php (original)
+++ vtigercrm/branches/5.0.3/include/utils/DeleteUtils.php Mon Apr  9 23:56:40 2007
@@ -63,18 +63,33 @@
 	case Contacts:
 		if($return_module == 'Accounts')
 		{
-			$sql = 'update vtiger_contactdetails set accountid = "" where contactid = '.$record;
-			$adb->query($sql);
-		}
-		if($return_module == 'Potentials' && $record != '' && $return_id != '')
+			$sql = 'update vtiger_contactdetails set accountid = null where contactid = '.$record;
+			$adb->query($sql);
+		}
+		elseif($return_module == 'Potentials' && $record != '' && $return_id != '')
 		{
 			$sql = 'delete from vtiger_contpotentialrel where contactid='.$record.' and potentialid='.$return_id;
 			$adb->query($sql);
 		}
-		if($return_module == "Campaigns") {
+		elseif($return_module == "Campaigns") {
 			$sql = 'delete from vtiger_campaigncontrel where contactid='.$record.' and campaignid='.$return_id;
 			$adb->query($sql);
 		}
+		elseif($return_module == 'Products')//Delete Contact from Product relatedlist
+		{
+			$sql = "delete from vtiger_seproductsrel where crmid=$record and productid=$return_id";
+			$adb->query($sql);
+		}
+		elseif($return_module == 'Vendors')
+		{
+			$sql = "delete from vtiger_vendorcontactrel where vendorid=$return_id and contactid=$record";
+			$adb->query($sql);
+		}
+		else
+		{
+			$sql = "delete from vtiger_cntactivityrel where contactid=".$record;
+			$adb->query($sql);
+		}	
 		if($record != '' && $return_id != '')
 		{
 			$sql = 'delete from vtiger_seactivityrel where crmid = '.$record.' and activityid = '.$return_id;
@@ -82,41 +97,36 @@
 			$sql_recentviewed ='delete from vtiger_tracker where user_id = '.$current_user->id.' and item_id = '.$record;
 			$adb->query($sql_recentviewed);
 		}
-		if($return_module == 'Products')//Delete Contact from Product relatedlist
-		{
-			$sql = "delete from vtiger_seproductsrel where crmid=$record and productid=$return_id";
-			$adb->query($sql);
-		}
-		if($return_module == 'Vendors')
-		{
-			$sql = "delete from vtiger_vendorcontactrel where vendorid=$return_id and contactid=$record";
-			$adb->query($sql);
-		}
-		if($return_module == 'Calendar')
-		{
-			$sql = "delete from vtiger_cntactivityrel where activityid=$return_id and contactid=$record";
-			$adb->query($sql);
-		}
 	break;
 	case Potentials:
-		if($return_module == 'Accounts' || $return_module == 'Campaigns')
+		if($return_module == 'Accounts')
 		{
 			//we can call $focus->mark_deleted($record)
 			$sql = 'update vtiger_crmentity set deleted = 1 where crmid = '.$record;
 			$adb->query($sql);
-		}
-		if($return_module == 'Products')//Delete Potential from Product relatedlist
+			$sql ='delete from vtiger_seactivityrel where crmid = '.$record;
+			$adb->query($sql);
+		}
+		elseif($return_module == 'Campaigns')
+		{
+			$sql = 'update vtiger_potential set campaignid = null where potentialid = '.$record;
+		        $adb->query($sql);	
+		}
+		elseif($return_module == 'Products')//Delete Potential from Product relatedlist
 		{
 			$sql = "delete from vtiger_seproductsrel where crmid=$record and productid=$return_id";
 			$adb->query($sql);
 		}
-		if($return_module == 'Contacts')
+		elseif($return_module == 'Contacts')
 		{
 			$sql = "delete from vtiger_contpotentialrel where potentialid=$record and contactid=$return_id";
 			$adb->query($sql);
 		}
-		$sql ='delete from vtiger_seactivityrel where crmid = '.$record.' and activityid = '.$return_id;
-		$adb->query($sql);
+		else
+		{
+			$sql ='delete from vtiger_seactivityrel where crmid = '.$record;
+			$adb->query($sql);
+		}	
 	break;
 	case Calendar:
 		if($return_module == 'Contacts')





More information about the vtigercrm-commits mailing list