Skip to content

Commit

Permalink
Fixed issue #9317: Participants CSV import ignores delimiter setting
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Nov 13, 2014
1 parent b4613db commit 8d1ea96
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions application/controllers/admin/participantsaction.php
Expand Up @@ -1097,10 +1097,20 @@ function attributeMapCSV()
$sFileName = $_FILES['the_file']['name'];

$regularfields = array('firstname', 'participant_id', 'lastname', 'email', 'language', 'blacklisted', 'owner_uid');
$csvread = fopen($sFilePath, 'r');
$oCSVFile = fopen($sFilePath, 'r');
$aFirstLine = fgets($oCSVFile);
rewind($oCSVFile);

$separator = Yii::app()->request->getPost('separatorused');
$firstline = fgetcsv($csvread, 1000, ',');
$sSeparator = Yii::app()->request->getPost('separatorused');
if ($sSeparator=='auto')
{
$aCount[',']=substr_count($aFirstLine,',');
$aCount[';']=substr_count($aFirstLine,';');
$aCount['|']=substr_count($aFirstLine,'|');
$aResult = array_keys($aCount, max($aCount));
$sSeparator=$aResult[0];
}
$firstline = fgetcsv($oCSVFile, 1000, $sSeparator[0]);
$selectedcsvfields = array();
foreach ($firstline as $key => $value)
{
Expand Down

0 comments on commit 8d1ea96

Please sign in to comment.