[Vtigercrm-commits] [vtiger-commits] r10034 - in /vtigercrm/branches/5.0.3: Smarty/templates/Inventory/ProductDetails.tpl Smarty/templates/Inventory/ProductDetailsEditView.tpl include/js/Inventory.js

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Wed Jan 10 08:18:56 EST 2007


Author: richie
Date: Wed Jan 10 06:18:49 2007
New Revision: 10034

Log:
* Modified to avoid calling the function FindDuplicate on product selection and will be called on save, where as now when we save the inventory, system will ask the user that whether save the duplicate products or not

Modified:
    vtigercrm/branches/5.0.3/Smarty/templates/Inventory/ProductDetails.tpl
    vtigercrm/branches/5.0.3/Smarty/templates/Inventory/ProductDetailsEditView.tpl
    vtigercrm/branches/5.0.3/include/js/Inventory.js

Modified: vtigercrm/branches/5.0.3/Smarty/templates/Inventory/ProductDetails.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/Inventory/ProductDetails.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/Inventory/ProductDetails.tpl Wed Jan 10 06:18:49 2007
@@ -170,7 +170,7 @@
 
 	<!-- column 4 - Quantity - starts -->
 	<td class="crmTableRow small lineOnTop">
-		<input id="qty1" name="qty1" type="text" class="small " style="width:50px" onfocus="this.className='detailedViewTextBoxOn'" onBlur="FindDuplicate(); settotalnoofrows(); calcTotal(); loadTaxes_Ajax(1);" onChange="setDiscount(this,'1')" value=""/>
+		<input id="qty1" name="qty1" type="text" class="small " style="width:50px" onfocus="this.className='detailedViewTextBoxOn'" onBlur="settotalnoofrows(); calcTotal(); loadTaxes_Ajax(1);" onChange="setDiscount(this,'1')" value=""/>
 	</td>
 	<!-- column 4 - Quantity - ends -->
 

Modified: vtigercrm/branches/5.0.3/Smarty/templates/Inventory/ProductDetailsEditView.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/Inventory/ProductDetailsEditView.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/Inventory/ProductDetailsEditView.tpl Wed Jan 10 06:18:49 2007
@@ -192,7 +192,7 @@
 
 	<!-- column 4 - Quantity - starts -->
 	<td class="crmTableRow small lineOnTop" valign="top">
-		<input id="{$qty}" name="{$qty}" type="text" class="small " style="width:50px" onfocus="this.className='detailedViewTextBoxOn'" onBlur="FindDuplicate(); settotalnoofrows(); calcTotal(); loadTaxes_Ajax('{$row_no}');" onChange="setDiscount(this,'{$row_no}')" value="{$data.$qty}"/>
+		<input id="{$qty}" name="{$qty}" type="text" class="small " style="width:50px" onfocus="this.className='detailedViewTextBoxOn'" onBlur="settotalnoofrows(); calcTotal(); loadTaxes_Ajax('{$row_no}');" onChange="setDiscount(this,'{$row_no}')" value="{$data.$qty}"/>
 	</td>
 	<!-- column 4 - Quantity - ends -->
 

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 Wed Jan 10 06:18:49 2007
@@ -294,12 +294,15 @@
 	var max_row_count = document.getElementById('proTab').rows.length;
         max_row_count = eval(max_row_count)-2;//As the table has two header rows, we will reduce two from row length
 
+	var duplicate = false, iposition = '', positions = '', duplicate_products = '';
+
 	var product_id = new Array(max_row_count-1);
 	var product_name = new Array(max_row_count-1);
 	product_id[1] = getObj("hdnProductId"+1).value;
 	product_name[1] = getObj("productName"+1).value;
 	for (var i=1;i<=max_row_count;i++)
 	{
+		iposition = ""+i;
 		for(var j=i+1;j<=max_row_count;j++)
 		{
 			if(i == 1)
@@ -308,10 +311,20 @@
 			}
 			if(product_id[i] == product_id[j] && product_id[i] != '')
 			{
-				alert("You have selected < "+getObj("productName"+j).value+" > more than once in line items  "+i+" & "+j+".\n It is advisable to select the product just once but change the Qty. Thank You");
-				//return false;
+				if(!duplicate) positions = iposition;
+				duplicate = true;
+				if(positions.search(j) == -1) positions = positions+" & "+j;
+
+				if(duplicate_products.search(getObj("productName"+j).value) == -1)
+					duplicate_products = duplicate_products+getObj("productName"+j).value+" \n";
 			}
 		}
+	}
+	if(duplicate)
+	{
+		//alert("You have selected < "+duplicate_products+" > more than once in line items  "+positions+".\n It is advisable to select the product just once but change the Qty. Thank You");
+		if(!confirm("You have selected  the following product(s) more than once. \n"+duplicate_products+"\n Do you want to Continue?"))
+			return false;
 	}
         return true;
 }
@@ -493,7 +506,7 @@
 	
 	//Quantity
 	colfour.className = "crmTableRow small"
-	colfour.innerHTML='<input id="qty'+count+'" name="qty'+count+'" type="text" class="small " style="width:50px" onfocus="this.className=\'detailedViewTextBoxOn\'" onBlur="FindDuplicate(); settotalnoofrows(); calcTotal(); loadTaxes_Ajax('+count+');" onChange="setDiscount(this,'+count+')" value=""/>';
+	colfour.innerHTML='<input id="qty'+count+'" name="qty'+count+'" type="text" class="small " style="width:50px" onfocus="this.className=\'detailedViewTextBoxOn\'" onBlur="settotalnoofrows(); calcTotal(); loadTaxes_Ajax('+count+');" onChange="setDiscount(this,'+count+')" value=""/>';
 	
 	//List Price with Discount, Total after Discount and Tax labels
 	colfive.className = "crmTableRow small"





More information about the vtigercrm-commits mailing list