Skip to content

Into Products and Services multi-currencies is not loaded and dropped on save

Into Products and Services multi-currencies is not loaded and dropped on save

  • set more than one currency in vtiger
  • edit a product (or service)
  • modify currencies values ('more currencies>>')
  • flag more than one Currency and set relative Price
  • set one of these as Base Currency
  • Save click and Save Product
  • Edit again same product (or service)
  • open 'more currencies>>'
  • only Base Currency is loaded

this behavior is trasparent if I modify product, I don't open 'more currencies>>' and I save: rows into vtiger_productcurrencyrel are dropped

my fix

  • file: include/utils/InventoryUtils.php
  • function: getPriceDetailsForProduct(...)
  • line: 936
  • commented if($is_basecurrency){

.

...
if ($cur_value == null || $cur_value == '') {
	$price_details[$i]['check_value'] = false;
	if	($unit_price != null) {
		$cur_value = CurrencyField::convertFromMasterCurrency($unit_price, $actual_conversion_rate);
	} else {
		$cur_value = '0';
	}
} else { //if($is_basecurrency){
	$price_details[$i]['check_value'] = true;
}
$price_details[$i]['curvalue'] = CurrencyField::convertToUserFormat($cur_value, null, true);
$price_details[$i]['conversionrate'] = $actual_conversion_rate;
$price_details[$i]['is_basecurrency'] = $is_basecurrency;
...

getPriceDetailsForProduct(...) function called in 'more currencies>>' and Price Books

I tested into Price Books too, and it's working fine

My testing was with 'Merge Request 93' merged on my vtiger installation (http://code.vtiger.com/vtiger/vtigercrm/merge_requests/93/diffs)