fix user details in form fields

Signed-off-by: Maurice Preuß (envoyr) <envoyr@froxlor.org>
This commit is contained in:
Maurice Preuß (envoyr)
2022-12-25 20:42:34 +01:00
parent 746d30c65b
commit 6bf0396c76
2 changed files with 7 additions and 3 deletions

View File

@@ -42,7 +42,7 @@ class Text
public static function customerfullname(array $attributes): string public static function customerfullname(array $attributes): string
{ {
return User::getCorrectFullUserDetails($attributes['fields']); return User::getCorrectFullUserDetails($attributes['fields'], true);
} }
public static function size(array $attributes): string public static function size(array $attributes): string

View File

@@ -38,7 +38,7 @@ class User
* *
* @author Florian Lippert <flo@syscp.org> (2003-2009) * @author Florian Lippert <flo@syscp.org> (2003-2009)
*/ */
public static function getCorrectFullUserDetails($userinfo) public static function getCorrectFullUserDetails($userinfo, $html = false): string
{ {
$returnval = ''; $returnval = '';
@@ -47,7 +47,11 @@ class User
$returnval = $userinfo['name'] . ', ' . $userinfo['firstname']; $returnval = $userinfo['name'] . ', ' . $userinfo['firstname'];
} else { } else {
if ($userinfo['name'] != '' && $userinfo['firstname'] != '') { if ($userinfo['name'] != '' && $userinfo['firstname'] != '') {
if ($html) {
$returnval = $userinfo['name'] . ', ' . $userinfo['firstname'] . '<br><small>' . $userinfo['company'] . '</small>'; $returnval = $userinfo['name'] . ', ' . $userinfo['firstname'] . '<br><small>' . $userinfo['company'] . '</small>';
} else {
$returnval = $userinfo['name'] . ', ' . $userinfo['firstname'] . ', ' . $userinfo['company'];
}
} else { } else {
$returnval = $userinfo['company']; $returnval = $userinfo['company'];
} }