From a1f47267c85ea47cb9ba5dc76d7de694baccd497 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Tue, 20 Jul 2021 20:35:42 +0200 Subject: [PATCH] Building/Form: get gps again, if address changed --- Layout/default/Building/Form.php | 16 ++++++++++++++++ application/Building/BuildingController.php | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Layout/default/Building/Form.php b/Layout/default/Building/Form.php index 20e32613a..2be0e3670 100644 --- a/Layout/default/Building/Form.php +++ b/Layout/default/Building/Form.php @@ -87,6 +87,13 @@ + +
@@ -353,6 +360,11 @@ $("#edit-gps").remove(); } + function showGpsAgain() { + $("#gps-again").show(); + $("#gps-again input[type=checkbox").prop("checked", true); + } + gps_lat && $building->gps_long): ?> //////////// @@ -381,6 +393,10 @@ + $("#street, #zip, #city").change(function() { + showGpsAgain(); + }); + $("#edit-gps").click( function() { enableGpsInputs(); }); diff --git a/application/Building/BuildingController.php b/application/Building/BuildingController.php index 33f1a9dea..6b84f28fc 100644 --- a/application/Building/BuildingController.php +++ b/application/Building/BuildingController.php @@ -113,7 +113,7 @@ class BuildingController extends mfBaseController { } // get GPS location - if(!$building->gps_lat && !$building->gps_long) { + if((!$building->gps_lat && !$building->gps_long) || $r->gps_again ) { $search = [ 'country' => "AT", 'city' => $building->city, @@ -134,7 +134,7 @@ class BuildingController extends mfBaseController { $building->code = $building->getNewObjectCode(); $building->save(); } - if(!$building->laea) { + if(!$building->laea || $r->gps_again) { $building->laea = $building->getLaeaCoordinates(); $building->save(); }