Topic: Entering invoice for tax exempt supplier results in db error?
I think it happened after I installed os updates with a mysql update on both Ubuntu 16 and 18, because it used to work fine, but I do muck with my core so maybe it is my own fault, but I couldn't see how I could have caused it. I will try to reproduce this on standard FA when I have a chance. If I can't, then I will delete this post.
Anyway, mysql failed on an insert to trans_tax_details because tax_type_id is blank and tax_type_id is defined as an integer in the table. It also didn't like rate set to null, which is defined as not null in the table.
I fixed the problem in my core:
+++ b/core/taxes/tax_calc.inc
@@ -161,7 +161,7 @@ function get_tax_for_items($items, $prices, $shipping_cost, $tax_group, $tax_inc
$ret_tax_array[$k]['Net'] = 0;
}
- $ret_tax_array['exempt'] = array('Value'=>0, 'Net'=>0, 'rate' => null, 'tax_type_id' => '', 'sales_gl_code' => '');
+ $ret_tax_array['exempt'] = array('Value'=>0, 'Net'=>0, 'rate' => 0, 'tax_type_id' => 0, 'sales_gl_code' => '');
$dec = user_price_dec();
// loop for all items
I wonder if this is some new feature of mysql and if there is some strictness configuration setting for it? If so, I am sure someone can enlighten me.