[Vtigercrm-commits] [vtiger-commits] r10769 - in /vtigercrm/branches/5.0.3: include/utils/ListViewUtils.php modules/Calendar/calendarLayout.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Tue Apr 24 03:32:54 EDT 2007


Author: richie
Date: Tue Apr 24 01:32:41 2007
New Revision: 10769

Log:
fix for Calendar: Related To ,Contact and Status in List View. Fixes #3617 --minnie

Modified:
    vtigercrm/branches/5.0.3/include/utils/ListViewUtils.php
    vtigercrm/branches/5.0.3/modules/Calendar/calendarLayout.php

Modified: vtigercrm/branches/5.0.3/include/utils/ListViewUtils.php
==============================================================================
--- vtigercrm/branches/5.0.3/include/utils/ListViewUtils.php (original)
+++ vtigercrm/branches/5.0.3/include/utils/ListViewUtils.php Tue Apr 24 01:32:41 2007
@@ -102,14 +102,16 @@
 				INNER JOIN vtiger_profile2field
 					ON vtiger_profile2field.fieldid = vtiger_field.fieldid
 				INNER JOIN vtiger_def_org_field
-					ON vtiger_def_org_field.fieldid = vtiger_field.fieldid
-				WHERE vtiger_field.tabid = ".$tabid."
-				AND vtiger_profile2field.visible = 0
+					ON vtiger_def_org_field.fieldid = vtiger_field.fieldid";
+				if($module == "Calendar")
+					$query .=" WHERE vtiger_field.tabid in (9,16)";
+				else
+					$query .=" WHERE vtiger_field.tabid =".$tabid;
+			$query.=" AND vtiger_profile2field.visible = 0
 				AND vtiger_def_org_field.visible = 0
 				AND vtiger_profile2field.profileid IN ".$profileList."
 				AND vtiger_field.fieldname IN ".$field_list;
 		}
-
 		$result = $adb->query($query);
 		for($k=0;$k < $adb->num_rows($result);$k++)
 		{
@@ -221,7 +223,17 @@
 
 		else
 		{
-			$list_header[]=$name;
+			if($module == "Calendar" && $name == $app_strings['Close'])
+			{
+				if((getFieldVisibilityPermission('Events',$current_user->id,'eventstatus') == '0') || (getFieldVisibilityPermission('Calendar',$current_user->id,'taskstatus') == '0'))
+				{
+					array_push($list_header,$name);
+				}
+			}
+			else
+			{
+				$list_header[]=$name;
+			}
 		}
 	}
      }
@@ -777,7 +789,15 @@
 				}
 				else
 				{
-					$list_header[] = $value;
+					if($module == "Calendar" && $name == $app_strings['Close'])
+					{
+						if((getFieldVisibilityPermission('Events',$current_user->id,'eventstatus') == '0') || (getFieldVisibilityPermission('Calendar',$current_user->id,'taskstatus') == '0'))
+						{
+							array_push($list_header,$value);
+						}
+					}
+					else
+						$list_header[] = $value;
 				}
 				if($fieldname=='filename')
 				{

Modified: vtigercrm/branches/5.0.3/modules/Calendar/calendarLayout.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Calendar/calendarLayout.php (original)
+++ vtigercrm/branches/5.0.3/modules/Calendar/calendarLayout.php Tue Apr 24 01:32:41 2007
@@ -1334,14 +1334,22 @@
 			$image_tag = "<img src='".$calendar['IMAGE_PATH']."Meetings.gif' align='middle'>&nbsp;".$app_strings['Meeting'];
         	$element['eventtype'] = $image_tag;
 		$element['eventdetail'] = $contact_data." ".$subject."&nbsp;".$more_link;
-		$element['relatedto']= getRelatedTo('Calendar',$result,$i);
+		if(getFieldVisibilityPermission('Events',$current_user->id,'parent_id') == '0')
+		{
+			$element['relatedto']= getRelatedTo('Calendar',$result,$i);
+		}
+
 		if(isPermitted("Calendar","EditView") == "yes" || isPermitted("Calendar","Delete")=="yes")
 			$element['action'] ="<img onClick='getcalAction(this,\"eventcalAction\",".$id.",\"".$calendar['view']."\",\"".$calendar['calendar']->date_time->hour."\",\"".$calendar['calendar']->date_time->get_formatted_date()."\",\"event\",\"".$idShared."\");' src='".$calendar['IMAGE_PATH']."cal_event.jpg' border='0'>";
-        	$element['status'] = $mod_strings[$adb->query_result($result,$i,"eventstatus")];
+		if(getFieldVisibilityPermission('Events',$current_user->id,'eventstatus') == '0')
+		{
+			$element['status'] = $mod_strings[$adb->query_result($result,$i,"eventstatus")];
+		}
 		if(!empty($assignedto))
 			$element['assignedto'] = $assignedto;
 		else
 			$element['assignedto'] = $adb->query_result($result,$i,"groupname");
+
 	$Entries[] = $element;
 	
 	}
