[Vtigercrm-commits] [vtiger-commits] r10323 - in /vtigercrm/branches/5.0.3/include: js/Inventory.js utils/ListViewUtils.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Fri Mar 2 04:18:53 EST 2007


Author: saraj
Date: Fri Mar  2 02:18:36 2007
New Revision: 10323

Log:
fix for Products not being listed against Accounts when Sales Order/Invoice created. Fixes #1262  --Minnie

Modified:
    vtigercrm/branches/5.0.3/include/js/Inventory.js
    vtigercrm/branches/5.0.3/include/utils/ListViewUtils.php

Modified: vtigercrm/branches/5.0.3/include/js/Inventory.js
==============================================================================
--- vtigercrm/branches/5.0.3/include/js/Inventory.js (original)
+++ vtigercrm/branches/5.0.3/include/js/Inventory.js Fri Mar  2 02:18:36 2007
@@ -59,8 +59,13 @@
 	popuptype = 'inventory_prod';
 	if(module == 'PurchaseOrder')
 		popuptype = 'inventory_prod_po';
-
-	window.open("index.php?module=Products&action=Popup&html=Popup_picker&form=HelpDeskEditView&popuptype="+popuptype+"&curr_row="+rowId,"productWin","width=640,height=565,resizable=0,scrollbars=0,status=1,top=150,left=200");
+	var record_id = ''
+        if(document.getElementsByName("account_id").length != 0)
+                record_id= document.EditView.account_id.value;
+        if(record_id != '')
+                window.open("index.php?module=Products&action=Popup&html=Popup_picker&form=HelpDeskEditView&popuptype="+popuptype+"&curr_row="+rowId+"&relmod_id="+record_id+"&parent_module=Accounts","productWin","width=640,height=565,resizable=0,scrollbars=0,status=1,top=150,left=200");
+        else
+		window.open("index.php?module=Products&action=Popup&html=Popup_picker&form=HelpDeskEditView&popuptype="+popuptype+"&curr_row="+rowId,"productWin","width=640,height=565,resizable=0,scrollbars=0,status=1,top=150,left=200");
 }
 
 function priceBookPickList(currObj, row_no) {

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 Fri Mar  2 02:18:36 2007
@@ -1780,7 +1780,7 @@
 				ON vtiger_crmentity.crmid = vtiger_products.productid
 			LEFT JOIN vtiger_productcf
 				ON vtiger_products.productid = vtiger_productcf.productid
-			WHERE vtiger_crmentity.deleted = 0";
+			WHERE vtiger_crmentity.deleted = 0 ".$where;
 			break;
 	Case "Notes":
 		$query = "SELECT vtiger_crmentity.crmid, vtiger_crmentity.modifiedtime,
@@ -2755,6 +2755,29 @@
 		}
 		
 	}
+	else if($current_module == "Products")
+	{
+		if($relmodule == 'Accounts')
+		{
+			$pro_query = "select productid from vtiger_seproductsrel where setype='Accounts' and crmid=".$relmod_recordid;
+			$pro_result = $result = $adb->query($pro_query);
+			$rows = $adb->num_rows($pro_result);
+			if($rows != 0)
+			{
+				$proids_comma = "(";
+				for($k=0; $k < $rows; $k++)
+				{
+					$product_ids = $adb->query_result($pro_result,$k,'productid');
+					$proids_comma .= $product_ids;
+					if($k < ($rows-1))
+						$proids_comma.=',';
+				}
+				$proids_comma.= ")";
+			}
+			if($proids_comma != '')
+				$condition ="and vtiger_products.productid in ".$proids_comma;
+		}
+	}
 	else if($current_module == 'Quotes')
 	{
 		if($relmodule == 'Accounts')





More information about the vtigercrm-commits mailing list