From 02ba8810cfda87f7dbe1ab798350ff4cfd650e6e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Mar 2021 12:23:42 +0100 Subject: [PATCH] Better error message --- htdocs/core/class/html.formaccounting.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 53852955094..e6ada4d67c7 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -364,7 +364,7 @@ class FormAccounting extends Form $sql = "SELECT DISTINCT aa.account_number, aa.label, aa.labelshort, aa.rowid, aa.fk_pcg_version"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; - $sql .= " AND asy.rowid = ".$conf->global->CHARTOFACCOUNTS; + $sql .= " AND asy.rowid = ".((int) $conf->global->CHARTOFACCOUNTS); $sql .= " AND aa.active = 1"; $sql .= " AND aa.entity=".$conf->entity; $sql .= " ORDER BY aa.account_number"; @@ -380,7 +380,7 @@ class FormAccounting extends Form $num_rows = $this->db->num_rows($resql); - if ($num_rows == 0) { + if ($num_rows == 0 && (empty($conf->global->CHARTOFACCOUNTS) || $conf->global->CHARTOFACCOUNTS < 0)) { $langs->load("errors"); $showempty = $langs->trans("ErrorYouMustFirstSetupYourChartOfAccount"); } else {