Commit bb8c64ca authored by mattwire's avatar mattwire
Browse files

Fix PHP notice

parent 68112be6
......@@ -49,21 +49,23 @@ class CRM_Civicrmpostcodelookup_Page_Civipostcode extends CRM_Civicrmpostcodeloo
// Open the JSON document
$filetoparse = fopen("$querystring", "r") or die("Error reading JSON data.");
$data = stream_get_contents($filetoparse);
// Close the JSON source
fclose($filetoparse);
$simpleJSONData = json_decode($data);
$addressList = NULL;
if (!empty($simpleJSONData)) {
if ($simpleJSONData->is_error == 1) {
$addresslist[0]['value'] = '';
$addresslist[0]['label'] = $simpleJSONData->error;
$addressList[0]['value'] = '';
$addressList[0]['label'] = $simpleJSONData->error;
}
else {
$addresslist = self::getAddressList($simpleJSONData, $postcode);
$addressList = self::getAddressList($simpleJSONData, $postcode);
}
}
// Close the JSON source
fclose($filetoparse);
echo json_encode($addresslist);
echo json_encode($addressList);
exit;
}
......
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