Browse Source

Support "recusrive placeholders" (i.e. $this->org_id->code$) inside notifications... when using the HTML notation (i.e. -> becomes ->)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4100 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 9 years ago
parent
commit
53e0da0c73
1 changed files with 3 additions and 3 deletions
  1. 3 3
      core/dbobject.class.php

+ 3 - 3
core/dbobject.class.php

@@ -2426,10 +2426,10 @@ abstract class DBObject implements iDisplay
 	public function GetForTemplate($sPlaceholderAttCode)
 	{
 		$ret = null;
-		if (($iPos = strpos($sPlaceholderAttCode, '->')) !== false)
+		if (preg_match('/^([^-]+)-(>|>)(.+)$/', $sPlaceholderAttCode, $aMatches)) // Support both syntaxes: this->xxx or this->xxx for HTML compatibility
 		{
-			$sExtKeyAttCode = substr($sPlaceholderAttCode, 0, $iPos);
-			$sRemoteAttCode = substr($sPlaceholderAttCode, $iPos + 2);
+			$sExtKeyAttCode = $aMatches[1];
+			$sRemoteAttCode = $aMatches[3];
 			if (!MetaModel::IsValidAttCode(get_class($this), $sExtKeyAttCode))
 			{
 				throw new CoreException("Unknown attribute '$sExtKeyAttCode' for the class ".get_class($this));