N°2564 - Stop copy after "<" character in a Copy operation on a Transition - change only in Copy function

This commit is contained in:
acognet
2020-04-14 16:58:08 +02:00
parent 3103f361a4
commit a77ba2fbab

View File

@@ -3851,7 +3851,32 @@ abstract class DBObject implements iDisplay
*/
public function Copy($sDestAttCode, $sSourceAttCode)
{
$this->Set($sDestAttCode, $this->Get($sSourceAttCode));
$oTypeValueToCopy = MetaModel::GetAttributeDef(get_class($this), $sSourceAttCode);
$oTypeValueDest = MetaModel::GetAttributeDef(get_class($this), $sDestAttCode);
if ($oTypeValueToCopy instanceof AttributeText && $oTypeValueDest instanceof AttributeText)
{
if ($oTypeValueToCopy->GetFormat() == $oTypeValueDest->GetFormat())
{
$sValueToCopy = $this->Get($sSourceAttCode);
}
else
{
if ($oTypeValueToCopy->GetFormat() == 'text')// and $oTypeValueDest->GetFormat()=='HTML'
{
$sValueToCopy = $this->GetAsHTML($sSourceAttCode);
}
else
{// $oTypeValueToCopy->GetFormat() == 'HTML' and $oTypeValueDest->GetFormat()=='Text'
$sValueToCopy = utils::HtmlToText($this->Get($sSourceAttCode));
}
}
}
else
{
$sValueToCopy = $this->Get($sSourceAttCode);
}
$this->Set($sDestAttCode, $sValueToCopy);
return true;
}