From 4d716e74bd328aca961dd4cc75098d9c0180ef21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 28 Oct 2020 19:06:45 +0100 Subject: [PATCH] Mutualise code, introduce MAIN_ALL_TOWN_TO_UPPER --- htdocs/core/class/commonobject.class.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 04b7d4985cd..294e605125e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -569,6 +569,28 @@ abstract class CommonObject return dol_trunc($ret, $maxlen); } + /** + * Set to upper or ucwords/lower if needed + * + * @return void; + */ + public function setUpperOrLowerCase() + { + global $conf; + if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) { + $this->lastname = dol_ucwords(dol_strtolower($this->lastname)); + $this->firstname = dol_ucwords(dol_strtolower($this->firstname)); + $this->name = dol_ucwords(dol_strtolower($this->name)); + } + if (!empty($conf->global->MAIN_ALL_TO_UPPER)) { + $this->lastname = dol_strtoupper($this->lastname); + $this->name = dol_strtoupper($this->name); + } + if (!empty($conf->global->MAIN_ALL_TOWN_TO_UPPER)) { + $this->town = dol_strtoupper($this->town); + } + } + /** * Return clicable link of object (with eventually picto) *