@@ -1442,9 +1450,18 @@
 		$status = $adb->query_result($result,$i,"status");
 		$more_link = "<a href='index.php?action=DetailView&module=Calendar&record=".$id."&activity_mode=Task&viewtype=calendar&parenttab=".$category."' class='webMnu'>".$subject."</a>";
 		$element['tododetail'] = $more_link;
-		$element['task_relatedto'] = getRelatedTo('Calendar',$result,$i); 
-		$element['task_contact'] = "<a href=\"index.php?module=Contacts&action=DetailView&record=".$contact_id."\">".$contact_name."</a>"; 
-		$element['status'] = $adb->query_result($result,$i,"status");
+		if(getFieldVisibilityPermission('Calendar',$current_user->id,'parent_id') == '0')
+		{
+			$element['task_relatedto'] = getRelatedTo('Calendar',$result,$i);
+		}
+		if(getFieldVisibilityPermission('Calendar',$current_user->id,'contact_id') == '0')
+		{
+			$element['task_contact'] = "<a href=\"index.php?module=Contacts&action=DetailView&record=".$contact_id."\">".$contact_name."</a>";
+		}
+		if(getFieldVisibilityPermission('Calendar',$current_user->id,'taskstatus') == '0')
+		{
+			$element['status'] = $adb->query_result($result,$i,"status");
+		}
 		if(isPermitted("Calendar","EditView") == "yes" || isPermitted("Calendar","Delete") == "yes")
 			$element['action'] ="<img onClick='getcalAction(this,\"taskcalAction\",".$id.",\"".$calendar['view']."\",\"".$calendar['calendar']->date_time->hour."\",\"".$calendar['calendar']->date_time->get_formatted_date()."\",\"todo\",\"normal\");' src='".$calendar['IMAGE_PATH']."cal_event.jpg' border='0'>";
 		$assignedto = $adb->query_result($result,$i,"user_name");
@@ -1516,30 +1533,32 @@
                         '1'=>$start_datetime,
                         '2'=>$end_datetime,
                         '3'=>$mod_strings['LBL_EVENTTYPE'],
-                        '4'=>$mod_strings['LBL_EVENTDETAILS'],
-			'5'=>$mod_strings['LBL_RELATEDTO'],
-                        );
-                                if(isPermitted("Calendar","EditView") == "yes" || isPermitted("Calendar","Delete") == "yes")
-                                {
-                                        array_push($header,$mod_strings['LBL_ACTION']);
-                                }
-
-                                array_push($header,$mod_strings['LBL_STATUS'],$mod_strings['LBL_ASSINGEDTO']);
-        $header_width = Array('0'=>'5%',
-                              '1'=>'10%',
-                              '2'=>'10%',
-                              '3'=>'10%',
-                              '4'=>'28%',
-			      '5'=>'15%',	
-                             );
-
-                              if(isPermitted("Calendar","EditView") == "yes" || isPermitted("Calendar","Delete") == "yes")
-                              {
-
-                                        array_push($header_width,'10%');
-                              }
-                              array_push($header_width,'10%','15%');
-
+                        '4'=>$mod_strings['LBL_EVENTDETAILS']
+			);
+	$header_width = Array('0'=>'5%',
+			      '1'=>'10%',
+			      '2'=>'10%',
+			      '3'=>'10%',
+			      '4'=>'28%'
+		             );
+	if(getFieldVisibilityPermission('Events',$current_user->id,'parent_id') == '0')
+	{
+		array_push($header,$mod_strings['LBL_RELATEDTO']);
+		array_push($header_width,'15%');
+	}
+	if(isPermitted("Calendar","EditView") == "yes" || isPermitted("Calendar","Delete") == "yes")
+	{
+		array_push($header,$mod_strings['LBL_ACTION']);
+		 array_push($header_width,'10%');
+	}
+	if(getFieldVisibilityPermission('Events',$current_user->id,'eventstatus') == '0')
+	{
+		array_push($header,$mod_strings['LBL_STATUS']);
+		array_push($header_width,'$10%');
+	}
+	array_push($header,$mod_strings['LBL_ASSINGEDTO']);
+	array_push($header_width,'15%');
+	
         $list_view .="<table style='background-color: rgb(204, 204, 204);' class='small' align='center' border='0' cellpadding='5' cellspacing='1' width='98%'>
                         <tr>";
 	$header_rows = count($header);
