[Vtigercrm-commits] [vtiger-commits] r7426 - /vtigercrm/trunk/modules/Home/index.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Thu Jun 22 07:06:29 EDT 2006


Author: saraj
Date: Thu Jun 22 05:06:24 2006
New Revision: 7426

Log:
My group allocation - display fixed

Modified:
    vtigercrm/trunk/modules/Home/index.php

Modified: vtigercrm/trunk/modules/Home/index.php
==============================================================================
--- vtigercrm/trunk/modules/Home/index.php (original)
+++ vtigercrm/trunk/modules/Home/index.php Thu Jun 22 05:06:24 2006
@@ -57,6 +57,7 @@
 	$home_section_order = array("ALVT","PLVT","QLTQ","CVLVT","HLT","OLV","GRT","OLTSO","ILTI");
 }
 
+require('user_privileges/user_privileges_'.$current_user->id.'.php');
 foreach ( explode(",",$home_section_order) as $section )
 {
 	switch( $section )
@@ -102,7 +103,7 @@
 	{
 		$home_values['Activities']=getGroupTaskLists();	   
 	}
-   			break;
+   		break;
         case 'HLT':
         if(isPermitted('HelpDesk','index') == "yes")
         {
@@ -140,7 +141,7 @@
 function getActivityType($id)
 {
 	global $adb;
-	$quer = "select vtiger_activitytype from vtiger_activity where vtiger_activityid=".$id;
+	$quer = "select activitytype from vtiger_activity where activityid=".$id;
 	$res = $adb->query($quer);
 	$acti_type = $adb->query_result($res,0,"activitytype");
 	return $acti_type;
@@ -210,17 +211,28 @@
 	$groupids = fetchUserGroupids($userid);
 	if($groupids !='')
 	{
-		//code modified to list the vtiger_groups associates to a user om 21-11-05
-		//Get the leads assigned to group
-		$query = "select vtiger_leaddetails.leadid as id,vtiger_leaddetails.lastname as name,vtiger_leadgrouprelation.groupname as groupname, 'Leads     ' as Type from vtiger_leaddetails inner join vtiger_leadgrouprelation on vtiger_leaddetails.leadid=vtiger_leadgrouprelation.leadid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_leaddetails.leadid inner join vtiger_groups on vtiger_leadgrouprelation.groupname=vtiger_groups.groupname where  vtiger_crmentity.deleted=0  and vtiger_leadgrouprelation.groupname is not null and vtiger_groups.groupid in (".$groupids.")";
-		$query .= " union all ";
-		//Get the activities assigned to group
-		$query .= "select vtiger_activity.activityid id,vtiger_activity.subject,vtiger_activitygrouprelation.groupname,'Activities' as Type from vtiger_activity inner join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_activity.activityid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_activity.activityid inner join vtiger_groups on vtiger_activitygrouprelation.groupname=vtiger_groups.groupname where  vtiger_crmentity.deleted=0 and ((vtiger_activity.eventstatus !='held'and (vtiger_activity.status is null or vtiger_activity.status ='')) or (vtiger_activity.status !='completed' and (vtiger_activity.eventstatus is null or vtiger_activity.eventstatus=''))) and vtiger_activitygrouprelation.groupname is not null and vtiger_groups.groupid in (".$groupids.")";
-		$query .= " union all ";
-		//Get the tickets assigned to group (status not Closed -- hardcoded value)
-		$query .= "select vtiger_troubletickets.ticketid,vtiger_troubletickets.title,vtiger_ticketgrouprelation.groupname,'Tickets   ' as Type from vtiger_troubletickets inner join vtiger_ticketgrouprelation on vtiger_ticketgrouprelation.ticketid=vtiger_troubletickets.ticketid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_troubletickets.ticketid inner join vtiger_groups on vtiger_ticketgrouprelation.groupname=vtiger_groups.groupname where vtiger_crmentity.deleted=0 and vtiger_troubletickets.status != 'Closed' and vtiger_ticketgrouprelation.groupname is not null and vtiger_groups.groupid in (".$groupids.")";
-
-
+		$query = '';
+		if(isPermitted('Leads','index') == "yes")
+        	{
+			//code modified to list the vtiger_groups associates to a user om 21-11-05
+			//Get the leads assigned to group
+			$query = "select vtiger_leaddetails.leadid as id,vtiger_leaddetails.lastname as name,vtiger_leadgrouprelation.groupname as groupname, 'Leads     ' as Type from vtiger_leaddetails inner join vtiger_leadgrouprelation on vtiger_leaddetails.leadid=vtiger_leadgrouprelation.leadid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_leaddetails.leadid inner join vtiger_groups on vtiger_leadgrouprelation.groupname=vtiger_groups.groupname where  vtiger_crmentity.deleted=0  and vtiger_leadgrouprelation.groupname is not null and vtiger_groups.groupid in (".$groupids.")";
+		}
+		if(isPermitted('Activities','index') == "yes")
+        	{
+			if($query !='')
+			$query .= " union all ";
+			//Get the activities assigned to group
+			$query .= "select vtiger_activity.activityid id,vtiger_activity.subject,vtiger_activitygrouprelation.groupname,'Activities' as Type from vtiger_activity inner join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_activity.activityid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_activity.activityid inner join vtiger_groups on vtiger_activitygrouprelation.groupname=vtiger_groups.groupname where  vtiger_crmentity.deleted=0 and ((vtiger_activity.eventstatus !='held'and (vtiger_activity.status is null or vtiger_activity.status ='')) or (vtiger_activity.status !='completed' and (vtiger_activity.eventstatus is null or vtiger_activity.eventstatus=''))) and vtiger_activitygrouprelation.groupname is not null and vtiger_groups.groupid in (".$groupids.")";
+		}
+		if(isPermitted('HelpDesk','index') == "yes")
+                {
+			if($query !='')
+			$query .= " union all ";
+			//Get the tickets assigned to group (status not Closed -- hardcoded value)
+			$query .= "select vtiger_troubletickets.ticketid,vtiger_troubletickets.title,vtiger_ticketgrouprelation.groupname,'Tickets   ' as Type from vtiger_troubletickets inner join vtiger_ticketgrouprelation on vtiger_ticketgrouprelation.ticketid=vtiger_troubletickets.ticketid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_troubletickets.ticketid inner join vtiger_groups on vtiger_ticketgrouprelation.groupname=vtiger_groups.groupname where vtiger_crmentity.deleted=0 and vtiger_troubletickets.status != 'Closed' and vtiger_ticketgrouprelation.groupname is not null and vtiger_groups.groupid in (".$groupids.")";
+
+		}
 		$log->info("Here is the where clause for the list view: $query");
 		$result = $adb->limitquery($query,0,5) or die("Couldn't get the group listing");
 
@@ -245,6 +257,7 @@
 				if($row["type"] == "Tickets")
 				{	
 					$list = '<a href=index.php?module=HelpDesk';
+					$list .= '&action=DetailView&record='.$row["id"].'>'.$row["subject"].'</a>';
 				}
 				elseif($row["type"] == "Activities")
 				{
@@ -258,13 +271,14 @@
 					{
 						$list .= '&activity_mode=Events';
 					}
+					$list .= '&action=DetailView&record='.$row["id"].'>'.$row["subject"].'</a>';
 				}
 				else
 				{
 					$list = '<a href=index.php?module='.$row["type"];
+					$list .= '&action=DetailView&record='.$row["id"].'>'.$row["name"].'</a>';
 				}
 
-				$list .= '&action=DetailView&record='.$row["id"].'>'.$row["name"].'</a>';
 				$value[]=$list;	
 				$value[]= $row["groupname"];
 				$value[]= $row["type"];





More information about the vtigercrm-commits mailing list