Index: branches/unlabeled/unlabeled-1.62.2/core/kernel/db/db_tag_processor.php =================================================================== diff -u -r5724 -r5727 --- branches/unlabeled/unlabeled-1.62.2/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 5724) +++ branches/unlabeled/unlabeled-1.62.2/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 5727) @@ -628,7 +628,7 @@ function Error($params) { - $field = $params['field']; + $field = $this->SelectParam($params, 'name,field'); $object =& $this->getObject($params); $msg = $object->GetErrorMsg($field, false); return $msg; @@ -745,7 +745,7 @@ function Format($params) { - $field = $params['field']; + $field = $this->SelectParam($params, 'name,field'); $object =& $this->getObject($params); $options = $object->GetFieldOptions($field); Index: branches/unlabeled/unlabeled-1.7.2/core/admin_templates/incs/custom_blocks.tpl =================================================================== diff -u -r5521 -r5727 --- branches/unlabeled/unlabeled-1.7.2/core/admin_templates/incs/custom_blocks.tpl (.../custom_blocks.tpl) (revision 5521) +++ branches/unlabeled/unlabeled-1.7.2/core/admin_templates/incs/custom_blocks.tpl (.../custom_blocks.tpl) (revision 5727) @@ -35,6 +35,32 @@ + + + + + + + " id="" value="" size="" datepickerIcon="admin/images/ddarrow.gif"> () + + " value=""> + + + + + + + + + " id="" value="" size="" datepickerIcon="admin/images/ddarrow.gif"> () + +  " id="" value="" size=""> () + + @@ -48,7 +74,7 @@ -   +   Index: branches/unlabeled/unlabeled-1.7.2/kernel/admin_templates/incs/custom_blocks.tpl =================================================================== diff -u -r5521 -r5727 --- branches/unlabeled/unlabeled-1.7.2/kernel/admin_templates/incs/custom_blocks.tpl (.../custom_blocks.tpl) (revision 5521) +++ branches/unlabeled/unlabeled-1.7.2/kernel/admin_templates/incs/custom_blocks.tpl (.../custom_blocks.tpl) (revision 5727) @@ -35,6 +35,32 @@ + + + + + + + " id="" value="" size="" datepickerIcon="admin/images/ddarrow.gif"> () + + " value=""> + + + + + + + + + " id="" value="" size="" datepickerIcon="admin/images/ddarrow.gif"> () + +  " id="" value="" size=""> () + + @@ -48,7 +74,7 @@ -   +   Index: branches/unlabeled/unlabeled-1.96.2/admin/install/langpacks/english.lang =================================================================== diff -u -r5655 -r5727 --- branches/unlabeled/unlabeled-1.96.2/admin/install/langpacks/english.lang (.../english.lang) (revision 5655) +++ branches/unlabeled/unlabeled-1.96.2/admin/install/langpacks/english.lang (.../english.lang) (revision 5727) @@ -417,6 +417,7 @@ TGlua3M= QXJ0aWNsZXM= VG9waWNz + SzQgQWR2YW5jZWQgVmlldw== SzQgQ2F0YWxvZw== S0I= TGFuZ3VhZ2U= @@ -1458,6 +1459,8 @@ Vmlld3M= VG8gRGF0ZQ== Q2hlY2tib3hlcw== + RGF0ZQ== + RGF0ZSAmIFRpbWU= TGFiZWw= UGFzc3dvcmQgZmllbGQ= UmFkaW8gYnV0dG9ucw== Index: branches/unlabeled/unlabeled-1.2.2/kernel/units/custom_fields/custom_fields_tag_processor.php =================================================================== diff -u -r4332 -r5727 --- branches/unlabeled/unlabeled-1.2.2/kernel/units/custom_fields/custom_fields_tag_processor.php (.../custom_fields_tag_processor.php) (revision 4332) +++ branches/unlabeled/unlabeled-1.2.2/kernel/units/custom_fields/custom_fields_tag_processor.php (.../custom_fields_tag_processor.php) (revision 5727) @@ -2,25 +2,47 @@ class CustomFieldsTagProcessor extends kDBTagProcessor { - function CustomField($params) + /** + * Return LEFT JOINed custom field name from main item config + * + * @param Array $params + * @return string + */ + function GetMainField($params) { $object =& $this->getObject($params); - $parent_item =& $this->Application->recallObject($params['SourcePrefix']); - - $field = $this->SelectParam($params, 'name,field'); - return $parent_item->GetField('cust_'.$object->GetField($field)); + $append = isset($params['append']) && $params['append'] ? $params['append'] : ''; + return 'cust_'.$object->GetDBField('FieldName').$append; } + function CustomField($params) + { + $params['name'] = $this->GetMainField($params); + $source_prefix = $this->Application->Parser->GetParam('SourcePrefix'); + return $this->Application->ProcessParsedTag($source_prefix, 'Field', $params); + } + + function CustomFormat($params) + { + $params['name'] = $this->GetMainField($params); + $source_prefix = $this->Application->Parser->GetParam('SourcePrefix'); + return $this->Application->ProcessParsedTag($source_prefix, 'Format', $params); + } + function CustomInputName($params) { - $object =& $this->getObject($params); + $params['name'] = $this->GetMainField($params); $source_prefix = $this->Application->Parser->GetParam('SourcePrefix'); - - $source_tp =& $this->Application->recallTagProcessor($source_prefix); - $params['name'] = 'cust_'.$object->GetDBField('FieldName'); - return $source_tp->InputName($params); + return $this->Application->ProcessParsedTag($source_prefix, 'InputName', $params); } + function CustomError($params) + { + $params['name'] = $this->GetMainField($params); + $source_prefix = $this->Application->Parser->GetParam('SourcePrefix'); + return $this->Application->ProcessParsedTag($source_prefix, 'Error', $params); + } + /** * Prints list content using block specified * Index: branches/unlabeled/unlabeled-1.73.2/core/kernel/db/db_event_handler.php =================================================================== diff -u -r5618 -r5727 --- branches/unlabeled/unlabeled-1.73.2/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 5618) +++ branches/unlabeled/unlabeled-1.73.2/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 5727) @@ -1720,7 +1720,7 @@ // no main config of such type return false; } - + // 1. get custom field information $sql = 'SELECT * FROM '.TABLE_PREFIX.'CustomField @@ -1731,32 +1731,44 @@ // config doesn't have custom fields return false; } - + // 2. create fields (for customdata item) $fields = $this->Application->getUnitOption($event->Prefix, 'Fields', Array()); $field_options = Array('type' => 'string', 'formatter' => 'kMultiLanguage', 'not_null' => 1, 'db_type' => 'text', 'default' => ''); foreach ($custom_fields as $custom_id => $custom_params) { $fields['cust_'.$custom_id] = $field_options; } $this->Application->setUnitOption($event->Prefix, 'Fields', $fields); - + // 3. create virtual & calculated fields (for main item) $calculated_fields = $this->Application->getUnitOption($main_prefix.'.', 'CalculatedFields', Array()); $virtual_fields = $this->Application->getUnitOption($main_prefix, 'VirtualFields', Array()); - + $cf_helper =& $this->Application->recallObject('InpCustomFieldsHelper'); $field_options = Array('type' => 'string', 'not_null' => 1, 'default' => ''); $ml_formatter =& $this->Application->recallObject('kMultiLanguage'); - $option_types = Array('select', 'radio'); + foreach ($custom_fields as $custom_id => $custom_params) { - if (in_array($custom_params['ElementType'], $option_types) && $custom_params['ValueList']) { - $field_options['options'] = $cf_helper->GetValuesHash($custom_params['ValueList']); - $field_options['formatter'] = 'kOptionsFormatter'; + switch ($custom_params['ElementType']) { + case 'date': + case 'datetime': + unset($field_options['options']); + $field_options['formatter'] = 'kDateFormatter'; + break; + + case 'select': + case 'radio': + if ($custom_params['ValueList']) { + $field_options['options'] = $cf_helper->GetValuesHash($custom_params['ValueList']); + $field_options['formatter'] = 'kOptionsFormatter'; + } + break; + + default: + unset($field_options['options'], $field_options['formatter']); + break; } - else { - unset($field_options['options'], $field_options['formatter']); - } - + $custom_name = $custom_params['FieldName']; $calculated_fields['cust_'.$custom_name] = 'cust.'.$ml_formatter->LangFieldName('cust_'.$custom_id); if (!isset($virtual_fields['cust_'.$custom_name])) { Index: branches/unlabeled/unlabeled-1.10.2/core/units/custom_fields/custom_fields_config.php =================================================================== diff -u -r4381 -r5727 --- branches/unlabeled/unlabeled-1.10.2/core/units/custom_fields/custom_fields_config.php (.../custom_fields_config.php) (revision 4381) +++ branches/unlabeled/unlabeled-1.10.2/core/units/custom_fields/custom_fields_config.php (.../custom_fields_config.php) (revision 5727) @@ -79,7 +79,7 @@ 'FieldLabel' => Array('type' => 'string', 'required' => 1, 'default' => ''), 'Heading' => Array('type' => 'string', 'required' => 1, 'default' => ''), 'Prompt' => Array('type' => 'string','default' => ''), - 'ElementType' => Array('required'=>'1', 'type'=>'string', 'not_null'=>1, 'default'=>'NULL', 'formatter'=>'kOptionsFormatter', 'use_phrases' => 1, 'options'=>Array('' => 'la_EmptyValue', 'text' => 'la_type_text', 'select' => 'la_type_select', 'radio' => 'la_type_radio', 'checkbox' => 'la_type_checkbox', 'password' => 'la_type_password', 'textarea' => 'la_type_textarea', 'label' => 'la_type_label')), + 'ElementType' => Array('required'=>'1', 'type'=>'string', 'not_null'=>1, 'default'=>'NULL', 'formatter'=>'kOptionsFormatter', 'use_phrases' => 1, 'options'=>Array('' => 'la_EmptyValue', 'text' => 'la_type_text', 'select' => 'la_type_select', 'radio' => 'la_type_radio', 'checkbox' => 'la_type_checkbox', 'password' => 'la_type_password', 'textarea' => 'la_type_textarea', 'label' => 'la_type_label', 'date' => 'la_type_date', 'datetime' => 'la_type_datetime')), 'ValueList' => Array('type' => 'string','default' => ''), 'DisplayOrder' => Array('type' => 'int','not_null' => '1','default' => '0'), 'OnGeneralTab' => Array('type' => 'int','not_null' => '1','default' => '0'), Index: branches/unlabeled/unlabeled-1.2.2/core/units/custom_fields/custom_fields_tag_processor.php =================================================================== diff -u -r4332 -r5727 --- branches/unlabeled/unlabeled-1.2.2/core/units/custom_fields/custom_fields_tag_processor.php (.../custom_fields_tag_processor.php) (revision 4332) +++ branches/unlabeled/unlabeled-1.2.2/core/units/custom_fields/custom_fields_tag_processor.php (.../custom_fields_tag_processor.php) (revision 5727) @@ -2,25 +2,47 @@ class CustomFieldsTagProcessor extends kDBTagProcessor { - function CustomField($params) + /** + * Return LEFT JOINed custom field name from main item config + * + * @param Array $params + * @return string + */ + function GetMainField($params) { $object =& $this->getObject($params); - $parent_item =& $this->Application->recallObject($params['SourcePrefix']); - - $field = $this->SelectParam($params, 'name,field'); - return $parent_item->GetField('cust_'.$object->GetField($field)); + $append = isset($params['append']) && $params['append'] ? $params['append'] : ''; + return 'cust_'.$object->GetDBField('FieldName').$append; } + function CustomField($params) + { + $params['name'] = $this->GetMainField($params); + $source_prefix = $this->Application->Parser->GetParam('SourcePrefix'); + return $this->Application->ProcessParsedTag($source_prefix, 'Field', $params); + } + + function CustomFormat($params) + { + $params['name'] = $this->GetMainField($params); + $source_prefix = $this->Application->Parser->GetParam('SourcePrefix'); + return $this->Application->ProcessParsedTag($source_prefix, 'Format', $params); + } + function CustomInputName($params) { - $object =& $this->getObject($params); + $params['name'] = $this->GetMainField($params); $source_prefix = $this->Application->Parser->GetParam('SourcePrefix'); - - $source_tp =& $this->Application->recallTagProcessor($source_prefix); - $params['name'] = 'cust_'.$object->GetDBField('FieldName'); - return $source_tp->InputName($params); + return $this->Application->ProcessParsedTag($source_prefix, 'InputName', $params); } + function CustomError($params) + { + $params['name'] = $this->GetMainField($params); + $source_prefix = $this->Application->Parser->GetParam('SourcePrefix'); + return $this->Application->ProcessParsedTag($source_prefix, 'Error', $params); + } + /** * Prints list content using block specified * Index: branches/unlabeled/unlabeled-1.10.2/kernel/units/custom_fields/custom_fields_config.php =================================================================== diff -u -r4381 -r5727 --- branches/unlabeled/unlabeled-1.10.2/kernel/units/custom_fields/custom_fields_config.php (.../custom_fields_config.php) (revision 4381) +++ branches/unlabeled/unlabeled-1.10.2/kernel/units/custom_fields/custom_fields_config.php (.../custom_fields_config.php) (revision 5727) @@ -79,7 +79,7 @@ 'FieldLabel' => Array('type' => 'string', 'required' => 1, 'default' => ''), 'Heading' => Array('type' => 'string', 'required' => 1, 'default' => ''), 'Prompt' => Array('type' => 'string','default' => ''), - 'ElementType' => Array('required'=>'1', 'type'=>'string', 'not_null'=>1, 'default'=>'NULL', 'formatter'=>'kOptionsFormatter', 'use_phrases' => 1, 'options'=>Array('' => 'la_EmptyValue', 'text' => 'la_type_text', 'select' => 'la_type_select', 'radio' => 'la_type_radio', 'checkbox' => 'la_type_checkbox', 'password' => 'la_type_password', 'textarea' => 'la_type_textarea', 'label' => 'la_type_label')), + 'ElementType' => Array('required'=>'1', 'type'=>'string', 'not_null'=>1, 'default'=>'NULL', 'formatter'=>'kOptionsFormatter', 'use_phrases' => 1, 'options'=>Array('' => 'la_EmptyValue', 'text' => 'la_type_text', 'select' => 'la_type_select', 'radio' => 'la_type_radio', 'checkbox' => 'la_type_checkbox', 'password' => 'la_type_password', 'textarea' => 'la_type_textarea', 'label' => 'la_type_label', 'date' => 'la_type_date', 'datetime' => 'la_type_datetime')), 'ValueList' => Array('type' => 'string','default' => ''), 'DisplayOrder' => Array('type' => 'int','not_null' => '1','default' => '0'), 'OnGeneralTab' => Array('type' => 'int','not_null' => '1','default' => '0'),