diff --git a/Layout/default/AddressDB/Index.php b/Layout/default/AddressDB/Index.php
index bf5eaf78c..21afbde8b 100644
--- a/Layout/default/AddressDB/Index.php
+++ b/Layout/default/AddressDB/Index.php
@@ -318,6 +318,14 @@
=$address->rollout?> |
=$address->rollout_info?> |
+ is("Admin")): ?>
+ $address->id])?>" title="Adressdaten nach Rimo exportieren">
+
+
+
+
$address->id])?>">
$address->id])?>" class="pl-1">
$address->id])?>" onclick="if(!confirm('Addresse und alle Wohneinheiten wirklich löschen?')) return false;">
diff --git a/application/ADBHausnummer/ADBHausnummer.php b/application/ADBHausnummer/ADBHausnummer.php
index 4770c0f2a..5e0d38397 100644
--- a/application/ADBHausnummer/ADBHausnummer.php
+++ b/application/ADBHausnummer/ADBHausnummer.php
@@ -57,7 +57,7 @@ class ADBHausnummer extends mfBaseModel {
return true;
}
- private function updateAddressInRimo() {
+ public function updateAddressInRimo() {
if(!$this->rimo_id) return false;
$creds = $this->getNetownerRimoApiCredentials();
if(!$creds) {
@@ -66,7 +66,7 @@ class ADBHausnummer extends mfBaseModel {
$update_data = [];
if($this->strasse_id && $this->getProperty("strasse")->name) $update_data["address"] = $this->getProperty("strasse")->name;
- if($this->ortschaft_id && $this->getProperty("ort")->name) $update_data["city"] = $this->getProperty("ort")->name;
+ if($this->ortschaft_id && $this->getProperty("ortschaft")->name) $update_data["city"] = $this->getProperty("ortschaft")->name;
if($this->plz_id && $this->getProperty("plz")->plz) $update_data["zipCode"] = $this->getProperty("plz")->plz;
if($this->strasse_id && $this->getProperty("strasse")->gemeinde_id && $this->getProperty("strasse")->gemeinde->name) $update_data["district"] = $this->getProperty("strasse")->gemeinde->name;
diff --git a/application/AddressDB/AddressDBController.php b/application/AddressDB/AddressDBController.php
index fc697b8a9..c491cf599 100644
--- a/application/AddressDB/AddressDBController.php
+++ b/application/AddressDB/AddressDBController.php
@@ -783,6 +783,32 @@ class AddressDBController extends mfBaseController {
}
}*/
+ protected function syncAddressToRimoAction() {
+ if(!$this->me->is("Admin")) {
+ $this->redirect("AddressDB");
+ }
+
+ $hausnummer_id = $this->request->id;
+ if(!$hausnummer_id) {
+ $this->layout()->setFlash("Adresse nicht gefunden", "error");
+ $this->redirect("AddressDB");
+ }
+
+ $hausnummer = new ADBHausnummer($hausnummer_id);
+ if(!$hausnummer->id) {
+ $this->layout()->setFlash("Adresse nicht gefunden", "error");
+ }
+
+ if(!$hausnummer->updateAddressInRimo()) {
+ $this->layout()->setFlash("Fehler beim updaten der Adresse in Rimo", "error");
+ $this->redirect("AddressDB");
+ }
+
+ $this->layout()->setFlash("Adresse erfolgreich nach Rimo synchronisiert", "success");
+ $this->redirect("AddressDB");
+
+ }
+
protected function saveBulkupdateAction() {
if(!$this->me->is("Admin")) {
$this->redirect("AddressDB");
@@ -811,7 +837,7 @@ class AddressDBController extends mfBaseController {
$u = 0;
if(ADBHausnummerModel::count($filter, true) > 1000) {
- $this->layout()->setFlas("Bissi viel auf einmal");
+ $this->layout()->setFlash("Bissi viel auf einmal");
}
$cache = [];
@@ -908,7 +934,7 @@ class AddressDBController extends mfBaseController {
$hausnummer->strasse_id = $strasse->id;
$updated = true;
}
- if($plz_search && $hausnummer->plz != $plz->id) {
+ if($plz_search && $hausnummer->plz_id != $plz->id) {
$hausnummer->plz_id = $plz->id;
$updated = true;
}
diff --git a/lib/Rimoapi/Rimoapi.php b/lib/Rimoapi/Rimoapi.php
index b40a22c62..e58de712a 100644
--- a/lib/Rimoapi/Rimoapi.php
+++ b/lib/Rimoapi/Rimoapi.php
@@ -36,14 +36,16 @@ class Rimoapi {
$createOrderEp = RIMO_API_JSON_URL.RIMO_API_JSON_EP_CHANGE_BUILDING_ADDRESS;
$put_url = $createOrderEp."?".$qs;
$ctx = stream_context_create($ctx_opts);
- $log->debug(__METHOD__.": Creating OAID in Rimo: $put_url");
+ $log->debug(__METHOD__.": Address Change in Rimo: $put_url");
$response = file_get_contents($put_url, false, $ctx);
//var_dump($response);exit;
+ $log->debug(__METHOD__.": response: ".print_r($response,true));
if($response === false) {
$log->error("Fehler beim Update der Adresse in RIMO ".$building_external_id);
return false;
}
+
$resp_data = json_decode($response);
if(!$resp_data->id) return false;
|