Index: trunk/admin/install/install_lib.php =================================================================== diff -u -N -r4237 -r4432 --- trunk/admin/install/install_lib.php (.../install_lib.php) (revision 4237) +++ trunk/admin/install/install_lib.php (.../install_lib.php) (revision 4432) @@ -1007,4 +1007,34 @@ FROM '.$application->getUnitOption($prefix, 'TableName').' main_table '.implode(' ', $joins_sql); $db->Query($sql); } + + /** + * [INSTALL] Link custom field records with search config records + create custom field columns + * + * @param string $module_name + * @param int $item_type + */ + function linkCustomFields($module_name, $prefix, $item_type) + { + $application = kApplication::Instance(); + $db =& $application->GetADODBConnection(); + $sql = 'SELECT FieldName, CustomFieldId + FROM '.TABLE_PREFIX.'CustomField + WHERE Type = '.$item_type; // config is not read here yet :( $application->getUnitOption('p', 'ItemType'); + $custom_fields = $db->GetCol($sql, 'CustomFieldId'); + foreach ($custom_fields as $cf_id => $cf_name) { + $sql = 'UPDATE '.TABLE_PREFIX.'SearchConfig + SET CustomFieldId = '.$cf_id.' + WHERE (TableName = "CustomField") AND (LOWER(ModuleName) = "'.strtolower($module_name).'") AND (FieldName = '.$db->qstr($cf_name).')'; + $db->Query($sql); + } + + // because of configs was read only from installed before modules (in-portal), then reread configs + $unit_config_reader =& $application->recallObject('kUnitConfigReader'); + $unit_config_reader->scanModules(MODULES_PATH.'/'.$module_name); + + // create correct columns in ProductsCustomData table + $ml_helper =& $application->recallObject('kMultiLanguageHelper'); + $ml_helper->createFields($prefix.'-cdata'); + } ?>