Check entity type is set on webform settings before compare #146
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Webforms with phones and selectable type are not retrieving data from contacts on webform load. The user sees as if no information was previously saved and once the user saves data (if any) will be overwritten.
Before
Same Initial data. Showing type and location for phone.

Phone field configured with type selectable by the user.

Retrieving phone data without checking existence of type index on webform settings causes data to be seen as different from the webform configuration, thus not showing any phone related data at all from the contact.

After
Repeat steps 1 to 3 from "Before".
Information is now retrieved correctly, producing expected results on save.

Technical Details
Attaching exported webform with node export:
webform-phone-with-selectable-type.txt
Site created for testing with civibuild using this command
civibuild create civi12 --type drupal-demo --civi-ver 4.7.27 --url http://civi12 --web-root /home/beto/buildkit/build/civi12
CiviCRM currently uses civicrm_webform 7.20, however this module was replaced with the last version found here https://github.com/colemanw/webform_civicrm