AdressDB visibility filter & not importing canceled buildings
This commit is contained in:
@@ -123,7 +123,15 @@
|
||||
<label class="form-label" for="filter_rollout_info">Rollout Info</label>
|
||||
<input type="text" class="form-control" name="filter[rollout_info]" id="filter_rollout_info" value="<?=(array_key_exists("rollout_info", $filter)) ? $filter['rollout_info'] : ""?>" />
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-2">
|
||||
<label class="form-label" for="filter_visibility">Sichtbarkeit API</label>
|
||||
<select name="filter[visibility]" id="filter_visibility" class="form-control">
|
||||
<option value="">Alle</option>
|
||||
<option value="public" <?=(array_key_exists("visibility", $filter) && $filter['visibility'] == "public") ? "selected='selected'" : ""?>>Nur Sichtbar</option>
|
||||
<option value="private" <?=(array_key_exists("visibility", $filter) && $filter['visibility'] == "private") ? "selected='selected'" : ""?>>Nur nicht Sichtbar</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
@@ -158,6 +166,7 @@
|
||||
|
||||
<table class="table table-striped table-hover">
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Netzgebiet</th>
|
||||
<th>Adrcd</th>
|
||||
<th>OAID</th>
|
||||
@@ -176,6 +185,7 @@
|
||||
</tr>
|
||||
<?php foreach($addresses as $address): ?>
|
||||
<tr>
|
||||
<td><?=($address->visibility == "private") ? "<i class='far fa-eye-slash text-secondary' title='Auf nicht sichtbar gestellt'></i>" : ""?></td>
|
||||
<td><?=$address->netzgebiet->name?></td>
|
||||
<td><?=$address->adrcd?><?=($address->subcd) ? "-".$address->subcd : ""?></td>
|
||||
<td><?=$address->oaid?></td>
|
||||
|
||||
@@ -77,8 +77,7 @@ class AddressDBController extends mfBaseController {
|
||||
if(!array_key_exists("netzgebiet_id", $addressdb_filter)) {
|
||||
$addressdb_filter['netzgebiet_id'] = $netzgebiet_ids;
|
||||
}
|
||||
$addressdb_filter["visibility"] = ["public", "private"];
|
||||
|
||||
|
||||
$this->layout()->set("my_networks", ADBNetzgebietModel::getAll());
|
||||
$this->layout()->set("my_adb_networks", $my_adb_networks);
|
||||
|
||||
@@ -161,7 +160,13 @@ class AddressDBController extends mfBaseController {
|
||||
unset($filter['ortschaft']);
|
||||
unset($filter['ortschaft_id']);
|
||||
}
|
||||
|
||||
|
||||
if(array_key_exists("visibility", $filter) && $filter['visibility']) {
|
||||
$new_filter['visibility'] = $filter['visbility'];
|
||||
} else {
|
||||
$new_filter["visibility"] = ["public", "private"];
|
||||
unset($filter['visibility']);
|
||||
}
|
||||
|
||||
if(is_array($filter) && count($filter)) {
|
||||
foreach($filter as $name => $value) {
|
||||
|
||||
@@ -152,6 +152,9 @@ class AddressHelper
|
||||
}
|
||||
}
|
||||
|
||||
$execution_state_id = $building->executionState->name;
|
||||
$execution_state_label = $building->executionState->userLabel;
|
||||
|
||||
$addr_dbg_str = "strasse_hausnummer: $strasse_hausnummer | zusatz: $addresszusatz | gemkz: $gem_kz | gem_name: $gem_name | ort_name: $ort_name | plz_name: $plz_name | adrcd: $adr | $rimo_id";
|
||||
|
||||
if (!$hausnummer_name || !$gem_name || !$plz_name || !$ort_name || !$strasse_name) {
|
||||
@@ -178,10 +181,6 @@ class AddressHelper
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$gemeinde = ADBGemeindeModel::getFirst(["kennziffer" => $gem_kz]);
|
||||
if (!$gemeinde) {
|
||||
//$this->log->warning("[EE] Gemeinde $gem_name $gem_kz nicht gefunden ($addr_dbg_str)");
|
||||
@@ -218,6 +217,12 @@ class AddressHelper
|
||||
if (!$hausnummer) {
|
||||
$hausnummer = $this->findHausnummerByStreet($strasse_name, $hausnummer_name, $gemeinde_id);
|
||||
if (!$hausnummer) {
|
||||
// dont create Hausnummer if Canceled in Rimo
|
||||
if($execution_state_id == "99") {
|
||||
echo "== Not importing because execution state $execution_state_id ($execution_state_label)\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
// hausnummer anlegen
|
||||
|
||||
$plz = ADBPlzModel::getFirst(["gemeinde_id" => $gemeinde_id, "plz" => $plz_name]);
|
||||
@@ -298,6 +303,12 @@ class AddressHelper
|
||||
}
|
||||
}
|
||||
|
||||
if($execution_state_id == "99" && !$hausnummer->netzgebiet_id) {
|
||||
// dont import Hausnummer if Canceled in Rimo
|
||||
echo "== not setting netzgebite_id because execution state $execution_state_id ($execution_state_label)\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->checkGemeindeNetzgebiet($gemeinde, $this->netzgebiet);
|
||||
|
||||
// update hausnummer
|
||||
|
||||
@@ -240,6 +240,21 @@ foreach ($clusters as $cluster_data) {
|
||||
}
|
||||
$hausnummer_found_count++;
|
||||
|
||||
/*
|
||||
* Set Building Status based on Operational-/Executionstate
|
||||
*/
|
||||
$b_execution_state_id = $building->executionState->name;
|
||||
$b_execution_state_label = $building->executionState->userLabel;
|
||||
$b_operationalstate_id = $building->operationalState->name;
|
||||
$b_operationalstate_label = $building->operationalState->userLabel;
|
||||
|
||||
|
||||
|
||||
if($b_execution_state_id == "99" && $hausnummer->visibility != "private") {
|
||||
echo "== Setting visibility to private because execution state $b_execution_state_id ($b_execution_state_label) [".$hausnummer->id."]\n";
|
||||
$hausnummer->visibility = "private";
|
||||
$hausnummer->save();
|
||||
}
|
||||
|
||||
$last_unit_num = 0;
|
||||
$existing_units = [];
|
||||
@@ -338,7 +353,7 @@ foreach ($clusters as $cluster_data) {
|
||||
$unit_extdata->rimo->ftu = $ftu_data;
|
||||
$unit->external_data = json_encode($unit_extdata);
|
||||
if (!$unit->save()) {
|
||||
die("!!! Error saving unit extdata\n" . print_f($unit));
|
||||
die("!!! Error saving unit extdata\n" . print_r($unit));
|
||||
}
|
||||
|
||||
// check OAID
|
||||
|
||||
Reference in New Issue
Block a user