#936 Tune the default (i.e. implicit) tracking level on link sets (and disable tracking on 1-N links, for fresh installations)

SVN:trunk[3187]
This commit is contained in:
Romain Quetiez
2014-06-03 13:36:35 +00:00
parent 1572d9da5a
commit e4bb0acd94
3 changed files with 22 additions and 2 deletions

View File

@@ -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'));
}
}

View File

@@ -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)

View File

@@ -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');
}