From 89e1141bd56d565c39e8b70c79cc173364a57c15 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Mon, 15 Nov 2021 10:04:50 +0100 Subject: [PATCH] Bug 5527: Tax Type not displayed during initial setup if default Sales and/or Purchase Tax account deleted. Fixed by @bradlanier. --- taxes/db/tax_types_db.inc | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/taxes/db/tax_types_db.inc b/taxes/db/tax_types_db.inc index b927bb05..ae2cb017 100644 --- a/taxes/db/tax_types_db.inc +++ b/taxes/db/tax_types_db.inc @@ -34,11 +34,9 @@ function get_all_tax_types($all=false) $sql = "SELECT tax_type.*, Chart1.account_name AS SalesAccountName, Chart2.account_name AS PurchasingAccountName - FROM ".TB_PREF."tax_types tax_type," - .TB_PREF."chart_master AS Chart1," - .TB_PREF."chart_master AS Chart2 - WHERE tax_type.sales_gl_code = Chart1.account_code - AND tax_type.purchasing_gl_code = Chart2.account_code"; + FROM ".TB_PREF."tax_types tax_type LEFT JOIN " + .TB_PREF."chart_master AS Chart1 ON tax_type.sales_gl_code = Chart1.account_code LEFT JOIN " + .TB_PREF."chart_master AS Chart2 ON tax_type.purchasing_gl_code = Chart2.account_code"; if (!$all) $sql .= " AND !tax_type.inactive"; return db_query($sql, "could not get all tax types"); @@ -56,11 +54,10 @@ function get_tax_type($type_id) $sql = "SELECT tax_type.*, Chart1.account_name AS SalesAccountName, Chart2.account_name AS PurchasingAccountName - FROM ".TB_PREF."tax_types tax_type," - .TB_PREF."chart_master AS Chart1," - .TB_PREF."chart_master AS Chart2 - WHERE tax_type.sales_gl_code = Chart1.account_code - AND tax_type.purchasing_gl_code = Chart2.account_code AND id=".db_escape($type_id); + FROM ".TB_PREF."tax_types tax_type LEFT JOIN " + .TB_PREF."chart_master AS Chart1 ON tax_type.sales_gl_code = Chart1.account_code LEFT JOIN " + .TB_PREF."chart_master AS Chart2 ON tax_type.purchasing_gl_code = Chart2.account_code + WHERE id=".db_escape($type_id); $result = db_query($sql, "could not get tax type"); return db_fetch($result); -- 2.30.2