diff --git a/include/utils/InventoryUtils.php b/include/utils/InventoryUtils.php index 3935c1a589765fa78c71598d6fa7cb5ed40f0e3d..223bce80a16dacb34084327d793646265c846fcc 100644 --- a/include/utils/InventoryUtils.php +++ b/include/utils/InventoryUtils.php @@ -978,14 +978,16 @@ function getInventorySHTaxPercent($id, $taxname, $taxnum=null) $res = $adb->pquery("select $taxname from vtiger_inventoryshippingrel where id= ?", array($id)); $taxpercentage = $adb->query_result($res,0,$taxname); - //To get the values from the vtiger_inventorychargesrel where the actual shiiping and handling tax info of particular record stored. + // If shipping details is not found then try to get the values from the vtiger_inventorychargesrel + // where the actual shipping and handling tax info of particular record stored. if($adb->num_rows($res) < 1){ $j=$taxnum+1; + // parse through the json detail and extract the value of specific tax. $charges_result = $adb->pquery( "SELECT JSON_UNQUOTE(JSON_EXTRACT(charges, CONCAT('$.\"1\".taxes.\"', ? ,'\"'))) as charges FROM vtiger_inventorychargesrel WHERE recordid = ?", - array($j, $id) + array($taxnum + 1, $id) ); $rowData = $adb->fetch_array($charges_result); $charges = Zend_Json::decode(html_entity_decode($rowData['charges']));