Merge pull request #9127 from turbo124/v5-develop

Updates for delimiter detection
This commit is contained in:
David Bomba 2024-01-10 13:06:34 +11:00 committed by GitHub
commit 9fee64018d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View File

@ -140,6 +140,10 @@ class BaseImport
$delimiters = [',', '.', ';', '|']; $delimiters = [',', '.', ';', '|'];
$bestDelimiter = ','; $bestDelimiter = ',';
$count = 0; $count = 0;
// 10-01-2024 - A better way to resolve the csv file delimiter.
$csvfile = substr($csvfile, 0, strpos($csvfile, "\n"));
foreach ($delimiters as $delimiter) { foreach ($delimiters as $delimiter) {
if (substr_count(strstr($csvfile, "\n", true), $delimiter) >= $count) { if (substr_count(strstr($csvfile, "\n", true), $delimiter) >= $count) {
@ -162,7 +166,6 @@ class BaseImport
private function groupTasks($csvData, $key) private function groupTasks($csvData, $key)
{ {
nlog($csvData[0]);
if (! $key || !is_array($csvData) || count($csvData) == 0 || !isset($csvData[0]['task.number']) || empty($csvData[0]['task.number'])) { if (! $key || !is_array($csvData) || count($csvData) == 0 || !isset($csvData[0]['task.number']) || empty($csvData[0]['task.number'])) {
return $csvData; return $csvData;

View File

@ -180,4 +180,4 @@
], ],
"minimum-stability": "dev", "minimum-stability": "dev",
"prefer-stable": true "prefer-stable": true
} }

View File

@ -1,3 +1,4 @@
{ {
"Admin": true "Admin": true,
} "Ronin": true
}