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) {
|
||||
if($item->hasMethod('canView') && $item->canView()) {
|
||||
if(!$item->hasMethod('canView') || $item->canView()) {
|
||||
$columnData = array();
|
||||
|
||||
foreach($csvColumns as $columnSource => $columnHeader) {
|
||||
@ -146,16 +146,23 @@ class GridFieldExportButton implements GridField_HTMLProvider, GridField_ActionP
|
||||
$value = $columnHeader($relObj);
|
||||
} else {
|
||||
$value = $gridField->getDataFieldValue($item, $columnSource);
|
||||
|
||||
if(!$value) {
|
||||
$value = $gridField->getDataFieldValue($item, $columnHeader);
|
||||
}
|
||||
}
|
||||
|
||||
$value = str_replace(array("\r", "\n"), "\n", $value);
|
||||
$columnData[] = '"' . str_replace('"', '""', $value) . '"';
|
||||
}
|
||||
|
||||
$fileData .= implode($separator, $columnData);
|
||||
$fileData .= "\n";
|
||||
}
|
||||
|
||||
$item->destroy();
|
||||
if($item->hasMethod('destroy')) {
|
||||
$item->destroy();
|
||||
}
|
||||
}
|
||||
|
||||
return $fileData;
|
||||
|
Loading…
Reference in New Issue
Block a user