Merge pull request #1347 from ashutoshdhundhara/bug_4527

Bug #4527: Importing ODS files with column names having trailing spaces fails.
This commit is contained in:
Marc Delisle 2014-08-29 12:02:07 -04:00
commit 54f80bfd7f
2 changed files with 7 additions and 1 deletions

View File

@ -582,6 +582,10 @@ class ImportCsv extends AbstractImportCsv
if (isset($_REQUEST['csv_col_names'])) {
$col_names = array_splice($rows, 0, 1);
$col_names = $col_names[0];
// MySQL column names can't end with a space character.
foreach ($col_names as $key => $col_name) {
$col_names[$key] = rtrim($col_name);
}
}
if ((isset($col_names) && count($col_names) != $max_cols)

View File

@ -224,7 +224,9 @@ class ImportOds extends ImportPlugin
if (! $col_names_in_first_row) {
$tempRow[] = $value;
} else {
$col_names[] = $value;
// MySQL column names can't end with a space
// character.
$col_names[] = rtrim($value);
}
++$col_count;