From 5c3caa3f31986d237ef47e575e3af21e42e03f0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Lukas?= Date: Thu, 11 Apr 2024 20:51:50 +0200 Subject: [PATCH] Fix #29314 (#29315) * Fix #29314 Add method getFullName * Update conferenceorboothattendee.class.php --- .../class/conferenceorboothattendee.class.php | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index c0a7a713075..d35b2e1b577 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -1121,6 +1121,30 @@ class ConferenceOrBoothAttendee extends CommonObject return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables); } + + /** + * Return full name ('name+' '+lastname) + * + * @param Translate $langs Language object for translation of civility (used only if option is 1) + * @param int $option 0=No option + * @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname, 2=Firstname, 3=Firstname if defined else lastname, 4=Lastname, 5=Lastname if defined else firstname + * @param int $maxlen Maximum length + * @return string String with full name + */ + public function getFullName($langs, $option = 0, $nameorder = -1, $maxlen = 0) + { + $lastname = $this->lastname; + $firstname = $this->firstname; + if (empty($lastname)) { + $lastname = (isset($this->lastname) ? $this->lastname : (isset($this->name) ? $this->name : (isset($this->nom) ? $this->nom : (isset($this->societe) ? $this->societe : (isset($this->company) ? $this->company : ''))))); + } + + $ret = ''; + + $ret .= dolGetFirstLastname($firstname, $lastname, $nameorder); + + return dol_trunc($ret, $maxlen); + } }