Index: trunk/core/units/general/cat_dbitem_export.php =================================================================== diff -u -N -r4043 -r4085 --- trunk/core/units/general/cat_dbitem_export.php (.../cat_dbitem_export.php) (revision 4043) +++ trunk/core/units/general/cat_dbitem_export.php (.../cat_dbitem_export.php) (revision 4085) @@ -182,7 +182,7 @@ } } - if (!$ret) { + if (!$ret && $this->Application->isDebugMode()) { $this->Application->Debugger->appendHTML('Missing required for import/export:'); $this->Application->Debugger->dumpVars($missing_columns); } @@ -306,11 +306,30 @@ if ($this->exportOptions['export_ids'] === false) { // get links from current category & all it's subcategories - $sql = 'SELECT item_table.*, ci.CategoryId - FROM '.$this->curItem->TableName.' item_table - LEFT JOIN '.TABLE_PREFIX.'CategoryItems ci ON ci.ItemResourceId = item_table.ResourceId - LEFT JOIN '.TABLE_PREFIX.'Category c ON c.CategoryId = ci.CategoryId - WHERE '; + $join_clauses = Array(); + + $custom_sql = ''; + $custom_table = $this->Application->getUnitOption($this->curItem->Prefix.'-cdata', 'TableName'); + + if ($custom_table) { + $ml_formatter =& $this->Application->recallObject('kMultiLanguage'); + $custom_fields = $this->Application->getUnitOption($this->curItem->Prefix, 'CustomFields'); + + foreach ($custom_fields as $custom_id => $custom_name) { + $custom_sql .= 'custom_data.'.$ml_formatter->LangFieldName('cust_'.$custom_id).' AS cust_'.$custom_name.','; + } + $join_clauses[$custom_table.' custom_data'] = 'custom_data.ResourceId = item_table.ResourceId'; + } + $join_clauses[TABLE_PREFIX.'CategoryItems ci'] = 'ci.ItemResourceId = item_table.ResourceId'; + $join_clauses[TABLE_PREFIX.'Category c'] = 'c.CategoryId = ci.CategoryId'; + + $sql = 'SELECT item_table.*, '.$custom_sql.' ci.CategoryId + FROM '.$this->curItem->TableName.' item_table'; + + foreach ($join_clauses as $table_name => $join_expression) { + $sql .= ' LEFT JOIN '.$table_name.' ON '.$join_expression; + } + $sql .= ' WHERE '; if ($this->exportOptions['export_cats_ids'][0] == 0) { Index: trunk/kernel/units/general/cat_dbitem_export.php =================================================================== diff -u -N -r4043 -r4085 --- trunk/kernel/units/general/cat_dbitem_export.php (.../cat_dbitem_export.php) (revision 4043) +++ trunk/kernel/units/general/cat_dbitem_export.php (.../cat_dbitem_export.php) (revision 4085) @@ -182,7 +182,7 @@ } } - if (!$ret) { + if (!$ret && $this->Application->isDebugMode()) { $this->Application->Debugger->appendHTML('Missing required for import/export:'); $this->Application->Debugger->dumpVars($missing_columns); } @@ -306,11 +306,30 @@ if ($this->exportOptions['export_ids'] === false) { // get links from current category & all it's subcategories - $sql = 'SELECT item_table.*, ci.CategoryId - FROM '.$this->curItem->TableName.' item_table - LEFT JOIN '.TABLE_PREFIX.'CategoryItems ci ON ci.ItemResourceId = item_table.ResourceId - LEFT JOIN '.TABLE_PREFIX.'Category c ON c.CategoryId = ci.CategoryId - WHERE '; + $join_clauses = Array(); + + $custom_sql = ''; + $custom_table = $this->Application->getUnitOption($this->curItem->Prefix.'-cdata', 'TableName'); + + if ($custom_table) { + $ml_formatter =& $this->Application->recallObject('kMultiLanguage'); + $custom_fields = $this->Application->getUnitOption($this->curItem->Prefix, 'CustomFields'); + + foreach ($custom_fields as $custom_id => $custom_name) { + $custom_sql .= 'custom_data.'.$ml_formatter->LangFieldName('cust_'.$custom_id).' AS cust_'.$custom_name.','; + } + $join_clauses[$custom_table.' custom_data'] = 'custom_data.ResourceId = item_table.ResourceId'; + } + $join_clauses[TABLE_PREFIX.'CategoryItems ci'] = 'ci.ItemResourceId = item_table.ResourceId'; + $join_clauses[TABLE_PREFIX.'Category c'] = 'c.CategoryId = ci.CategoryId'; + + $sql = 'SELECT item_table.*, '.$custom_sql.' ci.CategoryId + FROM '.$this->curItem->TableName.' item_table'; + + foreach ($join_clauses as $table_name => $join_expression) { + $sql .= ' LEFT JOIN '.$table_name.' ON '.$join_expression; + } + $sql .= ' WHERE '; if ($this->exportOptions['export_cats_ids'][0] == 0) {