Skip to content

Commit

Permalink
Merge pull request #2601 from phili67/phili67-geoutils-bugs
Browse files Browse the repository at this point in the history
src/EcclesiaCRM/utils/GeoUtils.php : bug res
  • Loading branch information
phili67 committed Apr 11, 2024
2 parents 85e7448 + 5a25421 commit b20eeb3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/EcclesiaCRM/utils/GeoUtils.php
Expand Up @@ -28,6 +28,15 @@ public static function getKey()

public static function getLatLong($address)
{
$lat = 0;
$long = 0;

if (empty($address)) {
return array(
'Latitude' => $lat,
'Longitude' => $long
);
}

$logger = LoggerUtils::getAppLogger();

Expand All @@ -39,8 +48,6 @@ public static function getLatLong($address)

$adapter = new Client(null, null, $options);

$lat = 0;
$long = 0;
try {
switch (SystemConfig::getValue("sMapProvider")) {
case "GoogleMaps":
Expand All @@ -64,7 +71,7 @@ public static function getLatLong($address)
}

$logger->debug("We have " . $result->count() . " results");
if (!empty($result)) {
if ($result->count() > 0) {
$firstResult = $result->get(0);
$coordinates = $firstResult->getCoordinates();
$lat = $coordinates->getLatitude();
Expand Down

0 comments on commit b20eeb3

Please sign in to comment.