From 6facd01c484cbb84418ddcbb020a7fdcb02d5014 Mon Sep 17 00:00:00 2001 From: William Mead Date: Fri, 26 Jan 2024 08:49:08 +0100 Subject: [PATCH] Refactored isACompany method --- htdocs/societe/class/societe.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 6a232bb47f5..58485c3c15d 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3996,20 +3996,20 @@ class Societe extends CommonObject public function isACompany() { // Define if third party is treated as company (or not) when nature is unknown - $isACompany = !getDolGlobalString('MAIN_UNKNOWN_CUSTOMERS_ARE_COMPANIES') ? false : true; + $isACompany = getDolGlobalInt('MAIN_UNKNOWN_CUSTOMERS_ARE_COMPANIES'); if (!empty($this->tva_intra)) { - $isACompany = true; + $isACompany = 1; } elseif (!empty($this->idprof1) || !empty($this->idprof2) || !empty($this->idprof3) || !empty($this->idprof4) || !empty($this->idprof5) || !empty($this->idprof6)) { - $isACompany = true; + $isACompany = 1; } elseif (!empty($this->typent_code) && $this->typent_code != 'TE_UNKNOWN') { // TODO Add a field is_a_company into dictionary if (preg_match('/^TE_PRIVATE/', $this->typent_code)) { - $isACompany = false; + $isACompany = 0; } else { - $isACompany = true; + $isACompany = 1; } } - return $isACompany; + return boolval($isACompany); } /**