From a77ba2fbabfcc13a2eb474fc05b4fb4d6e54dc60 Mon Sep 17 00:00:00 2001 From: acognet Date: Tue, 14 Apr 2020 16:58:08 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B02564=20-=20Stop=20copy=20after=20"<"=20c?= =?UTF-8?q?haracter=20in=20a=20Copy=20operation=20on=20a=20Transition=20-?= =?UTF-8?q?=20change=20only=20in=20Copy=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/dbobject.class.php | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/core/dbobject.class.php b/core/dbobject.class.php index ac7d8e668..f22ec17c6 100644 --- a/core/dbobject.class.php +++ b/core/dbobject.class.php @@ -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; }