When pushing an entity from Drupal to Salesforce with a field that does not have a value you see a pair of errors:

Notice: Undefined variable: value in salesforce_mapping_property_fieldmap_push_value() (line 318 of /salesforce/modules/salesforce_mapping/includes/salesforce_mapping.fieldmap_type.inc).
Notice: Undefined variable: value in salesforce_mapping_property_fieldmap_push_value() (line 329 of /salesforce/modules/salesforce_mapping/includes/salesforce_mapping.fieldmap_type.inc).

This repeats for each instance of a field with a missing value on the entity. This is due to the $value variable being uninitialized in salesforce_mapping_property_fieldmap_push_value() because it is set within a try. So when the try fails because the field has no value then the $value variable is not set at all resulting in the above notices.

This can be fixed by adding:

$value = NULL;

either within the catch or at the start of the function.

Comments

kostajh’s picture

Status: Needs review » Active

Thanks for the report @gilgabar. Can you roll a patch for review?

gilgabar’s picture

Status: Active » Needs review
StatusFileSize
new712 bytes

I normally wouldn't consider a patch necessary for a one-liner like this. It's easier to copy/paste than to download/apply a patch. But here you go.

kostajh’s picture

Thanks. It makes life a little bit easier - I can just use `drush am 1986966` to review the code (https://drupal.org/project/drush_iq).

kostajh’s picture

Status: Needs review » Fixed

Committed, thank you!

gilgabar’s picture

Thanks, I hadn't seen drush_iq before. I'll have to give it a try. And thank you for the fast commit.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit cf6a22d on 7.x-3.x, 8.x-3.x, process-deleted-refactor authored by gilgabar, committed by kostajh:
    Issue #1986966 by gilgabar: Notice: Undefined variable: value in...

  • Commit cf6a22d on 7.x-3.x, 8.x-3.x, mapped-object-ui authored by gilgabar, committed by kostajh:
    Issue #1986966 by gilgabar: Notice: Undefined variable: value in...