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

SVN:trunk[4100]
This commit is contained in:
Denis Flaven
2016-05-17 19:01:22 +00:00
parent d9a5b85c67
commit 3b38388c73

View File

@@ -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));