mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Use EscapeFormula() in CSV export
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
2fd197c2db
commit
bae200edd7
|
@ -22,7 +22,7 @@ use Illuminate\Support\Facades\View;
|
|||
use Input;
|
||||
use League\Csv\Reader;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
|
||||
use League\Csv\EscapeFormula;
|
||||
/**
|
||||
* This controller handles all actions related to Reports for
|
||||
* the Snipe-IT Asset Management application.
|
||||
|
@ -666,6 +666,9 @@ class ReportsController extends Controller
|
|||
$executionTime = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'];
|
||||
\Log::debug('Walking results: '.$executionTime);
|
||||
$count = 0;
|
||||
|
||||
$formatter = new EscapeFormula("`");
|
||||
|
||||
foreach ($assets as $asset) {
|
||||
$count++;
|
||||
$row = [];
|
||||
|
@ -855,7 +858,7 @@ class ReportsController extends Controller
|
|||
$row[] = $asset->$column_name;
|
||||
}
|
||||
}
|
||||
fputcsv($handle, $row);
|
||||
fputcsv($handle, $formatter->escapeRecord($row));
|
||||
$executionTime = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'];
|
||||
\Log::debug('-- Record '.$count.' Asset ID:'.$asset->id.' in '.$executionTime);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue