Added AddressDB bulk update + address update in rimo

This commit is contained in:
Frank Schubert
2025-09-19 11:33:19 +02:00
parent 80cdbcb4ca
commit 67d259ac13
4 changed files with 41 additions and 5 deletions
+2 -2
View File
@@ -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;
+28 -2
View File
@@ -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;
}