In version alpha6, mapping of boolean fields is broken. My existing mappings showed "missing" for every boolean field I wanted to import. Boolean fields aren't showing up in the list of possible targets.

Files: 
CommentFileSizeAuthor
#19 feeds-numeric-mapping-list-1815070-19.patch2.74 KBtwistor
PASSED: [[SimpleTest]]: [MySQL] 6,191 pass(es).
[ View ]
#18 no_more_mapping_for-1815070-18.patch1011 bytesjoelpittet
PASSED: [[SimpleTest]]: [MySQL] 6,191 pass(es).
[ View ]

Comments

heatherwoz’s picture

I just noticed this too. I'm on alpha7.

vollepeer’s picture

Is a fix for this issue planned in an upcoming release?

vollepeer’s picture

Version:7.x-2.0-alpha6» 7.x-2.0-alpha7
Sethie’s picture

Will this feature be implemented in an upcoming release?

Taxoman’s picture

Version:7.x-2.0-alpha7» 7.x-2.x-dev

if this is still a problem with the latest alpha8 release, it belongs in the -dev queue.

luisortizramos’s picture

Title:No more mapping for boolean fields» No more mapping for number fields
Component:Feeds Import» Code

I've the same problem.

I've hacked the module with some watchdogs in the mappers and the function 'number_feeds_processor_targets_alter' is never called (while the text version is called when I go to the feed edit page).

So it doen't allow us to map all the "number" fields. I'm changing the issue name.

Hope it helps and we can have a solution soon.

jsibley’s picture

There doesn't seem to be an update on this issue since June.

Is there any progress? Also not seeing boolean fields as targets for mapping.

jsibley’s picture

I'm not sure of the downside of this work-around, but I created text field versions of my boolean fields and specified values like "yes" and "no" and this seemed to work for importing from my D6 based csv file.

heatherwoz’s picture

Title:No more mapping for number fields» No more mapping for boolean fields

This issue is about boolean fields, so the title shouldn't be changed. luisortizramos, if you're having an issue with number fields, please open a separate issue. Or if it's somehow the same cause affecting both types of fields, rename the issue to reflect that and edit the issue summary.

luisortizramos’s picture

Title:No more mapping for boolean fields» No more mapping for numeric (boolean, decimal, integer, floats, and lists of them) fields

heatherwoz: boolean fields are a type of numeric fields in Drupal. No one of the different types of number fields are mappeable now, so the issue is really about all of them. If we solve the bug, it will be solved in the numeric field mapper (that includes the booleans, don't worry) so it's more informative for the person who takes time to solve the issue to title it like I did.

heatherwoz’s picture

Thanks, your new title is much more descriptive than just "number."

twistor’s picture

Status:Active» Postponed (maintainer needs more info)

Umm...

Can one of you guys give me a detailed setup? I cannot reproduce this, and we have numerous tests for the numeric mapper.

heatherwoz’s picture

I tried on a clean install and I do see those field types available as targets. But they don't show up on several sites that I've had running for a while, since the upgrade from alpha6. Seems like several others were in the same boat. I will keep testing and see if I can come up with any pattern/cause.

twistor’s picture

Assigned:Unassigned» twistor
Status:Postponed (maintainer needs more info)» Active

Ahh, I got it.

The quick workaround is to enable the number module.

The list_boolean field is covered by the number module in Feeds, but the number module is not required but the list module. We need to do a bit of dependency re-arranging.

Roar’s picture

Can confirm that a JSON field with a 'true' or 'false' value is not being scooped up, but when changed it to 0 or 1 the boolean fields reflected correctly in Drupal.

mikelaroy’s picture

Issue summary:View changes

I've been trying to map to a float list and have been unsuccessful, even with the number module enabled (which it seems to be by default).

Johann Wagner’s picture

Thanks Twistor #14, enabling the Number modules allows me to map boolean fields.

joelpittet’s picture

Status:Active» Needs review
StatusFileSize
new1011 bytes
PASSED: [[SimpleTest]]: [MySQL] 6,191 pass(es).
[ View ]

For boolean it gets this callback:
number_feeds_set_target

Which checks is_numeric(). But booleans aren't numeric:
http://3v4l.org/I6b2Y

Suggest that they are checked and set accordingly, see patch. Hope this helps.

twistor’s picture

StatusFileSize
new2.74 KB
PASSED: [[SimpleTest]]: [MySQL] 6,191 pass(es).
[ View ]

This is a bit more correct, so much boilerplate :/

joelpittet’s picture

That does look much better, couple of questions:

  1. +++ b/mappers/list.inc
    @@ -0,0 +1,63 @@
    +function _list_feeds_set_boolean_target(FeedsSource $source, $entity, $target, array $values, array $mapping = array()) {

    Is there a reason you went with a private function here but for the others are using public function naming conventions?

  2. +++ b/mappers/list.inc
    @@ -0,0 +1,63 @@
    +    $field['und'][] = array('value' => (int) (bool) $value);

    Can we use the LANGUAGE_NONE constant here too?

    $field[LANGUAGE_NONE][]['value'] = (int) (bool) $value;

  • twistor committed e2973d1 on 7.x-2.x
    Issue #1815070 by twistor, joelpittet: No more mapping for numeric (...
twistor’s picture

Assigned:twistor» Unassigned
Status:Needs review» Fixed

Thanks @joelpittet, fixed that.

Thanks to all for reporting and helping debug.

Status:Fixed» Closed (fixed)

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