[Vtigercrm-commits] [vtiger-commits] r9604 - in /vtigercrm/branches/5.0.1: Smarty/templates/ modules/PriceBooks/ modules/Products/

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Mon Oct 9 08:21:41 EDT 2006


Author: richie
Date: Mon Oct  9 06:21:32 2006
New Revision: 9604

Log:
* Modified to fix the issue 2110

Modified:
    vtigercrm/branches/5.0.1/Smarty/templates/AddProductToPriceBooks.tpl
    vtigercrm/branches/5.0.1/Smarty/templates/AddProductsToPriceBook.tpl
    vtigercrm/branches/5.0.1/modules/PriceBooks/PriceBook.js
    vtigercrm/branches/5.0.1/modules/Products/AddProductToPriceBooks.php
    vtigercrm/branches/5.0.1/modules/Products/AddProductsToPriceBook.php
    vtigercrm/branches/5.0.1/modules/Products/Product.js

Modified: vtigercrm/branches/5.0.1/Smarty/templates/AddProductToPriceBooks.tpl
==============================================================================
--- vtigercrm/branches/5.0.1/Smarty/templates/AddProductToPriceBooks.tpl (original)
+++ vtigercrm/branches/5.0.1/Smarty/templates/AddProductToPriceBooks.tpl Mon Oct  9 06:21:32 2006
@@ -108,11 +108,18 @@
 {ldelim}
         var fieldname_array = new Array({$FIELD_NAME_ARRAY});
         var unitprice,fieldname;
+	var id;
+	var fieldinfo;
+	var checkid;
 
         for(j=0; j<fieldname_array.length; j++)
         {ldelim}
+		fieldinfo = fieldname_array[j].split("_");
+		id = fieldinfo[0];
+		checkid = "check_"+id;
+
                 fieldname=fieldname_array[j];
-                updateListPrice(unitprice,fieldname);
+                updateListPrice(unitprice,fieldname,document.getElementById(checkid));
         {rdelim}
 {rdelim}
 

Modified: vtigercrm/branches/5.0.1/Smarty/templates/AddProductsToPriceBook.tpl
==============================================================================
--- vtigercrm/branches/5.0.1/Smarty/templates/AddProductsToPriceBook.tpl (original)
+++ vtigercrm/branches/5.0.1/Smarty/templates/AddProductsToPriceBook.tpl Mon Oct  9 06:21:32 2006
@@ -17,11 +17,19 @@
 
 	var n=unitprice_array.length;	
 	var unitprice,fieldname;
+	var id;
+	var fieldinfo;
+	var checkid;
+
 	for(j=0; j<unitprice_array.length; j++)
 	{ldelim}
+		fieldinfo = fieldname_array[j].split("_");
+		id = fieldinfo[0];
+		checkid = "check_"+id;
+
 		unitprice=unitprice_array[j];
 		fieldname=fieldname_array[j];	
-		updateListPrice(unitprice,fieldname);
+		updateListPrice(unitprice,fieldname,document.getElementById(checkid));
 	{rdelim}
 {rdelim}
 

Modified: vtigercrm/branches/5.0.1/modules/PriceBooks/PriceBook.js
==============================================================================
--- vtigercrm/branches/5.0.1/modules/PriceBooks/PriceBook.js (original)
+++ vtigercrm/branches/5.0.1/modules/PriceBooks/PriceBook.js Mon Oct  9 06:21:32 2006
@@ -103,16 +103,15 @@
 document.addToPB.action="index.php?module=Products&action=addPbProductRelToDB&return_module=Products&return_action=AddProductsToPriceBook"
 }
 
-function updateListPrice(unitprice,fieldname)
+function updateListPrice(unitprice,fieldname,oSelect)
 {
-	var elem=document.addToPB.elements;
-	var i;	
-	for(i=0; i<elem.length; i++)
+	if(oSelect.checked == true)
 	{
-		if(elem[i].name== fieldname)
-		{
-			elem[i].value=unitprice;	
-		}
+		document.getElementById(fieldname).style.visibility = 'visible';
+		document.getElementById(fieldname).value = unitprice;
+	}else
+	{
+		document.getElementById(fieldname).style.visibility = 'hidden';
 	}
 }
 

Modified: vtigercrm/branches/5.0.1/modules/Products/AddProductToPriceBooks.php
==============================================================================
--- vtigercrm/branches/5.0.1/modules/Products/AddProductToPriceBooks.php (original)
+++ vtigercrm/branches/5.0.1/modules/Products/AddProductToPriceBooks.php Mon Oct  9 06:21:32 2006
@@ -70,7 +70,7 @@
 
 $other_text = '
 	<table border="0" cellpadding="1" cellspacing="0" width="90%" align="center">
-	<form name="addToPB" method="POST">
+	<form name="addToPB" method="POST" id="addToPB">
 	   <tr>
 		<td align="center">&nbsp;
 			<input name="product_id" type="hidden" value="'.$productid.'">
