diff --git a/application/controllers/json.php b/application/controllers/json.php index b7bb44669a..0f3a0896e2 100644 --- a/application/controllers/json.php +++ b/application/controllers/json.php @@ -188,7 +188,19 @@ protected function markers_geojson($incidents, $category_id, $color, $icon, $inc } } - $link = url::site("reports/view/".$marker->id); + // Get URL from object, fallback to Incident_Model::get() if object doesn't have url or url() + if (method_exists($marker, 'url')) + { + $link = $marker->url(); + } + elseif (isset($marker->url)) + { + $link = $marker->url; + } + else + { + $link = Incident_Model::get_url($marker); + } $item_name = $this->get_title($marker->incident_title, $link); $json_item = array();