Przeglądaj źródła

FIX Update extrafields on line only if it is supported

Conflicts:
	htdocs/modulebuilder/template/class/myobject.class.php
Laurent Destailleur 5 lat temu
rodzic
commit
8bfa6df1a6

+ 2 - 3
htdocs/core/class/commonobject.class.php

@@ -8500,9 +8500,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)

+ 15 - 0
htdocs/modulebuilder/template/class/myobject.class.php

@@ -1085,4 +1085,19 @@ class MyObjectLine
 {
 	// 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
+	 *
+	 * @param DoliDb $db Database handler
+	 */
+	public function __construct(DoliDB $db)
+	{
+		$this->db = $db;
+	}
 }