I am using the Salesforce module with the Location module to track addresses for users. Updates made to Salesforce fields mapped to Location module fields do not update in Drupal when the import process is run. The problem is in _sf_contrib_import_location(), specifically in loop that updates address fields when a primary address is set:
foreach ($object->locations as $location) {
if ($location['is_primary'] == 1) {
$location[$drupal_fieldname] = $sf_data->{$sf_fieldname};
return;
}
}The passed in object (a node in this case), is passed in by reference, but the loop just updates a variable local to the function foreach loop: $location. Unless I'm missing something, I can't see any reason why it shouldn't just update the object directly (since only $object is passed by reference, and the whole point of sf_node_import() is to make changes to $node):
foreach ($object->locations as $location) {
if ($location['is_primary'] == 1) {
$object->locations[0][$drupal_fieldname] = $sf_data->{$sf_fieldname};
return;
}
}I've confirmed this fixes the issue on my installation. Patch coming shortly.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | salesforce-fix_location_data_not_being_updated_on_import-1870736-1.patch | 547 bytes | jemond |
| #1 | salesforce-fix_location_data_not_being_updated_on_import-1870736-1.patch | 536 bytes | jemond |
Comments
Comment #1
jemond commentedPatch to fix issue attached.
Comment #2
jemond commentedSmall bug in my patch. Attached fixed patch.
Comment #2.0
jemond commentedFix typo
Comment #3
aaronbaumanclosing all 6.x issues