From 7a1b8c81459cca8e0652257fab59f4c6e750724d Mon Sep 17 00:00:00 2001 From: Anne-Cath Date: Tue, 31 Oct 2023 16:36:08 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B06890=20-=20Update=20request=20template?= =?UTF-8?q?=20data=20though=20the=20REST/JSON=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/attributedef.class.inc.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php index 823cfa93cb..c0584a614b 100644 --- a/core/attributedef.class.inc.php +++ b/core/attributedef.class.inc.php @@ -13211,8 +13211,10 @@ public function MakeRealValue($proposedValue, $oHostObject) { // In that case we need additional keys : see \TemplateFieldsHandler::DoBuildForm $aRequestTemplateValues = $proposedValue->GetValues(); if (false === array_key_exists('current_template_id', $aRequestTemplateValues)) { - $aRequestTemplateValues['current_template_id'] = $aRequestTemplateValues['template_id']; - $aRequestTemplateValues['current_template_data'] = $aRequestTemplateValues['template_data']; + $oCurrentValue = $oHostObject->Get($this->GetCode()); + if(is_object($oCurrentValue)){ + $aRequestTemplateValues = array_merge($oCurrentValue->GetValues(), $aRequestTemplateValues); + } $proposedValue = new ormCustomFieldsValue($oHostObject, $this->GetCode(), $aRequestTemplateValues); } }