N°2847 - ActivityPanel: Fix entry's author info for CMDBChangeOp

This commit is contained in:
Molkobain
2020-08-27 18:57:06 +02:00
parent d0ea3665be
commit 3add77308a
6 changed files with 77 additions and 30 deletions

View File

@@ -175,22 +175,12 @@ class CMDBChangeOpDelete extends CMDBChangeOp
}
}
/**
* Interface iCMDBChangeOpSetAttribute
*
* @since 2.8.0
*/
interface iCMDBChangeOpSetAttribute
{
}
/**
* Record the modification of an attribute (abstract)
*
* @package iTopORM
*/
class CMDBChangeOpSetAttribute extends CMDBChangeOp implements iCMDBChangeOpSetAttribute
class CMDBChangeOpSetAttribute extends CMDBChangeOp
{
/**
* @inheritDoc

View File

@@ -1291,7 +1291,20 @@ class UserRights
}
if (is_null($oUser))
{
return '';
$sInitials = '';
$aLoginParts = explode(' ', $sLogin);
foreach($aLoginParts as $sLoginPart)
{
// Keep only upper case first letters
// eg. "My first name My last name" => "MM"
// eg. "Carrie Anne Moss" => "CAM"
if(preg_match('/^\p{Lu}/u', $sLoginPart) > 0)
{
$sInitials .= mb_substr($sLoginPart, 0, 1);
}
}
return $sInitials;
}
return $oUser->GetInitials();
}