diff --git a/Layout/default/AddressDB/Form.php b/Layout/default/AddressDB/Form.php index 968632650..6c90cae7c 100644 --- a/Layout/default/AddressDB/Form.php +++ b/Layout/default/AddressDB/Form.php @@ -144,7 +144,18 @@ - + +
+ +
+ + + + + +
+
+
diff --git a/Layout/default/AddressDB/Index.php b/Layout/default/AddressDB/Index.php index 51bc19991..57f4db95c 100644 --- a/Layout/default/AddressDB/Index.php +++ b/Layout/default/AddressDB/Index.php @@ -167,6 +167,7 @@ Ortschaft Straße Hausnummer + Stiege Wohneinheiten GDA-Eigenschaft Rollout Jahr @@ -184,6 +185,7 @@ ortschaft->name?> strasse->name?> hausnummer?> + stiege?> wohneinheiten)?> gdaeigenschaft?> rollout?> diff --git a/Layout/default/Preorder/Index.php b/Layout/default/Preorder/Index.php index 3dc2a50fd..82a192e69 100644 --- a/Layout/default/Preorder/Index.php +++ b/Layout/default/Preorder/Index.php @@ -277,7 +277,7 @@ adb_hausnummer_id): ?> address_created) ? "class='alert-warning' title='Adresse manuell angelegt'" : ""?>"> adb_hausnummer->strasse->name?> - adb_hausnummer->hausnummer?>
+ adb_hausnummer->hausnummer?>adb_hausnummer->stiege) ? "/".$preorder->adb_hausnummer->stiege : ""?>
adb_wohneinheit_id) ? ((string)$preorder->adb_wohneinheit ? $preorder->adb_wohneinheit."
" : "") : "<keine Wohneinheit>
"?> adb_hausnummer->plz->plz?> adb_hausnummer->ortschaft->name?>
diff --git a/application/ADBHausnummer/ADBHausnummer.php b/application/ADBHausnummer/ADBHausnummer.php index 097e7a2a8..976c8d3c6 100644 --- a/application/ADBHausnummer/ADBHausnummer.php +++ b/application/ADBHausnummer/ADBHausnummer.php @@ -49,6 +49,9 @@ class ADBHausnummer extends mfBaseModel { $address .= " ".$this->getProperty("ortschaft")->name.","; $address .= " ".$this->getProperty("strasse")->name; $address .= " ".$this->hausnummer; + if($this->stiege) { + $address .= "/".$this->stiege; + } return $address; } diff --git a/application/ADBHausnummer/ADBHausnummerModel.php b/application/ADBHausnummer/ADBHausnummerModel.php index faae998ef..542abd744 100644 --- a/application/ADBHausnummer/ADBHausnummerModel.php +++ b/application/ADBHausnummer/ADBHausnummerModel.php @@ -10,6 +10,7 @@ class ADBHausnummerModel { public $plz_id; public $strasse_id; public $hausnummer; + public $stiege; public $zusatz; public $grund_nr; public $gdaeigenschaft; @@ -338,6 +339,13 @@ class ADBHausnummerModel { $where .= " AND Hausnummer.`hausnummer` like '$hausnummer%'"; } } + + if(array_key_exists("stiege", $filter)) { + $stiege = FronkDB::singleton()->escape($filter['stiege']); + if($stiege) { + $where .= " AND stiege.name = '$stiege'"; + } + } if(array_key_exists("strasse", $filter)) { $strasse = FronkDB::singleton()->escape($filter['strasse']); diff --git a/application/AddressDB/AddressDB.php b/application/AddressDB/AddressDB.php index 89a105911..a102b4928 100644 --- a/application/AddressDB/AddressDB.php +++ b/application/AddressDB/AddressDB.php @@ -26,6 +26,7 @@ class AddressDB { `Hausnummer`.`subcd` AS `subcd`, `Hausnummer`.`oaid` AS `hausnummer_oaid`, `Hausnummer`.`hausnummer` AS `hausnummer`, + `Hausnummer`.`stiege` AS `hausnummer_stiege`, `Hausnummer`.`extref` AS `hausnummer_extref`, `Hausnummer`.`unit_count` AS `unit_count`, `Hausnummer`.`meridian` AS `meridian`, @@ -95,7 +96,7 @@ class AddressDB { if($netzgebiet_id) { $res = $this->db->query("SELECT rimo_fcp_name FROM `Hausnummer` WHERE netzgebiet_id=$netzgebiet_id GROUP BY rimo_fcp_name ORDER BY LENGTH(rimo_fcp_name), rimo_fcp_name"); } else { - $res = $this->db->query("SELECT rimo_fcp_name FROM `Hausnummer` WHERE GROUP BY rimo_fcp_name ORDER BY rimo_fcp_name"); + $res = $this->db->query("SELECT rimo_fcp_name FROM `Hausnummer` GROUP BY rimo_fcp_name ORDER BY LENGTH(rimo_fcp_name), rimo_fcp_name"); } if($this->db->num_rows($res)) { while($data = $this->db->fetch_object($res)) { @@ -257,6 +258,7 @@ class AddressDB { $hausnummer_data['plz_id'] = $plz->id; $hausnummer_data['strasse_id'] = $strasse->id; $hausnummer_data['hausnummer'] = $data['hausnummer']; + $hausnummer_data['stiege'] = $data['stiege']; $hausnummer_data['grund_nr'] = $data['grund_nr']; $hausnummer_data['gdaeigenschaft'] = $data['gdaeigenschaft']; $hausnummer_data['meridian'] = $data['meridian']; diff --git a/application/AddressDB/AddressDBController.php b/application/AddressDB/AddressDBController.php index 8a015bf8b..518016063 100644 --- a/application/AddressDB/AddressDBController.php +++ b/application/AddressDB/AddressDBController.php @@ -270,7 +270,7 @@ class AddressDBController extends mfBaseController { if(!$this->me->is("Admin")) { $required[] = "netzgebiet_id"; } - foreach(['adrcd','extref','rimo_id','netzgebiet_id','strasse','hausnummer','plz','ortschaft','gemeinde','grund_nr','gdaeigenschaft','meridian','rw','hw','gps_lat','gps_long','unit_count','visibility'] as $field) { + foreach(['adrcd','extref','rimo_id','netzgebiet_id','strasse','hausnummer','stiege','plz','ortschaft','gemeinde','grund_nr','gdaeigenschaft','meridian','rw','hw','gps_lat','gps_long','unit_count','visibility'] as $field) { if(in_array($field, $required)) { if(!trim($r->$field)) { $this->layout()->setFlash("'".ucfirst($field)."' darf nicht leer sein!", "error"); diff --git a/application/Admin/functions/IvtContractImport.php b/application/Admin/functions/IvtContractImport.php index 891d38434..4c84faba2 100644 --- a/application/Admin/functions/IvtContractImport.php +++ b/application/Admin/functions/IvtContractImport.php @@ -310,6 +310,8 @@ class Admin_IvtContractImport { } } + + $this->addVoipData($ivt_customer, $customer); } return $data; @@ -443,7 +445,6 @@ class Admin_IvtContractImport { // lookup radius data $ruser = $this->getRadiusUser($ivt_customer, $ivt_product, $contract); // lookup voip data - //$voip_data = $this->getVoipData($ivt_customer, $ivt_product, $contract); foreach($contract->configgroups as $cgroup) { @@ -544,6 +545,7 @@ class Admin_IvtContractImport { * Webhosting * */ + return true; } @@ -619,26 +621,33 @@ class Admin_IvtContractImport { // return data } - private function getVoipData($ivt_customer, $ivt_product, $contract) { - // find voice number in ivt - $ivtnum = IvtCustomerTelephoneNrModel::getFirst(["cid" => $ivt_customer->id]); - if(!$ivtnum) return true; + private function addVoipData($ivt_customer, $customer) { + $ported_in = []; + $voicenumbers = []; + // find voice numbers in ivt + foreach(IvtCustomerTelephoneNrModel::search(["cid" => $ivt_customer->id]) as $ivtnum) { + $number = preg_replace('/^0043/', '43', $ivtnum->number); + if(!$number) return true; - $number = preg_replace('/^0043/', '43', $ivtnum->number); - if(!$number) return true; + // find number in block + $voicenumberblock = Voicenumberblock::findBlock($number); + if(!$voicenumberblock) { + $ported_in[] = $number; + } - // find number in block - $voicenumberblock = Voicenumberblock::findBlock($number); - if(!$voicenumberblock) return false; + if(!$voicenumberblock->isNumberInBlock($number)) { + die("Block für Nummer $number enthält nummer nicht."); + } - if(!$voicenumberblock->isNumberInBlock($number)) { - die("Block für Nummer $number enthält nummer nicht."); + $voicenumber = $voicenumberblock->getVoicenumber($number); + if(!$voicenumber) { + die("Nummer $number gehört nicht in Block ".$voicenumberblock->id); + } + $voicenumbers[] = $voicenumber; } - $voicenumber = $voicenumberblock->getVoicenumber($number); - if(!$voicenumber) { - die("Nummer $number gehört nicht in Block ".$voicenumberblock->id); - } + + // return voicenumber object return $voicenumber; diff --git a/application/Api/v1/AddressdbApicontroller.php b/application/Api/v1/AddressdbApicontroller.php index 912301570..a1f03682a 100644 --- a/application/Api/v1/AddressdbApicontroller.php +++ b/application/Api/v1/AddressdbApicontroller.php @@ -451,6 +451,7 @@ class AddressdbApicontroller extends mfBaseApicontroller { 'district' => $data->ortschaft, 'street' => $data->strasse, 'housenumber' => $housenumber, + 'stiege' => $data->hausnummer_stiege, 'lot_number' => $data->grund_nr, 'meridian' => $data->meridian, 'rw' => $data->rw, @@ -475,7 +476,6 @@ class AddressdbApicontroller extends mfBaseApicontroller { 'oaid' => $data->wohneinheit_oaid, 'num' => (int)$data->num, 'block' => $data->block, - 'stiege' => $data->stiege, 'stock' => $data->stock, 'tuer' => $data->tuer, 'zusatz' => $data->zusatz, @@ -593,6 +593,7 @@ class AddressdbApicontroller extends mfBaseApicontroller { $new_address['cluster_id'] = $ta['cluster_id']; $new_address['street'] = $ta['street']; $new_address['housenumber'] = $ta['housenumber']; + $new_address['stiege'] = $ta['stiege']; $new_address['zip'] = $ta['zip']; $new_address['city'] = $ta['city']; if(array_key_exists("municipality", $ta)) { @@ -606,7 +607,6 @@ class AddressdbApicontroller extends mfBaseApicontroller { $new_address['building_unit_count'] = $ta['building_unit_count']; $new_address['num'] = $u['num']; $new_address['block'] = $u['block']; - $new_address['stiege'] = $u['stiege']; $new_address['stock'] = $u['stock']; $new_address['tuer'] = $u['tuer']; $new_address['zusatz'] = $u['zusatz']; @@ -637,6 +637,7 @@ class AddressdbApicontroller extends mfBaseApicontroller { $search_district = $this->db()->escape(trim($get['district'])); $search_city = $this->db()->escape(trim($get['city'])); $search_housenumber = $this->db()->escape(trim($get['housenumber'])); + $search_stiege = $this->db()->escape(trim($get['stiege'])); $format = "flat"; if($get['format'] == "tree") { @@ -670,7 +671,10 @@ class AddressdbApicontroller extends mfBaseApicontroller { if($search_housenumber && $search_housenumber != "%") { $where .= " AND Hausnummer.hausnummer like '$search_housenumber%'"; } - + if($search_stiege && $search_stiege != "%") { + $where .= " AND Hausnummer.stiege like '$search_stiege%'"; + } + if(count($this->filter_salescluster_ids)) { $where .= " AND Hausnummer.netzgebiet_id IN (".implode(",", $this->filter_salescluster_ids).")"; } @@ -682,7 +686,7 @@ class AddressdbApicontroller extends mfBaseApicontroller { //var_dump($this->filter_salescluster_ids);exit; $sql = AddressDB::$wohneinheit_query; - $sql .= "\n WHERE $where ORDER BY plz, gemeinde, ortschaft, strasse, LENGTH(hausnummer), hausnummer, `Wohneinheit`.block, `Wohneinheit`.stiege, `Wohneinheit`.stock, LENGTH(num), num, LENGTH(`Wohneinheit`.tuer), `Wohneinheit`.tuer"; + $sql .= "\n WHERE $where ORDER BY plz, gemeinde, ortschaft, strasse, LENGTH(hausnummer), hausnummer, LENGTH(hausnummer_stiege), hausnummer_stiege, `Wohneinheit`.block, `Wohneinheit`.stock, LENGTH(num), num, LENGTH(`Wohneinheit`.tuer), `Wohneinheit`.tuer"; //$sql = "SELECT * FROM view_wohneinheit WHERE $where ORDER BY plz, gemeinde, ortschaft, strasse, LENGTH(hausnummer), hausnummer, block, stiege, stock, LENGTH(num), num, LENGTH(tuer), tuer"; $this->log->debug($sql); @@ -736,6 +740,7 @@ class AddressdbApicontroller extends mfBaseApicontroller { 'district' => $data->ortschaft, 'street' => $data->strasse, 'housenumber' => $housenumber, + 'stiege' => $data->hausnummer_stiege, 'lot_number' => $data->grund_nr, 'meridian' => $data->meridian, 'rw' => $data->rw, @@ -761,7 +766,6 @@ class AddressdbApicontroller extends mfBaseApicontroller { 'oaid' => $data->wohneinheit_oaid, 'num' => (int)$data->num, 'block' => $data->block, - 'stiege' => $data->stiege, 'stock' => $data->stock, 'tuer' => $data->tuer, 'zusatz' => $data->zusatz, @@ -801,6 +805,7 @@ class AddressdbApicontroller extends mfBaseApicontroller { $new_address['cluster_id'] = $ta['cluster_id']; $new_address['street'] = $ta['street']; $new_address['housenumber'] = $ta['housenumber']; + $new_address['stiege'] = $ta['stiege']; $new_address['zip'] = $ta['zip']; $new_address['city'] = $ta['city']; if(array_key_exists("municipality", $ta)) { @@ -814,7 +819,6 @@ class AddressdbApicontroller extends mfBaseApicontroller { $new_address['building_unit_count'] = $ta['building_unit_count']; $new_address['num'] = $u['num']; $new_address['block'] = $u['block']; - $new_address['stiege'] = $u['stiege']; $new_address['stock'] = $u['stock']; $new_address['tuer'] = $u['tuer']; $new_address['zusatz'] = $u['zusatz']; diff --git a/application/Api/v1/PreorderApicontroller.php b/application/Api/v1/PreorderApicontroller.php index 94c8c5041..31ae7cca4 100644 --- a/application/Api/v1/PreorderApicontroller.php +++ b/application/Api/v1/PreorderApicontroller.php @@ -374,6 +374,7 @@ class PreorderApicontroller extends mfBaseApicontroller { $address_search_fields = [ 'street' => 'strasse', 'housenumber' => "hausnummer", + 'stiege' => "hausnummer_stiege", 'zip' => "plz" ]; if($this->district_is_city) { @@ -398,7 +399,7 @@ class PreorderApicontroller extends mfBaseApicontroller { } $unit_search = []; - foreach(['block','stiege','stock','tuer','unit_string'] as $key) { + foreach(['block','stock','tuer','unit_string'] as $key) { if(property_exists($this->post['address'], $key) && trim($this->post['address']->$key)) { $unit_search[$key] = trim($this->post['address']->$key); } @@ -406,7 +407,7 @@ class PreorderApicontroller extends mfBaseApicontroller { // ignore unit_string if the specific fields were provided - if($unit_search['block'] || $unit_search['stiege'] || $unit_search['stock'] || $unit_search['tuer']) { + if($unit_search['block'] || $unit_search['stock'] || $unit_search['tuer']) { unset($unit_search['unit_string']); } @@ -569,7 +570,7 @@ class PreorderApicontroller extends mfBaseApicontroller { // 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 NULL)"; + $where = "hausnummer_id=".$address->hausnummer_id." AND (block = '' OR block 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 46fba4d77..989950242 100644 --- a/application/Preorder/Preorder.php +++ b/application/Preorder/Preorder.php @@ -530,13 +530,14 @@ class Preorder extends mfBaseModel { $address['cluster_id'] = $hausnummer->netzgebiet->extref; $address['street'] = $hausnummer->strasse->name; $address['housenumber'] = $hausnummer->hausnummer; + $address['stiege'] = $hausnummer->stiege; $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; - $address['stiege'] = ($wohneinheit->stiege) ? $wohneinheit->stiege : null; + //$address['stiege'] = ($wohneinheit->stiege) ? $wohneinheit->stiege : null; $address['tuer'] = ($wohneinheit->tuer) ? $wohneinheit->tuer : null; $address['unit_string'] = ($wohneinheit->bezeichner) ? $wohneinheit->bezeichner : null; $address['is_shipping'] = ($this->shipping_address == "address") ? true : false; @@ -554,12 +555,12 @@ class Preorder extends mfBaseModel { $customer['firstnam'] = ($this->firstname) ? $this->firstname : null; $customer['lastname'] = ($this->lastname) ? $this->lastname : null; $customer['street'] = ($this->street) ? $this->street : null; + $customer['stiege'] = ($this->stiege) ? $this->stiege : null; $customer['housenumber'] = ($this->housenumber) ? $this->housenumber : null; $customer['zip'] = ($this->zip) ? $this->zip : null; $customer['city'] = ($this->city) ? $this->city : null; $customer['block'] = ($this->block) ? $this->block : null; $customer['stock'] = ($this->stock) ? $this->stock : null; - $customer['stiege'] = ($this->stiege) ? $this->stiege : null; $customer['tuer'] = ($this->tuer) ? $this->tuer : null; $customer['unit_string'] = ($this->unit_string) ? $this->unit_string : null; $customer['phone'] = ($this->phone) ? $this->phone : null; diff --git a/application/Preorder/PreorderModel.php b/application/Preorder/PreorderModel.php index 38ec1607c..2441c8d0b 100644 --- a/application/Preorder/PreorderModel.php +++ b/application/Preorder/PreorderModel.php @@ -730,6 +730,13 @@ class PreorderModel { $where .= " AND adb_hausnummer.hausnummer like '%$hausnummer%'"; } } + + if(array_key_exists("stiege", $filter)) { + $stiege = FronkDB::singleton()->escape($filter['stiege']); + if($stiege) { + $where .= " AND adb_hausnummer.stiege like '%$stiege%'"; + } + } if(array_key_exists("unit_count", $filter)) { $unit_count = $filter['unit_count']; diff --git a/db/migrations/20240516114029_adb_hausnummer_add_stiege.php b/db/migrations/20240516114029_adb_hausnummer_add_stiege.php new file mode 100644 index 000000000..0a8e9edec --- /dev/null +++ b/db/migrations/20240516114029_adb_hausnummer_add_stiege.php @@ -0,0 +1,31 @@ +getEnvironment() == "thetool") { + + } + + if($this->getEnvironment() == "addressdb") { + $table = $this->table("Hausnummer"); + $table->addColumn("stiege", "string", ["null" => true, "default" => null, "after" => "hausnummer"]); + $table->update(); + } + } + + public function down(): void + { + if($this->getEnvironment() == "thetool") { + + } + + if($this->getEnvironment() == "addressdb") { + $this->table("Hausnummer")->removeColumn("stiege")->save(); + } + } +} diff --git a/public/docs/preorder-api.yaml b/public/docs/preorder-api.yaml index 5df8b0e6a..12ce71e4f 100644 --- a/public/docs/preorder-api.yaml +++ b/public/docs/preorder-api.yaml @@ -5,7 +5,7 @@ info: license: name: Apache 2.0 License url: http://www.apache.org/licenses/LICENSE-2.0.html - version: 1.0.0 + version: 1.2.0 servers: - url: https://thetool-test.xinon.at/api/v1 - url: https://thetool.xinon.at/api/v1 @@ -176,6 +176,11 @@ paths: in: query schema: type: string + - name: stiege + description: Stiege Suchbegriff + in: query + schema: + type: string responses: '200': description: | @@ -435,7 +440,7 @@ paths: Soll Starterkit an Anschlussadresse gesendet werden, muss `address.is_shipping` auf true gestellt werden, bei false wird das Starterkit an Vertragsinhaber (`customer`) gesendet. - Wohneinheitsidentifikation (Block, Stiege, Stock, Tür) kann strukturiert mit jeweils einem eigenen Feld übergeben werden oder alle Wohneinheitsdaten in einem einzigen String (`unit_string`). + Wohneinheitsidentifikation (Block, Stock, Tür) kann strukturiert mit jeweils einem eigenen Feld übergeben werden oder alle Wohneinheitsdaten in einem einzigen String (`unit_string`). --- @@ -920,6 +925,10 @@ components: type: string description: Hausnummer example: 13 + stiege: + type: string + description: Stiege + example: 2 zip: type: string description: PLZ @@ -1007,10 +1016,6 @@ components: type: string description: Stock example: 42 - stiege: - type: string - description: Stiege - example: "" tuer: type: string description: Tür @@ -1040,6 +1045,10 @@ components: type: string description: Hausnummer example: 13 + stiege: + type: string + description: Stiege + example: 2 zip: type: string description: PLZ @@ -1088,10 +1097,6 @@ components: type: string description: Stock example: 42 - stiege: - type: string - description: Stiege - example: "" tuer: type: string description: Tür @@ -1144,6 +1149,9 @@ components: housenumber: type: string description: Hausnummer der Anschlussadresse + stiege: + type: string + description: Stiege der Anschlussadresse zip: type: string description: PLZ der Anschlussadresse @@ -1159,9 +1167,6 @@ components: stock: type: string description: Stock der Anschlussadresse - stiege: - type: string - description: Stiege der Anschlussadresse tuer: type: string description: Tür der Anschlussadresse @@ -1307,6 +1312,10 @@ components: type: string description: Hausnummer der Anschlussadresse example: 13 + stiege: + type: string + description: Stiege der Anschlussadresse + example: "2" zip: type: string description: PLZ der Anschlussadresse @@ -1323,10 +1332,6 @@ components: type: string description: Stock der Anschlussadresse example: 42 - stiege: - type: string - description: Stiege der Anschlussadresse - example: "" tuer: type: string description: Tür der Anschlussadresse @@ -1689,6 +1694,10 @@ components: type: string description: Hausnummer Kunde example: 42 + stiege: + type: string + description: Stiege + example: 2 zip: type: string description: PLZ Kunde @@ -1709,10 +1718,6 @@ components: type: string description: Adresszusatz example: null - stiege: - type: string - description: Adresszusatz - example: null stock: type: string description: Adresszusatz