[Vtigercrm-commits] [vtiger-commits] r9706 - in /vtigercrm/branches/5.0.2: include/utils/InventoryUtils.php modules/SalesOrder/Save.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Thu Oct 26 08:48:21 EDT 2006


Author: richie
Date: Thu Oct 26 06:48:02 2006
New Revision: 9706

Log:
* Modified to avoid update quantity in stock when SO status becomes delivered, because when the SO converts into Invoice with status Paid then stock will be reduced again, Fixes #2397

Modified:
    vtigercrm/branches/5.0.2/include/utils/InventoryUtils.php
    vtigercrm/branches/5.0.2/modules/SalesOrder/Save.php

Modified: vtigercrm/branches/5.0.2/include/utils/InventoryUtils.php
==============================================================================
--- vtigercrm/branches/5.0.2/include/utils/InventoryUtils.php (original)
+++ vtigercrm/branches/5.0.2/include/utils/InventoryUtils.php Thu Oct 26 06:48:02 2006
@@ -469,7 +469,7 @@
  *	@param $update_prod_stock - true or false (default), if true we have to update the stock for PO only
  *	@return void
  */
-function saveInventoryProductDetails($focus, $module, $update_prod_stock='false', $updateStockAndDemand='false', $updateDemand='false')
+function saveInventoryProductDetails($focus, $module, $update_prod_stock='false', $updateDemand='')
 {
 	global $log, $adb;
 	$log->debug("Entering into function saveInventoryProductDetails($focus, $module).");
@@ -514,12 +514,11 @@
 		}
 		if($module == 'SalesOrder')
 		{
-			if($updateStockAndDemand == 'true')
+			if($updateDemand == '-')
 			{
-				deductFromProductStock($prod_id,$qty);
 				deductFromProductDemand($prod_id,$qty);
 			}
-			if($updateDemand == 'true')
+			elseif($updateDemand == '+')
 			{
 				addToProductDemand($prod_id,$qty);
 			}

Modified: vtigercrm/branches/5.0.2/modules/SalesOrder/Save.php
==============================================================================
--- vtigercrm/branches/5.0.2/modules/SalesOrder/Save.php (original)
+++ vtigercrm/branches/5.0.2/modules/SalesOrder/Save.php Thu Oct 26 06:48:02 2006
@@ -39,13 +39,13 @@
 	{
        		if($focus->column_fields['sostatus'] == 'Delivered')
         	{
-			//Deduct the quantity from Quantity In Stock and Quantity In Demand
-                	$updateStockAndDemand = 'true';
+			//Deduct the quantity from Quantity In Demand
+                	$updateDemand = '-';
 		}
 		elseif($focus->column_fields['sostatus'] == 'Approved')
 		{
 			//Add the quantity with Quantity In Demand
-			$updateDemand = 'true';
+			$updateDemand = '+';
 		}
         }
 
@@ -62,7 +62,7 @@
 }
 
 //Based on the total Number of rows we will save the product relationship with this entity
-saveInventoryProductDetails(&$focus, 'SalesOrder','',$updateStockAndDemand, $updateDemand);
+saveInventoryProductDetails(&$focus, 'SalesOrder','', $updateDemand);
 
 
 $return_id = $focus->id;





More information about the vtigercrm-commits mailing list