Closed (won't fix)
Project:
Button Field
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 Jan 2011 at 10:07 UTC
Updated:
27 Jan 2011 at 17:16 UTC
I've made this custom action that updates a cck field value on the db.
function miocsv_setexported_action(&$object, $context = array()) {
[...]
if ($nid) {
$data = new stdClass();
$data->nid = $nid;
$data->field_flag_esportato_value = 1;
drupal_write_record('content_type_scheda', $data, array('nid'));
content_clear_type_cache();
// record a message noting the action taken
watchdog('action', 'Esportata la scheda %title', array('%title' => $title, '%nid' => $nid));
break;
}
}
Later I've created a field_button that fires this custom action using a rule.
It updates the field on the db only if I leave the break; line, thus forbidding to fire another action in the same rule.
When debugging with firebug I see an error that says "Fatal error: Cannot break/continue 1 level in ... miocsv.module", apparently related to json_encode.
If I take off the break; line or replace with a return false; one the field on the db is no more updated, even though drupal_write_record() returns SAVED_UPDATED value.
Comments
Comment #1
BassistJimmyJam commentedHave you tried your rule on a trigger other than the button to click to verify that it is not a problem with either your rule or the rules module itself?
Comment #2
geordie__ commentedIt works with a trigger but not with other rules. Then you can close the bug since it's not button_field strictly related.
I've tried this implementation (http://drupal.org/node/973068) based on node_load and node_save.
If I add a line with
var_dump(node);die;it says the field has been modified. There's something that overwrites my changes and I can't identify it.Comment #3
BassistJimmyJam commentedI'm closing this since it is not directly related to button_field. I would suggest you try turning on rule debugging at /admin/rules/settings if you have not already and see if there is another rule clearing your field.