Commit 2f8c5645 authored by Jamie McClelland's avatar Jamie McClelland

ensure we do proper matching fields with address fields.

parent 78e5630f
...@@ -918,13 +918,10 @@ function petitionemail_get_recipients($contact_id, $petition_id) { ...@@ -918,13 +918,10 @@ function petitionemail_get_recipients($contact_id, $petition_id) {
} }
$location_name = $field_pieces['location_name']; $location_name = $field_pieces['location_name'];
$field_name = $field_pieces['field_name']; $field_name = $field_pieces['field_name'];
// NOTE: we only work with primary fields.
if($location_name == 'Primary' && array_key_exists($field_name, $contact)) { if($location_name == 'Primary' && array_key_exists($field_name, $contact)) {
// We have to unset the field that was saved as fieldname-locatiname // The field name returned by the API won't have the -location part.
unset($matching_fields[$matching_field]); $matching_fields[$matching_field] = $contact[$field_name];
// And now set the proper key
$matching_field = $field_name;
$matching_fields[$matching_field] = $contact[$matching_field];
continue; continue;
} }
else { else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment