@@ -174,11 +172,9 @@
| =$address->ortschaft->name?> |
=$address->strasse->name?> |
=$address->hausnummer?> |
+ =count($address->wohneinheiten)?> |
=$address->rollout?> |
=$address->rollout_info?> |
- |
- |
- |
is("Admin")): ?>
$address->id])?>">
diff --git a/application/ADBHausnummer/ADBHausnummer.php b/application/ADBHausnummer/ADBHausnummer.php
index dda8835e2..01bd1b7b0 100644
--- a/application/ADBHausnummer/ADBHausnummer.php
+++ b/application/ADBHausnummer/ADBHausnummer.php
@@ -6,6 +6,7 @@ class ADBHausnummer extends mfBaseModel {
private $strasse;
private $plz;
private $freigaben = [];
+ private $wohneinheiten = [];
protected function init() {
$this->db = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME);
@@ -105,6 +106,17 @@ class ADBHausnummer extends mfBaseModel {
}
return $this->plz;
}
+
+ if($name == "wohneinheiten") {
+ $this->wohneinheiten = mfValuecache::singleton()->get("adbWohneinheiten-hausnummer-".$this->id);
+ if($this->wohneinheiten === null) {
+ $this->wohneinheiten = ADBWohneinheitModel::search(['hausnummer_id' => $this->id]);
+ if($this->wohneinheiten) {
+ mfValuecache::singleton()->set("adbWohneinheiten-hausnummer-".$this->id, $this->wohneinheiten);
+ }
+ }
+ return $this->wohneinheiten;
+ }
$classname = ucfirst($name);
$idfield = $name."_id";
diff --git a/application/Api/v1/AddressdbApicontroller.php b/application/Api/v1/AddressdbApicontroller.php
index 9dc91233c..a0fd5353a 100644
--- a/application/Api/v1/AddressdbApicontroller.php
+++ b/application/Api/v1/AddressdbApicontroller.php
@@ -378,7 +378,8 @@ class AddressdbApicontroller extends mfBaseApicontroller {
'oaid' => $data->hausnummer_oaid,
'cluster_id' => $data->netzgebiet_extref,
'zip' => $data->plz,
- 'city' => ($this->district_is_city) ? $data->ortschaft : $data->gemeinde,
+ 'city' => $data->gemeinde,
+ "municipality" => "",
'district' => $data->ortschaft,
'street' => $data->strasse,
'housenumber' => $housenumber,
@@ -391,6 +392,12 @@ class AddressdbApicontroller extends mfBaseApicontroller {
'preorderTypes' => $ptypes,
'units' => []
];
+ if($this->district_is_city) {
+ $tmp_addresses[$address_key]['city'] = $data->ortschaft;
+ $tmp_addresses[$address_key]['municipality'] = $data->gemeinde;
+ } else {
+ unset($tmp_addresses[$address_key]['municipality']);
+ }
}
$tmp_addresses[$address_key]['units'][] = [
@@ -493,6 +500,9 @@ class AddressdbApicontroller extends mfBaseApicontroller {
$new_address['housenumber'] = $ta['housenumber'];
$new_address['zip'] = $ta['zip'];
$new_address['city'] = $ta['city'];
+ if(array_key_exists("municipality", $ta)) {
+ $new_address['municipality'] = $ta['municipality'];
+ }
$new_address['district'] = $ta['district'];
$new_address['lot_number'] = $ta['lot_number'];
$new_address['building_unit_count'] = $ta['building_unit_count'];
@@ -612,7 +622,8 @@ class AddressdbApicontroller extends mfBaseApicontroller {
'oaid' => $data->hausnummer_oaid,
'cluster_id' => $data->netzgebiet_extref,
'zip' => $data->plz,
- 'city' => ($this->district_is_city) ? $data->ortschaft : $data->gemeinde,
+ 'city' => $data->gemeinde,
+ "municipality" => "",
'district' => $data->ortschaft,
'street' => $data->strasse,
'housenumber' => $housenumber,
@@ -625,6 +636,12 @@ class AddressdbApicontroller extends mfBaseApicontroller {
'preorderTypes' => $ptypes,
'units' => []
];
+ if($this->district_is_city) {
+ $tmp_addresses[$address_key]['city'] = $data->ortschaft;
+ $tmp_addresses[$address_key]['municipality'] = $data->gemeinde;
+ } else {
+ unset($tmp_addresses[$address_key]['municipality']);
+ }
}
$tmp_addresses[$address_key]['units'][] = [
@@ -655,6 +672,9 @@ class AddressdbApicontroller extends mfBaseApicontroller {
$new_address['housenumber'] = $ta['housenumber'];
$new_address['zip'] = $ta['zip'];
$new_address['city'] = $ta['city'];
+ if(array_key_exists("municipality", $ta)) {
+ $new_address['municipality'] = $ta['municipality'];
+ }
$new_address['district'] = $ta['district'];
$new_address['lot_number'] = $ta['lot_number'];
$new_address['building_unit_count'] = $ta['building_unit_count'];
diff --git a/application/Api/v1/PreorderApicontroller.php b/application/Api/v1/PreorderApicontroller.php
index 3d423fb41..4c47c202f 100644
--- a/application/Api/v1/PreorderApicontroller.php
+++ b/application/Api/v1/PreorderApicontroller.php
@@ -319,7 +319,7 @@ class PreorderApicontroller extends mfBaseApicontroller {
} else {
// if all unit values are empty try to find the unit with all empty values
// failure is not an error, but must be checked by a human at some point
- $where = "hausnummer_id=".$address->hausnummer_id." AND (block = '' OR block IS NULL) AND (stiege = '' OR stiege IS NULL) AND (stock = '' OR stock IS NULL) AND (tuer = '' OR tuer IS NULL) AND (bezeichner = '' OR bezeichner IS NLL)";
+ $where = "hausnummer_id=".$address->hausnummer_id." AND (block = '' OR block IS NULL) AND (stiege = '' OR stiege IS NULL) AND (stock = '' OR stock IS NULL) AND (tuer = '' OR tuer IS NULL) AND (bezeichner = '' OR bezeichner IS NULL)";
if($zusatz) {
$where .= " AND zusatz='$zusatz'";
} else {
diff --git a/application/Preorder/Preorder.php b/application/Preorder/Preorder.php
index 0cd6d6548..c511574f2 100644
--- a/application/Preorder/Preorder.php
+++ b/application/Preorder/Preorder.php
@@ -42,6 +42,8 @@ class Preorder extends mfBaseModel {
$hausnummer = $this->getProperty("adb_hausnummer");
$wohneinheit = $this->getProperty("adb_wohneinheit");
+ $campaign = $this->getProperty("campaign");
+
$a = [];
$a['code'] = strtoupper($this->ucode);
@@ -65,6 +67,7 @@ class Preorder extends mfBaseModel {
$address['housenumber'] = $hausnummer->hausnummer;
$address['zip'] = $hausnummer->plz->plz;
$address['city'] = $hausnummer->strasse->gemeinde->name;
+ $address['municipality'] = "";
$address['district'] = $hausnummer->ortschaft->name;
$address['block'] = ($wohneinheit->block) ? $wohneinheit->block : null;
$address['stock'] = ($wohneinheit->stock) ? $wohneinheit->stock : null;
@@ -73,6 +76,13 @@ class Preorder extends mfBaseModel {
$address['unit_string'] = ($wohneinheit->bezeichner) ? $wohneinheit->bezeichner : null;
$address['is_shipping'] = ($this->shipping_address == "address") ? true : false;
+ if($campaign->district_is_city) {
+ $address['city'] = $hausnummer->ortschaft->name;
+ $address['municipality'] = $hausnummer->strasse->gemeinde->name;
+ } else {
+ unset($address['municipality']);
+ }
+
$customer = [];
$customer['company'] = ($this->company) ? $this->company : null;
$customer['uid'] = ($this->uid) ? $this->uid : null;
diff --git a/public/docs/preorder-api.yaml b/public/docs/preorder-api.yaml
index 8efb00224..2ff087c01 100644
--- a/public/docs/preorder-api.yaml
+++ b/public/docs/preorder-api.yaml
@@ -683,8 +683,12 @@ components:
example: 9999
city:
type: string
- description: Ort
- example: Beispielhausen
+ description: Ortschaft
+ example: Ortschaft
+ municipality:
+ type: string
+ description: Gemeinde
+ example: Gemeinde
district:
type: string
description: Ortsteil
@@ -787,8 +791,12 @@ components:
example: 9999
city:
type: string
- description: Ort
- example: Beispielhausen
+ description: Ortschaft
+ example: Ortschaft
+ municipality:
+ type: string
+ description: Gemeinde
+ example: Gemeinde
district:
type: string
description: Ortsteil
@@ -875,6 +883,9 @@ components:
city:
type: string
description: Ort der Anschlussadresse
+ municipality:
+ type: string
+ description: Gemeinde der Anschlussadresse
block:
type: string
description: Block der Anschlussadresse
|