Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SS 4.3.3 - csvBulkLoader - delimiter not used - bug easy to fix - solution in here #8881

Closed
lienajp opened this issue Mar 26, 2019 · 2 comments

Comments

@lienajp
Copy link

lienajp commented Mar 26, 2019

Affected Version SS4.3.3

Description

When uploading csv data through the csvBulkLoader, you cannot use another delimiter than the comma. The $delimiter variable is not used.

In vendor/silverstripe/framework/src/Dev/CsvBulkLoader.php
add the following line
$csvReader->setDelimiter($this->delimiter);
just after this code

protected function processAll($filepath, $preview = false)
    {
        $previousDetectLE = ini_get('auto_detect_line_endings');

        ini_set('auto_detect_line_endings', true);
        try {
            $filepath = Director::getAbsFile($filepath);
            $csvReader = Reader::createFromPath($filepath, 'r');

and now you can choose your own delimiter as mentioned in the doc.

Steps to Reproduce

just try to upload a csv file with a semi-column as separator and you will see that none of the values are filled in - It gives the feeling that the mapping is not done but it's just a delimiter problem.

Help us with step-by-step instructions.

See the line to add in the code to correct the bug.

I am sorry not to provide the solution the proper way (using forks etc...) but I am not familiar with git.

@lienajp lienajp changed the title SS 4.3.3 - csvBulkLoader - delimiter not used SS 4.3.3 - csvBulkLoader - delimiter not used - bug easy to fix - solution in here Apr 1, 2019
@dnsl48
Copy link
Contributor

dnsl48 commented Apr 2, 2019

Thank you for reporting the issue and providing the solution!

I am sorry not to provide the solution the proper way (using forks etc...) but I am not familiar with git.

You don't have to use git for one liner fixes. There's a way to make it through github if you'd like :)

@kinglozzer
Copy link
Member

Closed by #9082

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants