From 8e00c9c304d6defb319a316e8e4bed7c2cae47a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Aug 2020 15:53:14 +0200 Subject: [PATCH] FIX Update extrafields on line only if it is supported --- htdocs/core/class/commonobject.class.php | 5 ++--- htdocs/modulebuilder/template/class/myobject.class.php | 5 +++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 0d0a81a5192..4ccabb364b7 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8146,9 +8146,8 @@ abstract class CommonObject if (empty($error)) { // Remove extrafields - if (!$error) - { - $tmpobjectline = new $tmpforobjectlineclass($this->db); + $tmpobjectline = new $tmpforobjectlineclass($this->db); + if (!isset($tmpobjectline->isextrafieldmanaged) || !empty($tmpobjectline->isextrafieldmanaged)) { $tmpobjectline->id = $idline; $result = $tmpobjectline->deleteExtraFields(); if ($result < 0) diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 457e5f3f7d5..5a2e27e6bc6 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -1071,6 +1071,11 @@ class MyObjectLine extends CommonObjectLine // To complete with content of an object MyObjectLine // We should have a field rowid, fk_myobject and position + /** + * @var int Does object support extrafields ? 0=No, 1=Yes + */ + public $isextrafieldmanaged = 0; + /** * Constructor *