Browse Source

Allow to log entries on behalf of another user

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1693 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 13 năm trước cách đây
mục cha
commit
c78be5f204
1 tập tin đã thay đổi với 13 bổ sung4 xóa
  1. 13 4
      core/ormcaselog.class.inc.php

+ 13 - 4
core/ormcaselog.class.inc.php

@@ -153,16 +153,25 @@ class ormCaseLog {
 	 * Add a new entry to the log and updates the internal index
 	 * @param $sText string The text of the new entry 
 	 */
-	public function AddLogEntry($sText)
+	public function AddLogEntry($sText, $sOnBehalfOf = '')
 	{
 		$sDate = date(Dict::S('UI:CaseLog:DateFormat'));
-		$sSeparator = sprintf(CASELOG_SEPARATOR, $sDate, UserRights::GetUserFriendlyName(), UserRights::GetUserId());
+		if ($sOnBehalfOf == '')
+		{
+			$sOnBehalfOf = UserRights::GetUserFriendlyName();
+			$iUserId = UserRights::GetUserId();
+		}
+		else
+		{
+			$iUserId = null;
+		}
+		$sSeparator = sprintf(CASELOG_SEPARATOR, $sDate, $sOnBehalfOf, $iUserId);
 		$iSepLength = strlen($sSeparator);
 		$iTextlength = strlen($sText);
 		$this->m_sLog = $sSeparator.$sText.$this->m_sLog; // Latest entry printed first
 		$this->m_aIndex[] = array(
-			'user_name' => UserRights::GetUserFriendlyName(),	
-			'user_id' => UserRights::GetUserId(),	
+			'user_name' => $sOnBehalfOf,	
+			'user_id' => $iUserId,	
 			'date' => time(),	
 			'text_length' => $iTextlength,	
 			'separator_length' => $iSepLength,