Enforce at least the right number of columns in import file vs definition, even if we can't tell what the columns are

This commit is contained in:
Nathan Gray 2012-09-04 22:45:55 +00:00
parent a85fdb63a0
commit 29e52fc727
2 changed files with 10 additions and 1 deletions

View File

@ -230,7 +230,15 @@ class importexport_import_csv implements importexport_iface_import_record { //,
protected function do_fieldmapping( ) {
$record = $this->record;
$this->record = array();
foreach ($this->mapping as $cvs_idx => $new_idx) {
if(count($this->mapping) !== count($record))
{
throw new egw_exception_wrong_userinput(lang("Column mismatch. Expected %1 columns, your file has %2.",
count($this->mapping),
count($record)
));
}
foreach ($this->mapping as $cvs_idx => $new_idx)
{
if( $new_idx == '' ) continue;
$this->record[$new_idx] = $record[$cvs_idx];
}

View File

@ -24,6 +24,7 @@ choose a plugin importexport en Choose a plugin
choose an application importexport en Choose an application
choose fields to export importexport en Choose fields to export
choose seperator and charset importexport en Choose separator and charset
column mismatch. expected %1 columns, your file has %2. importexport en Column mismatch. Expected %1 columns, your file has %2.
condition importexport en Condition
copied importexport en Copied.
csv field importexport en CSV field