[Vtigercrm-commits] [vtiger-commits] r10910 - in /vtigercrm/branches/5.0.3: include/utils/ListViewUtils.php include/utils/SearchUtils.php modules/Dashboard/Entity_charts.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Mon May 14 08:31:23 EDT 2007


Author: richie
Date: Mon May 14 06:31:15 2007
New Revision: 10910

Log:
fix for Contacts By Campaign - Chart links display all contacts. Fixes #3786 --minnie

Modified:
    vtigercrm/branches/5.0.3/include/utils/ListViewUtils.php
    vtigercrm/branches/5.0.3/include/utils/SearchUtils.php
    vtigercrm/branches/5.0.3/modules/Dashboard/Entity_charts.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 Mon May 14 06:31:15 2007
@@ -1978,8 +1978,10 @@
 			LEFT JOIN vtiger_vendor
 				ON vtiger_vendor.vendorid = vtiger_products.vendor_id
 			LEFT JOIN vtiger_users
-				ON vtiger_users.id = vtiger_products.handler
-			WHERE vtiger_crmentity.deleted = 0 ".$where;
+				ON vtiger_users.id = vtiger_products.handler";
+		if(isset($_REQUEST["from_homepagedb"]) && $_REQUEST["from_homepagedb"] == true)
+                        $query .= " INNER JOIN vtiger_inventoryproductrel on vtiger_inventoryproductrel.productid = vtiger_products.productid";
+                $query .= " WHERE vtiger_crmentity.deleted = 0 ".$where;
 			break;
 	Case "Notes":
 		$query = "SELECT vtiger_crmentity.crmid, vtiger_crmentity.modifiedtime,
@@ -2049,8 +2051,10 @@
 			LEFT JOIN vtiger_users
 				ON vtiger_users.id = vtiger_crmentity.smownerid
 			LEFT JOIN vtiger_customerdetails
