I'm debugging some issues locally having to do with checkboxes. I can see from dd() outputs that I put in sf_node.module that the checkbox export function is working correctly. However, at hook_salesforce_api_pre_export() the values are different. In my case, I have three checkboxes. The value should be 1, 0, 0 and it is at export checkbox function, but at pre_export it is 1,1,1. I noticed that if I visit this nodes salesforce tab (node/%/salesforce), the values are 1,1,1 even though the values in the db are 1,0,0. ???? Is there some sort of caching going on here? It should be noted that I am using the ajax module to submit the node forms. Could there be a conflict there?
Comments
Comment #1
mtbosworth commentedIf I output the object after salesforce_api_fieldmap_export_create(). The values are incorrect based on what is in the database.
Comment #2
mtbosworth commentedDigging deeper, I found that my checkbox fields, which are integer with the onoff widget, where coming in as 'false' (string). The empty() function being applied on line 992 of salesforce_api.module does not recognize this as empty so it gets set to at 1 when it is exported. I fixed the issue by adding an 'or' to the conditional like this:
if (empty($value) || $value == 'false') {
Now the node/%/salesforce page is displaying correctly and the export is correct.
Comment #3
mtbosworth commentedHere is a list of what the empty function recognizes : http://php.net/manual/en/function.empty.php
Comment #4
aaronbauman_sf_node_export_cck_checkbox() needs to return 1 or 0.
I think this is a relic from when SF API only accepted "true" and "false" (strings) for boolean values.
Comment #5
kostajh commented@mtbosworth have you tried the patch from #4?
Comment #6
kostajh commented