@@ -113,13 +113,13 @@
 	{
 		$list_body .= '<tr class="lvtColData" onmouseover="this.className=\'lvtColDataHover\'" onmouseout="this.className=\'lvtColData\'" bgcolor="white">';
 		$field_name=$entity_id."_listprice";
-		$list_body .= '<td><INPUT type=checkbox NAME="selected_id" value= '.$entity_id.' onClick=\'toggleSelectAll(this.name,"selectall");updateListPrice("'.$unit_price.'","'.$field_name.'")\'></td>';
+		$list_body .= '<td><INPUT type=checkbox NAME="selected_id" id="check_'.$entity_id.'" value= '.$entity_id.' onClick=\'toggleSelectAll(this.name,"selectall");updateListPrice("'.$unit_price.'","'.$field_name.'",this)\'></td>';
 		$list_body .= '<td>'.$adb->query_result($list_result,$i,"bookname").'</td>';
 		$list_body .= '<td>'.$unit_price.'</td>';
-		$list_body .= '<td><input type="text" name="'.$field_name.'"></td>';
+		$list_body .= '<td><input type="text" name="'.$field_name.'" style="visibility:hidden;" id="'.$field_name.'"></td>';
 		$list_body .= '</tr>';
 	}
-	
+
 }
 
 

Modified: vtigercrm/branches/5.0.1/modules/Products/AddProductsToPriceBook.php
==============================================================================
--- vtigercrm/branches/5.0.1/modules/Products/AddProductsToPriceBook.php (original)
+++ vtigercrm/branches/5.0.1/modules/Products/AddProductsToPriceBook.php Mon Oct  9 06:21:32 2006
@@ -46,6 +46,8 @@
 {
         $list_query .= ' ORDER BY '.$order_by.' '.$sorder;
 }
+
+$list_query .= " group by vtiger_crmentity.crmid";
 $list_result = $adb->query($list_query);
 $num_rows = $adb->num_rows($list_result);
 
@@ -66,7 +68,7 @@
 //Buttons Add To PriceBook and Cancel
 $other_text = '
 	<table width="95%" border="0" cellpadding="1" cellspacing="0" align="center">
-	<form name="addToPB" method="POST">
+	<form name="addToPB" method="POST" id="addToPB">
 	   <tr>
 		<td align="center">&nbsp;
 			<input name="pricebook_id" type="hidden" value="'.$pricebook_id.'">
@@ -130,11 +132,11 @@
 		$unit_price = 	$adb->query_result($list_result,$i,"unit_price");
 		$field_name=$entity_id."_listprice";
 
-		$list_body .= '<td><INPUT type=checkbox NAME="selected_id" value= '.$entity_id.' onClick=\'toggleSelectAll(this.name,"selectall");updateListPrice("'.$unit_price.'","'.$field_name.'")\'></td>';
+		$list_body .= '<td><INPUT type=checkbox NAME="selected_id" id="check_'.$entity_id.'" value= '.$entity_id.' onClick=\'toggleSelectAll(this.name,"selectall");updateListPrice("'.$unit_price.'","'.$field_name.'",this)\'></td>';
 		$list_body .= '<td>'.$adb->query_result($list_result,$i,"productname").'</td>';
 		$list_body .= '<td>'.$adb->query_result($list_result,$i,"productcode").'</td>';
 		$list_body .= '<td>'.$unit_price.'</td>';
-		$list_body .= '<td><input type="text" name="'.$field_name.'"></td></tr>';
+		$list_body .= '<td><input type="text" name="'.$field_name.'" id="'.$field_name.'" style="visibility:hidden;"></td></tr>';
 	}
 }
 

Modified: vtigercrm/branches/5.0.1/modules/Products/Product.js
==============================================================================
--- vtigercrm/branches/5.0.1/modules/Products/Product.js (original)
+++ vtigercrm/branches/5.0.1/modules/Products/Product.js Mon Oct  9 06:21:32 2006
@@ -8,18 +8,16 @@
  *
  ********************************************************************************/
 document.write("<script type='text/javascript' src='modules/Products/multifile.js'></"+"script>");
-function updateListPrice(unitprice,fieldname)
+function updateListPrice(unitprice,fieldname, oSelect)
 {
-	var elem=document.addToPB.elements;
-        var i;
-        for(i=0; i<elem.length; i++)
-        {
-                if(elem[i].name== fieldname)
-                {
-                        elem[i].value=unitprice;
-                }
-        }
-
+	if(oSelect.checked == true)
+	{
+		document.getElementById(fieldname).style.visibility = 'visible';
+		document.getElementById(fieldname).value = unitprice;
+	}else
+	{
+		document.getElementById(fieldname).style.visibility = 'hidden';
+	}
 }
 
 function check4null(form)





More information about the vtigercrm-commits mailing list