mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #4164 from wilr/fixssreportarraylist
FIX: Modifications to GridFieldExportButton to allow ArrayList use in SS_Report
This commit is contained in:
commit
3907688f7d
@ -132,7 +132,7 @@ class GridFieldExportButton implements GridField_HTMLProvider, GridField_ActionP
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach($items->limit(null) as $item) {
|
foreach($items->limit(null) as $item) {
|
||||||
if($item->hasMethod('canView') && $item->canView()) {
|
if(!$item->hasMethod('canView') || $item->canView()) {
|
||||||
$columnData = array();
|
$columnData = array();
|
||||||
|
|
||||||
foreach($csvColumns as $columnSource => $columnHeader) {
|
foreach($csvColumns as $columnSource => $columnHeader) {
|
||||||
@ -146,17 +146,24 @@ class GridFieldExportButton implements GridField_HTMLProvider, GridField_ActionP
|
|||||||
$value = $columnHeader($relObj);
|
$value = $columnHeader($relObj);
|
||||||
} else {
|
} else {
|
||||||
$value = $gridField->getDataFieldValue($item, $columnSource);
|
$value = $gridField->getDataFieldValue($item, $columnSource);
|
||||||
|
|
||||||
|
if(!$value) {
|
||||||
|
$value = $gridField->getDataFieldValue($item, $columnHeader);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$value = str_replace(array("\r", "\n"), "\n", $value);
|
$value = str_replace(array("\r", "\n"), "\n", $value);
|
||||||
$columnData[] = '"' . str_replace('"', '""', $value) . '"';
|
$columnData[] = '"' . str_replace('"', '""', $value) . '"';
|
||||||
}
|
}
|
||||||
|
|
||||||
$fileData .= implode($separator, $columnData);
|
$fileData .= implode($separator, $columnData);
|
||||||
$fileData .= "\n";
|
$fileData .= "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($item->hasMethod('destroy')) {
|
||||||
$item->destroy();
|
$item->destroy();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $fileData;
|
return $fileData;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user