diff --git a/include/fields/InventoryLineField.php b/include/fields/InventoryLineField.php index 6800525855..185945dc7d 100644 --- a/include/fields/InventoryLineField.php +++ b/include/fields/InventoryLineField.php @@ -120,20 +120,22 @@ public function __construct($fieldname = '') { 'item discount amount' => InventoryLineField::$ILFieldsName['discount_amount'], 'item discount percent' => InventoryLineField::$ILFieldsName['discount_percent'], ); - $taxes = getAllTaxes('all'); - foreach ($taxes as $tax) { - $fieldlabel = strtolower($tax['taxlabel']); - InventoryLineField::$ILFieldsLabel[$fieldlabel] = array( - 'uitype' => 7, - 'fieldtype' => 'double', - 'fieldname' => $tax['taxname'], - 'columnname' => $tax['taxname'], - 'fieldlabel' => $tax['taxlabel'], - 'tablename' => 'vtiger_inventoryproductrel', - 'typeofdata'=>'N~O', - 'mandatory'=>'false', - ); - InventoryLineField::$ILFieldsName[$tax['taxname']] = InventoryLineField::$ILFieldsLabel[$fieldlabel]; + if (!cbEventHandler::do_filter('corebos.filter.TaxCalculation.isExternal', false)) { + $taxes = getAllTaxes('all'); + foreach ($taxes as $tax) { + $fieldlabel = strtolower($tax['taxlabel']); + InventoryLineField::$ILFieldsLabel[$fieldlabel] = array( + 'uitype' => 7, + 'fieldtype' => 'double', + 'fieldname' => $tax['taxname'], + 'columnname' => $tax['taxname'], + 'fieldlabel' => $tax['taxlabel'], + 'tablename' => 'vtiger_inventoryproductrel', + 'typeofdata'=>'N~O', + 'mandatory'=>'false', + ); + InventoryLineField::$ILFieldsName[$tax['taxname']] = InventoryLineField::$ILFieldsLabel[$fieldlabel]; + } } $this->fieldname = $fieldname; } diff --git a/include/utils/InventoryUtils.php b/include/utils/InventoryUtils.php index 42eeafac27..10517bf762 100644 --- a/include/utils/InventoryUtils.php +++ b/include/utils/InventoryUtils.php @@ -1272,6 +1272,10 @@ function getInventoryFieldsForExport($tableName) { $sql .= $fdesc['tablename'].'.'.$fdesc['columnname'].' AS "'.$fdesc['fieldlabel'].'",'; } $sql = rtrim($sql, ',').' '; + if (cbEventHandler::do_filter('corebos.filter.TaxCalculation.isExternal', false)) { + $taxSQLColumns = cbEventHandler::do_filter('corebos.filter.TaxCalculation.getTaxSQLColumns', $sql); + $sql .= ','.$taxSQLColumns; + } return $sql; }