cart icon indicating copy to clipboard operation
cart copied to clipboard

Tax class validity check wrong

Open stoppeye opened this issue 2 years ago • 0 comments

Bug Report

Current Behavior A tax class definition in TS with calc = 0 is not valid, while calc = 0.00 (like in tax class 3 of the default configuration) is regarded as valid. This behaviour is totally non-intuitive.

Expected behavior/output Since the calc value is eventually treated as float, both 0 and 0.00 should be equally valid.

Environment

  • TYPO3 version(s): 11.5.30
  • cart version: 8.6.1

Possible Solution In Extcode\Cart\Service\TaxClassService->isValidTaxClassConfig() a condition checks for empty($value['calc']), which returns TRUE for "0", but FALSE for "0.00". Replace this condition with $value['calc'] == ''.

Additional context The initial check in the condition is (empty($value) && !is_numeric($value)). Since $value is defined as array in the method signature, the is_numeric() check doesn't really make sense here.

stoppeye avatar Nov 13 '23 09:11 stoppeye