[Vtigercrm-developers] Inventory Record copying

Alan Lord alanslists at gmail.com
Tue Nov 7 09:16:52 GMT 2017


Thanks for that. I think I must already have this - I am developing an a 
new vt7 system.

But the ridiculous way I have to prevent line items being duplicated is 
just nuts. The save function in all Inventory module class files has 
this gem of code:

> 		} else if(isset($_REQUEST)) {
> 			if($_REQUEST['action'] != 'InvoiceAjax' && $_REQUEST['ajxaction'] != 'DETAILVIEW'
> 					&& $_REQUEST['action'] != 'MassEditSave' && $_REQUEST['action'] != 'ProcessDuplicates'
> 					&& $_REQUEST['action'] != 'SaveAjax' && $this->isLineItemUpdate != false && $_REQUEST['action'] != 'FROM_WS') {
> 				//Based on the total Number of rows we will save the product relationship with this entity
> 				saveInventoryProductDetails($this, 'Invoice');
> 			} else if($_REQUEST['action'] == 'InvoiceAjax' || $_REQUEST['action'] == 'MassEditSave' || $_REQUEST['action'] == 'FROM_WS') {
> 				$updateInventoryProductRel_deduct_stock = false;
> 			}
> 		}


Which means, even if you are triggering the save using the Server API 
from a Workflow, this code examines the current $_REQUEST super global 
and makes decisions based on its contents. As this is a save from a 
custom workflow function, the $_REQUEST should play no part in this 
whatsoever.

Al



On 07/11/17 08:04, Conrado Maggi wrote:
> Hello Alan,
> 
> Know your pain, the vtws_revise is broken for all inventory modules. 
> Maybe this will help you: 
> http://code.vtiger.com/vtiger/vtigercrm/issues/654 there is a commit in 
> there that is supposed to fix it.
> 





More information about the vtigercrm-developers mailing list