When a radioactivity field is initialized in a single language environment, it gets the language "und" in the database.

However, if the radioactivity field is intended to be modified with a rule, the rule assumes a language, in my case "en". This results in a duplicated row in views, but with the "und" energy value used exclusively.

To fix this, I changed a single variable in radioactivity.module in the _radioactivity_update_energy function. I changed 'language' => $language to 'language' => 'und'.

Seeing as how it's numeric, I don't see why it would need to be translatable since translated nodes have a separate set of fields.

Comments

tcmug’s picture

Assigned: Unassigned » tcmug

Are you using the latest dev version?

The language should actually be 'und' (LANGUAGE_NONE) when the field content is not translatable:
radioactivity.rules.inc ln 49:

  $lang = LANGUAGE_NONE;

  if ($info['translatable']) {
    global $language;
    $lang = $language->language;
  }

I encountered similiar bug AFTER I had disabled content translation related modules; this left some of the content in a confused state in which point the above code failed.

neomenlo’s picture

I have never enabled any translation modules in this installation.

I was using a votingapi rules module. I am not familiar with all the data sent through rules, but perhaps the trigger is responsible, and not the action.
However, since radioactivity is a numeric field, should it really be translatable at all? Why not just set $lang to LANGUAGE_NONE always?

tcmug’s picture

I cant figure out how to reproduce this - but I'll leave this open and do some more tests when I have time.

The field is translatable because I don't want to force it not to be translatable - it should be up to the sites owner to decide (sites with multiple languages might need per language listings of popularity for instance).

tr’s picture

Issue summary: View changes
Status: Active » Closed (outdated)