-				ON vtiger_customerdetails.customerid = vtiger_contactdetails.contactid
-			WHERE vtiger_crmentity.deleted = 0 ".$where;
+				ON vtiger_customerdetails.customerid = vtiger_contactdetails.contactid";
+		if(isset($_REQUEST["from_homepagedb"]) && $_REQUEST["from_homepagedb"] == true)
+                        $query .= " INNER JOIN vtiger_campaigncontrel on vtiger_campaigncontrel.contactid = vtiger_contactdetails.contactid";
+                $query .= " WHERE vtiger_crmentity.deleted = 0 ".$where;
 
 		if($is_admin==false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[$tab_id] == 3)
 		{

Modified: vtigercrm/branches/5.0.3/include/utils/SearchUtils.php
==============================================================================
--- vtigercrm/branches/5.0.3/include/utils/SearchUtils.php (original)
+++ vtigercrm/branches/5.0.3/include/utils/SearchUtils.php Mon May 14 06:31:15 2007
@@ -701,6 +701,10 @@
 	if (isset($_REQUEST['closingdate_start'])) $date_closed_start = $_REQUEST['closingdate_start'];
 	if (isset($_REQUEST['closingdate_end'])) $date_closed_end = $_REQUEST['closingdate_end'];
 	if(isset($_REQUEST['owner'])) $owner = $_REQUEST['owner'];
+	if(isset($_REQUEST['campaignid'])) $campaign = $_REQUEST['campaignid'];
+	if(isset($_REQUEST['quoteid'])) $quote = $_REQUEST['quoteid'];
+	if(isset($_REQUEST['invoiceid'])) $invoice = $_REQUEST['invoiceid'];
+	if(isset($_REQUEST['purchaseorderid'])) $po = $_REQUEST['purchaseorderid'];
 
 	if(isset($date_closed_start) && $date_closed_start != "" && isset($date_closed_end) && $date_closed_end != "")
 	{
@@ -730,6 +734,27 @@
 		array_push($where_clauses, "vtiger_crmentity.smownerid = ".$uid);
 		$url_string .= "&assigned_user_id=".$uid;
 	}
+	if(isset($campaign) && $campaign != "")
+	{
+		array_push($where_clauses, "vtiger_campaigncontrel.campaignid = ".$campaign);
+                $url_string .= "&campaignid=".$campaign;
+	}
+	if(isset($quote) && $quote != "")
+	{
+		array_push($where_clauses, "vtiger_inventoryproductrel.id = ".$quote);
+		$url_string .= "&quoteid=".$quote;
+	}
+	if(isset($invoice) && $invoice != "")
+	{
+		array_push($where_clauses, "vtiger_inventoryproductrel.id = ".$invoice);
+		$url_string .= "&invoiceid=".$invoice;
+	}
+	if(isset($po) && $po != "")
+	{
+		array_push($where_clauses, "vtiger_inventoryproductrel.id = ".$po);
+		$url_string .= "&purchaseorderid=".$po;
+	}
+
 	$where = "";
 	foreach($where_clauses as $clause)
 	{

Modified: vtigercrm/branches/5.0.3/modules/Dashboard/Entity_charts.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Dashboard/Entity_charts.php (original)
+++ vtigercrm/branches/5.0.3/modules/Dashboard/Entity_charts.php Mon May 14 06:31:15 2007
@@ -100,7 +100,7 @@
 			if($graph_for == "productname")
 			{
 				if($row['qtyinstock'] =='')
-					$mod_count_array[$mod_name] = 0;
+					$mod_count_array[$mod_name] = 1;
 				else
 					$mod_count_array[$mod_name]=$row['qtyinstock'];
 
@@ -143,6 +143,7 @@
 			for ($i=0;$i<count($mod_name_array); $i++)
 			{
 				$name=$mod_name_array[$i];
+				$id_name = "";
 				if($name=="")
 					$name="Un Assigned";
 
@@ -194,7 +195,6 @@
 				}
 
 				$mod_count_val=$mod_count_array[$name];
-
 				$tot_mod_cnt=array_sum($count_by_date[$name]);
 				$mod_cnt_table .= "<td align=center>$tot_mod_cnt</td></tr>";
 
@@ -223,6 +223,7 @@
 					$query = "SELECT subject FROM vtiger_purchaseorder WHERE purchaseorderid='".$name."'";
 					$result = $adb->query($query);
 					$name_val = $adb->query_result($result,0,"subject");
+					$id_name = $name;
 					if($name_val!="")
 						$name=$name_val;
 				}
@@ -231,6 +232,7 @@
 					$query = "SELECT subject FROM vtiger_quotes WHERE quoteid='".$name."'";
 					$result = $adb->query($query);
 					$name_val = $adb->query_result($result,0,"subject");
+					$id_name = $name;
 					if($name_val!="")
 						$name=$name_val;
 				}
@@ -239,6 +241,7 @@
 					$query = "SELECT subject FROM vtiger_invoice WHERE invoiceid='".$name."'";
 					$result = $adb->query($query);
 					$name_val = $adb->query_result($result,0,"subject");
+					$id_name = $name;
 					if($name_val!="")
 						$name=$name_val;
 				}
@@ -248,6 +251,7 @@
 					$query = "SELECT campaignname FROM vtiger_campaign WHERE campaignid='".$name."'";
 					$result = $adb->query($query);
 					$name_val = $adb->query_result($result,0,"campaignname");
+					$id_name = $name;
 					if($name_val!="")
 						$name=$name_val;
 				}
@@ -283,6 +287,8 @@
 					if($graph_for == "accountid") $graph_for = "account_id";
 					if($module == "Home")
 						$link_val="index.php?module=".$name."&action=ListView&from_homepagedb=true&type=dbrd&query=true&owner=".$current_user->user_name;
+					else if($module == "Contacts" || ($module=="Products" && ($graph_for == "quoteid" || $graph_for == "invoiceid" || $graph_for == "purchaseorderid")))
+						$link_val="index.php?module=".$module."&action=ListView&from_homepagedb=true&type=dbrd&query=true&".$graph_for."=".$id_name;
 					else
 						$link_val="index.php?module=".$module."&action=index&from_dashboard=true&search_text=".$name."&search_field=".$graph_for."&searchtype=BasicSearch&query=true&type=entchar";
 





More information about the vtigercrm-commits mailing list