diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php index 94a2a57ae8..dd546d735c 100644 --- a/core/attributedef.class.inc.php +++ b/core/attributedef.class.inc.php @@ -621,7 +621,7 @@ class AttributeLinkedSet extends AttributeDefinition public function GetTrackingLevel() { - return $this->GetOptional('tracking_level', LINKSET_TRACKING_LIST); + return $this->GetOptional('tracking_level', MetaModel::GetConfig()->Get('tracking_level_linked_set_default')); } public function GetEditMode() @@ -919,7 +919,7 @@ class AttributeLinkedSetIndirect extends AttributeLinkedSet public function GetTrackingLevel() { - return $this->GetOptional('tracking_level', LINKSET_TRACKING_ALL); + return $this->GetOptional('tracking_level', MetaModel::GetConfig()->Get('tracking_level_linked_set_indirect_default')); } } diff --git a/core/config.class.inc.php b/core/config.class.inc.php index e09ebcde59..0a8ec27403 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -35,6 +35,7 @@ define('ACCESS_READONLY', 0); */ require_once('coreexception.class.inc.php'); +require_once('attributedef.class.inc.php'); // For the defines class ConfigException extends CoreException { @@ -735,6 +736,22 @@ class Config 'source_of_value' => '', 'show_in_conf_sample' => false, ), + 'tracking_level_linked_set_default' => array( + 'type' => 'integer', + 'description' => 'Default tracking level if not explicitely set at the attribute level, for AttributeLinkedSet (defaults to NONE in case of a fresh install, LIST otherwise - this to preserve backward compatibility while upgrading from a version older than 2.0.3 - see TRAC #936)', + 'default' => LINKSET_TRACKING_LIST, + 'value' => LINKSET_TRACKING_LIST, + 'source_of_value' => '', + 'show_in_conf_sample' => false, + ), + 'tracking_level_linked_set_indirect_default' => array( + 'type' => 'integer', + 'description' => 'Default tracking level if not explicitely set at the attribute level, for AttributeLinkedSetIndirect', + 'default' => LINKSET_TRACKING_ALL, + 'value' => LINKSET_TRACKING_ALL, + 'source_of_value' => '', + 'show_in_conf_sample' => false, + ), ); public function IsProperty($sPropCode) diff --git a/setup/applicationinstaller.class.inc.php b/setup/applicationinstaller.class.inc.php index 38f07f7d31..49f408ec25 100644 --- a/setup/applicationinstaller.class.inc.php +++ b/setup/applicationinstaller.class.inc.php @@ -883,6 +883,9 @@ class ApplicationInstaller else { $oConfig = new Config(); + // To preserve backward compatibility while upgrading to 2.0.3 (when tracking_level_linked_set_default has been introduced) + // the default value on upgrade differs from the default value at first install + $oConfig->Set('tracking_level_linked_set_default', LINKSET_TRACKING_NONE, 'first_install'); }