X-Git-Url: https://git.cweiske.de/auerswald-callnotifier.git/blobdiff_plain/153fb4f6a68fafd7598ed3739795815d12fc0472..1b28b0289cdcb6adcbd496be07fda3a5ec705bfd:/src/callnotifier/CallMonitor/Detailler/OpenGeoDb.php diff --git a/src/callnotifier/CallMonitor/Detailler/OpenGeoDb.php b/src/callnotifier/CallMonitor/Detailler/OpenGeoDb.php index 2b48004..46711b0 100644 --- a/src/callnotifier/CallMonitor/Detailler/OpenGeoDb.php +++ b/src/callnotifier/CallMonitor/Detailler/OpenGeoDb.php @@ -58,9 +58,13 @@ class CallMonitor_Detailler_OpenGeoDb implements CallMonitor_Detailler public function loadCallDetails(CallMonitor_Call $call) { if ($call->type == CallMonitor_Call::INCOMING) { - $call->fromLocation = $this->loadLocation($call->from); + if (!isset($call->fromLocation) || $call->fromLocation === null) { + $call->fromLocation = $this->loadLocation($call->from); + } } else { - $call->toLocation = $this->loadLocation($call->to); + if (!isset($call->toLocation) || $call->toLocation === null) { + $call->toLocation = $this->loadLocation($call->to); + } } } @@ -85,6 +89,12 @@ class CallMonitor_Detailler_OpenGeoDb implements CallMonitor_Detailler . ' OR vorwahl = ' . $this->db->quote(substr($number, 0, 6)) . ' ORDER BY einwohner DESC' ); + if ($stm === false) { + throw new \Exception( + implode(' - ', $this->db->errorInfo()) + ); + } + $res = $stm->fetch(); if ($res === false) { return null;