[Vtigercrm-commits] [vtiger-commits] r6459 - /vtigercrm/trunk/include/utils/UserInfoUtil.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Fri May 26 09:17:06 EDT 2006


Author: don
Date: Fri May 26 07:17:02 2006
New Revision: 6459

Log:
Fixed the issue of Sharing Handling for modules which do not have User Defined Sharing

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

Modified: vtigercrm/trunk/include/utils/UserInfoUtil.php
==============================================================================
--- vtigercrm/trunk/include/utils/UserInfoUtil.php (original)
+++ vtigercrm/trunk/include/utils/UserInfoUtil.php Fri May 26 07:17:02 2006
@@ -1607,10 +1607,19 @@
 	global $adb;
 	global $current_user;
 	require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
-	$recordOwnerArr=getRecordOwnerId($record_id);
 	$ownertype='';
 	$ownerid='';
 	$sharePer='no';
+
+	$sharingModuleList=getSharingModuleList();
+	if(! in_array($module,$sharingModuleList))
+	{
+		$sharePer='no';
+		return $sharePer;
+	}
+
+	
+	$recordOwnerArr=getRecordOwnerId($record_id);
 	foreach($recordOwnerArr as $type=>$id)
 	{
 		$ownertype=$type;
@@ -1740,10 +1749,18 @@
 	global $adb;
 	global $current_user;	
 	require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
-	$recordOwnerArr=getRecordOwnerId($record_id);
 	$ownertype='';
 	$ownerid='';
 	$sharePer='no';
+
+	$sharingModuleList=getSharingModuleList();
+        if(! in_array($module,$sharingModuleList))
+        {
+                $sharePer='no';
+                return $sharePer;
+        }
+
+	$recordOwnerArr=getRecordOwnerId($record_id);
 	foreach($recordOwnerArr as $type=>$id)
 	{
 		$ownertype=$type;
@@ -1752,6 +1769,7 @@
 
 	$varname=$module."_share_write_permission";
 	$write_per_arr=$$varname;
+	
 	if($ownertype == 'Users')
 	{
 		//Checking the Write Sharing Permission Array in Role Users
@@ -4618,5 +4636,31 @@
 	$log->debug("Exiting updateCampaignGroupRelation method ...");
 }
 
+
+/** Function to get the list of module for which the user defined sharing rules can be defined  
+  * @returns Array:: Type array
+  *
+  */
+function getSharingModuleList()
+{
+	global $log;
+	
+	$sharingModuleArray=Array('Accounts',
+				 'Leads',
+				 'Contacts',
+				 'Potentials',
+				 'HelpDesk',
+				 'Emails',
+				 'Campaigns',
+				 'Quotes',
+				 'PurchaseOrder',
+				 'SalesOrder',
+				 'Invoice');
+
+	return $sharingModuleArray;					
+}
+
+
+
 //end					   
 ?>





More information about the vtigercrm-commits mailing list