CIVICRM-868: Hiding tax field on edit line item form if no tax collected.
Created by: agilewarealok
This PR is for Issue #14 (closed)
Issue
0.00 tax added for financial types with no tax account
Steps to reproduce:
- Turn on Tax & Invoicing then set up a financial type with no tax account - call this e.g. "No Tax calculation"
- Create a contribution with a single line item using "No Tax calculation" as the financial type.
- Check the line items using SQL - tax_amount is NULL - correct
- Edit the Contribution and change a line item
- Note that tax_amount is 0.00 on this form.
- Check the line items using SQL - tax_amount is 0.00 - this causes problems with the invoice template ("% GST" with no number) and also account syncing with Xero, which will receive the full amount as tax exclusive (due to 0.00 as a string not being "empty") and add tax on top for accounts tax instead of calculating the percentage of the given amount which is already tax.
Solution:
Instead of setting default value of tax_amount to 0.00 we set it to NULL, and adding only non-null value fields on edit line item form.