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?

CommentFileSizeAuthor
#4 sf_node-checkbox-1515610.patch277 bytesaaronbauman

Comments

mtbosworth’s picture

If I output the object after salesforce_api_fieldmap_export_create(). The values are incorrect based on what is in the database.

mtbosworth’s picture

Digging 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.

mtbosworth’s picture

Here is a list of what the empty function recognizes : http://php.net/manual/en/function.empty.php

aaronbauman’s picture

Status: Active » Needs review
StatusFileSize
new277 bytes

_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.

kostajh’s picture

@mtbosworth have you tried the patch from #4?

kostajh’s picture

Component: sf_node » Code
Status: Needs review » Closed (cannot reproduce)