mirror of
https://github.com/Combodo/iTop.git
synced 2026-08-30 09:58:17 +02:00
N°3552 Correctly display case log entry with no iTop user linked (such as mail to ticket entries)
This commit is contained in:
@@ -83,7 +83,8 @@ class ActivityEntryFactory
|
|||||||
DateTime::createFromFormat(AttributeDateTime::GetInternalFormat(), $aOrmEntry['date']),
|
DateTime::createFromFormat(AttributeDateTime::GetInternalFormat(), $aOrmEntry['date']),
|
||||||
$sUserLogin,
|
$sUserLogin,
|
||||||
$sAttCode,
|
$sAttCode,
|
||||||
$aOrmEntry['message_html']
|
$aOrmEntry['message_html'],
|
||||||
|
$aOrmEntry['user_login']
|
||||||
);
|
);
|
||||||
|
|
||||||
return $oEntry;
|
return $oEntry;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ namespace Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\ActivityEntry;
|
|||||||
|
|
||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
|
use utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CaseLogEntry
|
* Class CaseLogEntry
|
||||||
@@ -45,27 +46,58 @@ class CaseLogEntry extends ActivityEntry
|
|||||||
/** @var string $sAttCode Code of the corresponding case log attribute */
|
/** @var string $sAttCode Code of the corresponding case log attribute */
|
||||||
protected $sAttCode;
|
protected $sAttCode;
|
||||||
/** @var int $iCaseLogRank Rank of its case log in the host panel, can be used for highlight purposes for example */
|
/** @var int $iCaseLogRank Rank of its case log in the host panel, can be used for highlight purposes for example */
|
||||||
protected $iCaseLogRank;
|
protected $iCaseLogRank;
|
||||||
|
/** @var string $sAuthorName Fallback name used if $sAuthorLogin is empty */
|
||||||
|
protected $sAuthorName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CaseLogEntry constructor.
|
* CaseLogEntry constructor.
|
||||||
*
|
*
|
||||||
* @param \DateTime $oDateTime
|
* @param \DateTime $oDateTime
|
||||||
* @param \User $sAuthorLogin
|
* @param string $sAuthorLogin
|
||||||
* @param string $sAttCode
|
* @param string $sAttCode
|
||||||
* @param string $sContent
|
* @param string $sContent
|
||||||
|
* @param string $sAuthorName
|
||||||
* @param string|null $sId
|
* @param string|null $sId
|
||||||
*
|
*
|
||||||
* @throws \OQLException
|
* @throws \OQLException
|
||||||
*/
|
*/
|
||||||
public function __construct(DateTime $oDateTime, string $sAuthorLogin, string $sAttCode, string $sContent, ?string $sId = null)
|
public function __construct(DateTime $oDateTime, string $sAuthorLogin, string $sAttCode, string $sContent, string $sAuthorName, ?string $sId = null)
|
||||||
{
|
{
|
||||||
|
$this->sAuthorName = $sAuthorName;
|
||||||
parent::__construct($oDateTime, $sAuthorLogin, $sContent, $sId);
|
parent::__construct($oDateTime, $sAuthorLogin, $sContent, $sId);
|
||||||
|
|
||||||
$this->sAttCode = $sAttCode;
|
$this->sAttCode = $sAttCode;
|
||||||
$this->SetCaseLogRank(static::DEFAULT_CASELOG_RANK);
|
$this->SetCaseLogRank(static::DEFAULT_CASELOG_RANK);
|
||||||
$this->SetOrigin('caselog:'.$this->sAttCode);
|
$this->SetOrigin('caselog:'.$this->sAttCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the author and its information based on the $sAuthorLogin using parent call
|
||||||
|
* If no parent call found no matching User, fallback on caselog author name and display it as foreign message
|
||||||
|
*
|
||||||
|
* @param string $sAuthorLogin
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
* @throws \OQLException
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
|
public function SetAuthor(string $sAuthorLogin)
|
||||||
|
{
|
||||||
|
parent::SetAuthor($sAuthorLogin);
|
||||||
|
|
||||||
|
// If no User was found in parent call
|
||||||
|
if($this->sAuthorLogin === '') {
|
||||||
|
// Use caselog user_login info as friendlyname and compute its initials
|
||||||
|
$this->sAuthorFriendlyname = $this->sAuthorName;
|
||||||
|
$this->sAuthorInitials = utils::ToAcronym($this->sAuthorFriendlyname);
|
||||||
|
|
||||||
|
// Reset Picture as we probably have default image
|
||||||
|
$this->sAuthorPictureAbsUrl = null;
|
||||||
|
// Reset bIsFromCurrentUser as UserRights often consider '' login as current user login
|
||||||
|
$this->bIsFromCurrentUser = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the code of the corresponding case log attribute
|
* Return the code of the corresponding case log attribute
|
||||||
|
|||||||
Reference in New Issue
Block a user