Index: trunk/core/units/config_search/config_search_event_handler.php
===================================================================
diff -u -N -r4216 -r4380
--- trunk/core/units/config_search/config_search_event_handler.php (.../config_search_event_handler.php) (revision 4216)
+++ trunk/core/units/config_search/config_search_event_handler.php (.../config_search_event_handler.php) (revision 4380)
@@ -53,7 +53,7 @@
function OnCreateCustomField(&$event)
{
$custom_field =& $event->MasterEvent->getObject();
- if ($custom_field->GetDBField('Type') == 6) {
+ if ($custom_field->GetDBField('Type') == 6 || $custom_field->GetDBField('IsSystem') == 1) {
// user custom fields are not searchable
return false;
}
Index: trunk/kernel/units/custom_fields/custom_fields_event_handler.php
===================================================================
diff -u -N -r4330 -r4380
--- trunk/kernel/units/custom_fields/custom_fields_event_handler.php (.../custom_fields_event_handler.php) (revision 4330)
+++ trunk/kernel/units/custom_fields/custom_fields_event_handler.php (.../custom_fields_event_handler.php) (revision 4380)
@@ -26,7 +26,9 @@
$object->addFilter('itemtype_filter', '%1$s.Type = '.$item_type);
}
- $object->addFilter('user_filter', '%1$s.IsSystem = 0');
+ if (!$this->Application->IsAdmin()) {
+ $object->addFilter('user_filter', '%1$s.IsSystem = 0');
+ }
}
/**
Index: trunk/core/units/custom_fields/custom_fields_event_handler.php
===================================================================
diff -u -N -r4330 -r4380
--- trunk/core/units/custom_fields/custom_fields_event_handler.php (.../custom_fields_event_handler.php) (revision 4330)
+++ trunk/core/units/custom_fields/custom_fields_event_handler.php (.../custom_fields_event_handler.php) (revision 4380)
@@ -26,7 +26,9 @@
$object->addFilter('itemtype_filter', '%1$s.Type = '.$item_type);
}
- $object->addFilter('user_filter', '%1$s.IsSystem = 0');
+ if (!$this->Application->IsAdmin()) {
+ $object->addFilter('user_filter', '%1$s.IsSystem = 0');
+ }
}
/**
Index: trunk/core/units/custom_fields/custom_fields_config.php
===================================================================
diff -u -N -r4330 -r4380
--- trunk/core/units/custom_fields/custom_fields_config.php (.../custom_fields_config.php) (revision 4330)
+++ trunk/core/units/custom_fields/custom_fields_config.php (.../custom_fields_config.php) (revision 4380)
@@ -83,7 +83,7 @@
'ValueList' => Array('type' => 'string','default' => ''),
'DisplayOrder' => Array('type' => 'int','not_null' => '1','default' => '0'),
'OnGeneralTab' => Array('type' => 'int','not_null' => '1','default' => '0'),
- 'IsSystem' => Array('type' => 'int', 'not_null' => '1', 'default' => '0'),
+ 'IsSystem' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array(0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1, 'not_null' => '1', 'default' => '0'),
),
'VirtualFields' => Array(
'Value' => Array('type' => 'string', 'default' => ''),
@@ -112,4 +112,8 @@
),
);
+ if (constOn('DEBUG_MODE')) {
+ $config['Grids']['Default']['Fields']['IsSystem'] = Array('title' => 'la_col_IsSystem');
+ }
+
?>
\ No newline at end of file
Index: trunk/core/kernel/db/db_event_handler.php
===================================================================
diff -u -N -r4358 -r4380
--- trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 4358)
+++ trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 4380)
@@ -1636,7 +1636,10 @@
$field_options = Array('type' => 'string', 'not_null' => 1, 'default' => '');
foreach ($custom_fields as $custom_id => $custom_name) {
$calculated_fields['cust_'.$custom_name] = 'cust.'.$ml_formatter->LangFieldName('cust_'.$custom_id);
- $virtual_fields['cust_'.$custom_name] = $field_options;
+ if (!isset($virtual_fields['cust_'.$custom_name])) {
+ $virtual_fields['cust_'.$custom_name] = Array();
+ }
+ $virtual_fields['cust_'.$custom_name] = array_merge_recursive2($field_options, $virtual_fields['cust_'.$custom_name]);
}
$this->Application->setUnitOption($main_prefix, 'CustomFields', $custom_fields);
$this->Application->setUnitOption($main_prefix.'.', 'CalculatedFields', $calculated_fields);
Index: trunk/kernel/units/custom_fields/custom_fields_config.php
===================================================================
diff -u -N -r4330 -r4380
--- trunk/kernel/units/custom_fields/custom_fields_config.php (.../custom_fields_config.php) (revision 4330)
+++ trunk/kernel/units/custom_fields/custom_fields_config.php (.../custom_fields_config.php) (revision 4380)
@@ -83,7 +83,7 @@
'ValueList' => Array('type' => 'string','default' => ''),
'DisplayOrder' => Array('type' => 'int','not_null' => '1','default' => '0'),
'OnGeneralTab' => Array('type' => 'int','not_null' => '1','default' => '0'),
- 'IsSystem' => Array('type' => 'int', 'not_null' => '1', 'default' => '0'),
+ 'IsSystem' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array(0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1, 'not_null' => '1', 'default' => '0'),
),
'VirtualFields' => Array(
'Value' => Array('type' => 'string', 'default' => ''),
@@ -112,4 +112,8 @@
),
);
+ if (constOn('DEBUG_MODE')) {
+ $config['Grids']['Default']['Fields']['IsSystem'] = Array('title' => 'la_col_IsSystem');
+ }
+
?>
\ No newline at end of file
Index: trunk/core/kernel/utility/unit_config_reader.php
===================================================================
diff -u -N -r4358 -r4380
--- trunk/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 4358)
+++ trunk/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 4380)
@@ -106,33 +106,36 @@
}
}
}
-
- function ParseConfigClones($prefix)
+
+ function postProcessConfig($prefix, $config_key, $dst_prefix_var)
{
- $config = $this->configData[$prefix];
- if(!getArrayValue($config, 'Clones'))
- {
- return;
+ $main_config =& $this->configData[$prefix];
+ $sub_configs = getArrayValue($main_config, $config_key);
+ if (!$sub_configs) {
+ return false;
}
- unset($this->configData[$prefix]['Clones']);
- foreach($config['Clones'] as $clone_prefix => $clone_config)
- {
- $clone_config['Prefix'] = $clone_prefix;
- $this->configData[$clone_prefix] = array_merge_recursive2($this->configData[$prefix], $clone_config);
-
- foreach($clone_config as $cloned_property => $cloned_value)
- {
- if(!$cloned_value) unset($this->configData[$clone_prefix][$cloned_property]);
+ unset($main_config[$config_key]);
+
+ foreach ($sub_configs as $sub_prefix => $sub_config) {
+ $sub_config['Prefix'] = $sub_prefix;
+ $this->configData[$sub_prefix] = array_merge_recursive2($this->configData[$$dst_prefix_var], $sub_config);
+
+ // when merging empty array to non-empty results non-empty array, but empty is required
+ foreach ($sub_config as $sub_key => $sub_value) {
+ if (!$sub_value) {
+ unset($this->configData[$sub_config][$sub_key]);
+ }
}
- $this->ParseConfigClones($clone_prefix);
+ $this->postProcessConfig($sub_prefix, $config_key, $dst_prefix_var);
}
+
if (!$prefix) {
// configs, that used only for cloning & not used ifself
unset($this->configData[$prefix]);
}
}
-
+
function ParseConfigs()
{
foreach ($this->configData as $prefix => $config) {
@@ -198,7 +201,9 @@
$config['ModuleFolder'] = $rets[1];
$config['BasePath'] = dirname(FULL_PATH.$filename);
$this->configData[$prefix] = $config;
- $this->ParseConfigClones($prefix);
+
+ $this->postProcessConfig($prefix, 'AggregateConfigs', 'sub_prefix');
+ $this->postProcessConfig($prefix, 'Clones', 'prefix');
}
}
}
Index: trunk/kernel/units/config_search/config_search_event_handler.php
===================================================================
diff -u -N -r4216 -r4380
--- trunk/kernel/units/config_search/config_search_event_handler.php (.../config_search_event_handler.php) (revision 4216)
+++ trunk/kernel/units/config_search/config_search_event_handler.php (.../config_search_event_handler.php) (revision 4380)
@@ -53,7 +53,7 @@
function OnCreateCustomField(&$event)
{
$custom_field =& $event->MasterEvent->getObject();
- if ($custom_field->GetDBField('Type') == 6) {
+ if ($custom_field->GetDBField('Type') == 6 || $custom_field->GetDBField('IsSystem') == 1) {
// user custom fields are not searchable
return false;
}
Index: trunk/kernel/admin_templates/custom_fields/custom_fields_edit.tpl
===================================================================
diff -u -N -r4008 -r4380
--- trunk/kernel/admin_templates/custom_fields/custom_fields_edit.tpl (.../custom_fields_edit.tpl) (revision 4008)
+++ trunk/kernel/admin_templates/custom_fields/custom_fields_edit.tpl (.../custom_fields_edit.tpl) (revision 4380)
@@ -87,6 +87,10 @@
+
+
+
+