Commit 289cbfbb authored by mattwire's avatar mattwire
Browse files

Fix populating town/city for multiple providers

parent ee748ccf
......@@ -117,10 +117,11 @@ class CRM_Civicrmpostcodelookup_Page_Afd extends CRM_Civicrmpostcodelookup_Page_
$address = ['id' => $moniker];
$addressItem = (array) $simpleXMLData->Address;
$address["street"] = empty($addressItem['Street']) ? '':$addressItem['Street'];
$address["locality"] = empty($addressItem['Locality']) ? '':$addressItem['Locality'];
$address["town"] = empty($addressItem['Town']) ? '':$addressItem['Town'];
$address["postcode"] = empty($addressItem['Postcode']) ? '':$addressItem['Postcode'];
$address['street_address'] = empty($addressItem['Street']) ? '':$addressItem['Street'];
$address['locality'] = empty($addressItem['Locality']) ? '':$addressItem['Locality'];
$address['city'] = empty($addressItem['Town']) ? '':$addressItem['Town'];
$address['postcode'] = empty($addressItem['Postcode']) ? '':$addressItem['Postcode'];
$address['country_id'] = 1226;
##Close the XML source##
fclose($filetoparse);
......
......@@ -169,16 +169,17 @@ class CRM_Civicrmpostcodelookup_Page_Civipostcode extends CRM_Civicrmpostcodeloo
}
if (!empty($addressLines[0])) {
$address["street_address"] = $addressLines[0];
$address['street_address'] = $addressLines[0];
}
if (!empty($addressLines[1])) {
$address["supplemental_address_1"] = $addressLines[1];
$address['supplemental_address_1'] = $addressLines[1];
}
if (!empty($addressLines[2])) {
$address["supplemental_address_2"] = $addressLines[2];
$address['supplemental_address_2'] = $addressLines[2];
}
$address["town"] = (string) $addressObj->post_town;
$address["postcode"] = (string) $addressObj->postcode;
$address['city'] = (string) $addressObj->post_town;
$address['postcode'] = (string) $addressObj->postcode;
$address['country_id'] = 1226;
return $address;
}
......
......@@ -114,16 +114,17 @@ class CRM_PostcodeLookup_Page_Ajax extends CRM_Civicrmpostcodelookup_Page_Postco
$address["line{$lineCounter}"] = $line->Line;
break;
case 'Town':
$address["town"] = $line->Line;
$address['city'] = $line->Line;
break;
case 'County':
$address["county"] = $line->Line;
$address['county'] = $line->Line;
break;
case 'Postcode':
$address["postcode"] = $line->Line;
$address['postcode'] = $line->Line;
break;
}
}
$address['country_id'] = 1226;
return $address;
}
......
......@@ -125,19 +125,20 @@ class CRM_Civicrmpostcodelookup_Page_PostcodeAnywhere extends CRM_Civicrmpostcod
$addressLineArray[] = $addressItem['@attributes']['Line4'];
$addressLineArray[] = $addressItem['@attributes']['Line5'];
$addressLineArray = array_filter($addressLineArray);
$address["street_address"] = @implode(', ', $addressLineArray);
$address['street_address'] = @implode(', ', $addressLineArray);
$address["supplemental_address_1"] = $addressItem['@attributes']['SecondaryStreet'];
$address["supplemental_address_2"] = $addressItem['@attributes']['DependentLocality'];
$address['supplemental_address_1'] = $addressItem['@attributes']['SecondaryStreet'];
$address['supplemental_address_2'] = $addressItem['@attributes']['DependentLocality'];
$address["town"] = $addressItem['@attributes']['PostTown'];
$address['city'] = $addressItem['@attributes']['PostTown'];
$address["postcode"] = $addressItem['@attributes']['Postcode'];
$address['postcode'] = $addressItem['@attributes']['Postcode'];
$address["state_province_id"] = '';
$address['state_province_id'] = '';
if ($stateId = array_search($addressItem['@attributes']['County'], $states)) {
$address["state_province_id"] = $stateId;
$address['state_province_id'] = $stateId;
}
$address['country_id'] = 1226;
return $address;
}
......
Supports Markdown
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