Author: mcantelon
Date: Thu Feb 16 17:24:00 2012
New Revision: 10929
Log:
Added count of multi-value column instanced to CSV import checker.
Modified:
trunk/lib/task/import/csvCheckImportTask.class.php
Modified: trunk/lib/task/import/csvCheckImportTask.class.php
==============================================================================
--- trunk/lib/task/import/csvCheckImportTask.class.php Thu Feb 16 17:19:36
2012 (r10928)
+++ trunk/lib/task/import/csvCheckImportTask.class.php Thu Feb 16 17:24:00
2012 (r10929)
@@ -100,7 +100,10 @@
// check for | character
if (substr_count($value, '|'))
{
- $self->status['multiValueColumns'][$column] = TRUE;
+ $self->status['multiValueColumns'][$column]
+ = (isset($self->status['multiValueColumns'][$column]))
+ ? $self->status['multiValueColumns'][$column] + 1
+ : 1;
}
}
}
@@ -113,10 +116,32 @@
$import->status['nonEmptyColumns']
);
- $multiValueColumns = array_merge(
- $multiValueColumns,
- $import->status['multiValueColumns']
- );
+ // add values of both arrays together
+ $a = $multiValueColumns;
+ $b = $import->status['multiValueColumns'];
+ $c = array();
+
+ // add values of both arrays if possible
+ foreach($a as $key => $value)
+ {
+ if (isset($b[$key]))
+ {
+ $c[$key] = $a[$key] + $b[$key];
+ } else {
+ $c[$key] = $a[$key];
+ }
+ }
+
+ // add values that only occur in array B
+ foreach($b as $key => $value)
+ {
+ if (!isset($a[$key]))
+ {
+ $c[$key] = $value;
+ }
+ }
+
+ $multiValueColumns = $c;
$sampleColumnValues = $import->status['sampleColumnValues'];
@@ -146,9 +171,9 @@
print "\n\nMulti-value columns (contain \"|\" character):\n";
print "-------------------\n\n";
- foreach(array_keys($multiValueColumns) as $column)
+ foreach($multiValueColumns as $column => $count)
{
- print $column .' ';
+ print $column .'('. $count .') ';
}
}
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/qubit-commits?hl=en.