When importing via CSV I'm mapping to a boolean field that is not required, values of 0 and 1 work correctly, but NULL results in a 0 rather than the field being blank. In feeds preview, the value shows up as "None". Mapping the same field to a text or integer or list integer work fine.

I'm using Feeds 7.x-2.0-beta1+15-dev (2015-Oct-25)

Comments

troybthompson created an issue. See original summary.

megachriz’s picture

Ah, apparently in #1107522: Framework for expected behavior when importing empty/blank values + text field fix I forgot to include tests for all the "list" targets. I'm currently busy with other Feeds issues. Could you write a test for clearing out values for all the list targets and that confirms this bug? You could use FeedsMapperFieldTestCase::testClearOutValues() from tests/feeds_mapper_field.test as an example. Put the test in a new file called "feeds_mapper_list.test". Else it could take a while before I have time to address this issue.
By the way, great that you are trying out the Feeds import preview module! :)

troybthompson’s picture

Unfortunately, I'm not a programmer, and looking at the other test files in there, I don't think I have the skills to even hack something together. Sorry. Basically on my website, I mapped it to a boolean, integer, list integer, and text, and all but the boolean worked correctly when actually imported.

Yes, the preview has been very helpful to me to see what's going on while doing some crazy imports and conversions. Thanks!

megachriz’s picture

Status: Active » Needs review
StatusFileSize
new9.64 KB

No problem, trobythompson.

Attached is a patch with an automated test only to demonstrate the problem. So the patch should fail tests. Writing this test was a bit harder than I had thought at first. For lists fields I needed to use assertOptionSelected() instead of assertNodeFieldValue(). For the boolean field this was assertFieldChecked(). Took me some time to notice.

A fix is not yet included.

Status: Needs review » Needs work

The last submitted patch, 4: feeds-boolean-empty-2602508-4-tests-only.patch, failed testing.

megachriz’s picture

Status: Needs work » Needs review
StatusFileSize
new10.21 KB

It think that this patch fixes the issue.

megachriz’s picture

Status: Needs review » Fixed

Committed #6.

  • MegaChriz committed 99d3437 on 7.x-2.x
    Issue #2602508 by MegaChriz: Fixed clear out boolean field when an empty...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.