@@ -1627,18 +1646,31 @@
 	{
 		$colspan = 9;
 		$header = Array('0'=>'#','1'=>$mod_strings['LBL_TIME'],'2'=>$mod_strings['LBL_LIST_DUE_DATE'],
-				'3'=>$mod_strings['LBL_TODO'],'4'=>$mod_strings['LBL_RELATEDTO'],'5'=>$mod_strings['LBL_CONTACT_NAME'],'6'=>$mod_strings['LBL_STATUS']);
-				if(isPermitted("Calendar","EditView") == "yes" || isPermitted("Calendar","Delete") == "yes")
-	                        {
-				array_push($header,$mod_strings['LBL_ACTION']);
-				}
-				array_push($header,$mod_strings['LBL_ASSINGEDTO']);
-		$header_width = Array('0'=>'5%','1'=>'10%','2'=>'10%','3'=>'38%','4'=>'15%','5'=>'15%','6'=>'10%',);
-				if(isPermitted("Calendar","EditView") == "yes" || isPermitted("Calendar","Delete") == "yes")
-                                {
-                                array_push($header_width,'10%');
-                                }
-                                array_push($header_width,'15%');
+				'3'=>$mod_strings['LBL_TODO']);
+		$header_width = Array('0'=>'5%','1'=>'10%','2'=>'10%','3'=>'38%',);		
+		if(getFieldVisibilityPermission('Calendar',$current_user->id,'parent_id') == '0')
+		{
+			array_push($header,$mod_strings['LBL_RELATEDTO']);
+			array_push($header_width,'15%');
+		}
+		if(getFieldVisibilityPermission('Calendar',$current_user->id,'contact_id') == '0')
+		{
+			array_push($header,$mod_strings['LBL_CONTACT_NAME']);
+			array_push($header_width,'15%');
+		}
+		if(getFieldVisibilityPermission('Calendar',$current_user->id,'taskstatus') == '0')
+		{
+			array_push($header,$mod_strings['LBL_STATUS']);
+			array_push($header_width,'10%');
+		}
+
+		if(isPermitted("Calendar","EditView") == "yes" || isPermitted("Calendar","Delete") == "yes")
+		{
+			array_push($header,$mod_strings['LBL_ACTION']);
+			array_push($header_width,'10%');
+		}
+		array_push($header,$mod_strings['LBL_ASSINGEDTO']);
+		array_push($header_width,'15%');
 	}
 	else
 	{
@@ -1647,31 +1679,36 @@
                         '1'=>$mod_strings['LBL_TIME'],
 			'2'=>$mod_strings['LBL_START_DATE'],
 			'3'=>$mod_strings['LBL_DUE_DATE'],
-                        '4'=>$mod_strings['LBL_TODO'],
-			'5'=>$mod_strings['LBL_RELATEDTO'],
-			'6'=>$mod_strings['LBL_CONTACT_NAME'],
-			'7'=>$mod_strings['LBL_STATUS'],
+                        '4'=>$mod_strings['LBL_TODO']
 			);
-			if(isPermitted("Calendar","EditView") == "yes" || isPermitted("Calendar","Delete") == "yes")
-			{
-                        	array_push($header,$mod_strings['LBL_ACTION']);
-			}
-			array_push($header,$mod_strings['LBL_ASSINGEDTO']);
-        	$header_width = Array('0'=>'5%',
-                              '1'=>'10%',
-                              '2'=>'10%',
-                              '3'=>'10%',
-                              '4'=>'28%',
-                              '5'=>'15%',
-                              '6'=>'15%',
-			      '7'=>'10%',	
-			       );
-			if(isPermitted("Calendar","EditView") == "yes" || isPermitted("Calendar","Delete") == "yes")
-                        {
-                        array_push($header_width,'10%');
-                        }
+		$header_width = Array('0'=>'5%',
+			'1'=>'10%',
+			'2'=>'10%',
+			'3'=>'10%',
+			'4'=>'28%'
+			);
+		if(getFieldVisibilityPermission('Calendar',$current_user->id,'parent_id') == '0')
+		{
+			array_push($header,$mod_strings['LBL_RELATEDTO']);
 			array_push($header_width,'15%');
-	
+		}
+		if(getFieldVisibilityPermission('Calendar',$current_user->id,'contact_id') == '0')
+		{
+			array_push($header,$mod_strings['LBL_CONTACT_NAME']);
+			array_push($header_width,'15%');
+		}
+		if(getFieldVisibilityPermission('Calendar',$current_user->id,'taskstatus') == '0')
+		{
+			array_push($header,$mod_strings['LBL_STATUS']);
+			array_push($header_width,'10%');
+		}
+		if(isPermitted("Calendar","EditView") == "yes" || isPermitted("Calendar","Delete") == "yes")
+		{
+			array_push($header,$mod_strings['LBL_ACTION']);
+		}
+		array_push($header,$mod_strings['LBL_ASSINGEDTO']);
+		array_push($header_width,'15%');
+		
 	}
 	$list_view .="<table align='center' border='0' cellpadding='5' cellspacing='0' width='98%'>
 			<tr><td colspan='3'>&nbsp;</td></tr>";





More information about the vtigercrm-commits mailing list