mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-25 16:19:00 +01:00
Better handling of shifting to avoid deleted fields
This commit is contained in:
parent
a47732d530
commit
738966ca68
@ -227,20 +227,24 @@ class importexport_wizard_basic_import_csv
|
|||||||
for($i = 0; $i <= count($content['csv_fields']); $i++) {
|
for($i = 0; $i <= count($content['csv_fields']); $i++) {
|
||||||
unset($content[$i]);
|
unset($content[$i]);
|
||||||
}
|
}
|
||||||
array_shift($content['csv_fields']);
|
if(!$content['csv_fields'][0]) {
|
||||||
|
array_shift($content['csv_fields']);
|
||||||
|
}
|
||||||
// Need to move everything down 1 to remove header, but shift will re-key
|
// Need to move everything down 1 to remove header, but shift will re-key
|
||||||
unset($content['field_mapping'][0]);
|
if(!$content['field_mapping'][0] || $content['field_mapping'][0] == $content['field_mapping'][1]) {
|
||||||
if(is_array($content['field_conversion'])) unset($content['field_conversion'][0]);
|
unset($content['field_mapping'][0]);
|
||||||
foreach(array('field_mapping', 'field_conversion') as $field) {
|
if(is_array($content['field_conversion'])) unset($content['field_conversion'][0]);
|
||||||
ksort($content[$field]);
|
foreach(array('field_mapping', 'field_conversion') as $field) {
|
||||||
foreach($content[$field] as $key => $value)
|
ksort($content[$field]);
|
||||||
{
|
foreach($content[$field] as $key => $value)
|
||||||
if($value && $value != '--NONE--') {
|
{
|
||||||
$content[$field][$key-1] = $content[$field][$key];
|
if($value && $value != '--NONE--') {
|
||||||
|
$content[$field][$key-1] = $content[$field][$key];
|
||||||
|
}
|
||||||
|
unset($content[$field][$key]);
|
||||||
}
|
}
|
||||||
unset($content[$field][$key]);
|
ksort($content[$field]);
|
||||||
}
|
}
|
||||||
ksort($content[$field]);
|
|
||||||
}
|
}
|
||||||
foreach($content['field_conversion'] as $field => $convert) {
|
foreach($content['field_conversion'] as $field => $convert) {
|
||||||
if(!trim($convert)) unset($content['field_conversion'][$field]);
|
if(!trim($convert)) unset($content['field_conversion'][$field]);
|
||||||
|
Loading…
Reference in New Issue
Block a user