Merge branch 'master' of https://code.fronk.at/fronk/thetool into devbyspi
This commit is contained in:
@@ -284,7 +284,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if(!$address->id): ?>
|
||||
<hr />
|
||||
|
||||
<div class="form-group row">
|
||||
@@ -293,12 +292,11 @@
|
||||
<?php if(is_array($save_data) && array_key_exists("unit_count", $save_data)): ?>
|
||||
<input type="text" class="form-control" name="unit_count" id="unit_count" value="<?=$save_data['unit_count']?>">
|
||||
<?php else: ?>
|
||||
<input type="text" class="form-control" name="unit_count" id="unit_count" value="">
|
||||
<input type="text" class="form-control" name="unit_count" id="unit_count" value="<?=$address->unit_count?>">
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -321,7 +319,7 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(".select2").select2();
|
||||
$(".select2").select2({closeOnSelect: false});
|
||||
|
||||
$('#strasse').autoComplete({minLength: 2}).keydown(preventEnter);
|
||||
$('#plz').autoComplete({minLength: 1}).keydown(preventEnter);
|
||||
|
||||
@@ -84,6 +84,11 @@
|
||||
<label class="form-label" for="filter_street">Strasse</label>
|
||||
<input type="text" class="form-control" name="filter[street]" id="filter_street" value="<?=$filter['street']?>" />
|
||||
</div>
|
||||
|
||||
<div class="col-1">
|
||||
<label class="form-label" for="filter_hausnummer">Hausnummer</label>
|
||||
<input type="text" class="form-control" name="filter[hausnummer]" id="filter_street" value="<?=$filter['hausnummer']?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-2">
|
||||
@@ -120,7 +125,7 @@
|
||||
<div class="row mt-2">
|
||||
<div class="col">
|
||||
<button type="submit" class="btn btn-primary">Filter anwenden</button>
|
||||
<a class="btn btn-secondary" href="<?=self::getUrl("AddressDB")?>">Filter zurücksetzen</a>
|
||||
<a class="btn btn-secondary" href="<?=self::getUrl("AddressDB", "", ["resetFilter" => 1])?>">Filter zurücksetzen</a>
|
||||
<button type="submit" formaction="<?=self::getUrl("AddressDB", "export")?>" id="export-button" class="btn btn-outline-success ml-2"><i class="fas fa-download"></i> CSV-Export</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -110,9 +110,12 @@
|
||||
<a href="#" class="btn btn-success" onclick="refreshMap()"><i class="far fa-map"></i> Übersichtskarte einblenden</a>
|
||||
</div>
|
||||
<div class="row hidden" id="map-row">
|
||||
<div id="building-map" style="height:50vh; width: 100%"></div>
|
||||
<div class="mt-1">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary" onclick="centerMap()"><i class="far fa-dot-circle"></i> Zentrieren</button>
|
||||
<div id="building-map" style="height:70vh; width: 100%"></div>
|
||||
<div class="row mt-1">
|
||||
<div class="col">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary" onclick="centerMap()"><i class="far fa-dot-circle fa-fw"></i> Zentrieren</button>
|
||||
<button type="button" class="btn btn-sm btn-outline-success" onclick="toggleTileset()" title="Zwischen Karte und Satellitenbild umschalten"><i class="far fa-arrow-right-arrow-left fa-fw"></i> Karte/Satellit</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -359,34 +362,66 @@
|
||||
var markers = [];
|
||||
var markerState = true;
|
||||
var mapCenterPos = [<?=TT_PLACEHOLDER_GPS_LAT?>, <?=TT_PLACEHOLDER_GPS_LONG?>];
|
||||
var tileLayers = [];
|
||||
var tilesets = ["mapbox/streets-v12", "mapbox/satellite-streets-v12"];
|
||||
var currentTileset = "mapbox/streets-v12";
|
||||
|
||||
function toggleTileset() {
|
||||
if(currentTileset == "mapbox/streets-v12") {
|
||||
currentTileset = "mapbox/satellite-streets-v12";
|
||||
} else {
|
||||
currentTileset = "mapbox/streets-v12";
|
||||
}
|
||||
|
||||
console.log("renderMap");
|
||||
renderMap(true);
|
||||
}
|
||||
|
||||
function refreshMap() {
|
||||
// get buildings and render map
|
||||
$('#map-link').hide();
|
||||
$('#map-row').show();
|
||||
getMapdata();
|
||||
$([document.documentElement, document.body]).animate({
|
||||
scrollTop: $("#building-map").offset().top - 150
|
||||
}, 500);
|
||||
}
|
||||
|
||||
function renderMap() {
|
||||
function renderMap(tilesetChangeOnly = false) {
|
||||
if(buildingMap) {
|
||||
markers.forEach(function(m) {
|
||||
buildingMap.removeLayer(m);
|
||||
});
|
||||
if(!tilesetChangeOnly) {
|
||||
markers.forEach(function(m) {
|
||||
buildingMap.removeLayer(m);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
buildingMap = L.map('building-map').setView([<?=TT_PLACEHOLDER_GPS_LAT?>, <?=TT_PLACEHOLDER_GPS_LONG?>], 12);
|
||||
}
|
||||
|
||||
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
|
||||
attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
|
||||
minZoom: 4,
|
||||
maxZoom: 22,
|
||||
id: 'mapbox/streets-v11',
|
||||
accessToken: '<?=TT_MAPBOX_TILE_API_TOKEN?>'
|
||||
}).addTo(buildingMap);
|
||||
if(!(currentTileset in tileLayers)) {
|
||||
tileLayers[currentTileset] = L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
|
||||
attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
|
||||
minZoom: 6,
|
||||
maxZoom: 22,
|
||||
id: currentTileset,
|
||||
accessToken: '<?=TT_MAPBOX_TILE_API_TOKEN?>'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
tileLayers[currentTileset].addTo(buildingMap);
|
||||
// remove all tilesets not currently wanted
|
||||
tilesets.forEach(function(t) {
|
||||
if(t != currentTileset && buildingMap.hasLayer(tileLayers[t])) {
|
||||
buildingMap.removeLayer(tileLayers[t]);
|
||||
}
|
||||
});
|
||||
|
||||
L.MakiMarkers.accessToken = '<?=TT_MAPBOX_TILE_API_TOKEN?>';
|
||||
|
||||
addMarkers();
|
||||
if(!tilesetChangeOnly) {
|
||||
addMarkers();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -404,13 +439,13 @@
|
||||
var gps = [building.gps_lat, building.gps_long];
|
||||
all_coords.push(gps);
|
||||
|
||||
var icon_color = "#CB2B3E";
|
||||
var icon_color = "#ec98a2";
|
||||
var icon_name = "home";
|
||||
|
||||
if(building.status == "connected") {
|
||||
icon_color = "#2AAD27";
|
||||
icon_color = "#acf0ab";
|
||||
} else if(building.status == "pipework-done") {
|
||||
icon_color = "#CB8427";
|
||||
icon_color = "#ffcd8b";
|
||||
}
|
||||
|
||||
if(building.type.match(/^(Zwei)/i)) {
|
||||
|
||||
@@ -116,8 +116,8 @@
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="form-group text-center">
|
||||
<label for="item_<?=$item->id?>_multiple">Mehrfach eintragbar</label>
|
||||
<input type="checkbox" class="form-control" id="item_<?=$item->id?>_multiple" name="multiple" value="1" <?=($item->multiple) ? "checked='checked'" : ""?> />
|
||||
<label for="item_new_<?=$item->id?>_multiple">Mehrfach eintragbar</label>
|
||||
<input type="checkbox" class="form-control" id="item_new_<?=$item->id?>_multiple" name="multiple" value="1" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -129,7 +129,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if($me->is("Admin")): ?>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row col" id="map-link">
|
||||
@@ -146,7 +145,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<div class="card">
|
||||
@@ -470,6 +468,9 @@
|
||||
if(!field) {
|
||||
return;
|
||||
}
|
||||
if(!$('#filter_' + field).length) {
|
||||
return;
|
||||
}
|
||||
let val = $('#filter_' + field).val();
|
||||
if(val.length) {
|
||||
filter[field] = val;
|
||||
|
||||
@@ -3,7 +3,7 @@ ob_end_flush();
|
||||
header("Content-type: text/csv");
|
||||
header('Content-disposition: attachment; filename="preorder-export-'.date('Y-m-d_H-i-s').'.csv"');
|
||||
?>
|
||||
Kampagne;Bestelltyp;Status;Anschlusstyp;Anschluss Strasse;Anschluss Hausnummer;Anschluss PLZ;Anschluss Ort;Anschluss Wohneinheit;Anzahl Anschlüsse;Kunde Firma;Kunde UID;Kunde Vorname;Kunde Nachname;Kunde Strasse;Kunde PLZ;Kunde Ort;Kunde Telefon;Kunde Email;Partner;BEP festgelegt;Starterpaket erhalten;
|
||||
Kampagne;Netzgebiet ID;Netzgebiet;Extref;Bestellcode;OAID;Bestelltyp;Status;Anschlusstyp;GWR Adresscode;Anschluss Strasse;Anschluss Hausnummer;Anschluss PLZ;Anschluss Ort;Anschluss Wohneinheit;GPS Breite;GPS Länge;Anzahl Anschlüsse;Kunde Firma;Kunde UID;Kunde Vorname;Kunde Nachname;Kunde Strasse;Kunde PLZ;Kunde Ort;Kunde Telefon;Kunde Email;Partner;Addon Lehrverrohrung Grundstück;Addon Hausverkabelung;BEP festgelegt;Starterpaket erhalten;Erstellt;Letzte Bearbeitung
|
||||
<?php
|
||||
$line = 0;
|
||||
|
||||
@@ -12,11 +12,12 @@ while($data = mysqli_fetch_object($res)):
|
||||
$status = Layout::getMfValuecacheObject("Preorderstatus", $data->status_id);
|
||||
$hausnummer = Layout::getMfValuecacheObject("ADBHausnummer", $data->adb_hausnummer_id);
|
||||
$wohneinheit = Layout::getMfValuecacheObject("ADBWohneinheit", $data->adb_wohneinheit_id);
|
||||
$netzgebiet = Layout::getMfValuecacheObject("ADBNetzgebiet", $hausnummer->netzgebiet_id);
|
||||
$strasse = Layout::getMfValuecacheObject("ADBStrasse", $hausnummer->strasse_id);
|
||||
$gemeinde = Layout::getMfValuecacheObject("ADBGemeinde",$strasse->gemeinde_id);
|
||||
$ortschaft = Layout::getMfValuecacheObject("ADBOrtschaft", $hausnummer->ortschaft_id);
|
||||
$plz = Layout::getMfValuecacheObject("ADBPlz", $hausnummer->plz_id);
|
||||
$partner = Layout::getMfValuecacheObject("Address", $hausnummer->partner_id);
|
||||
$partner = Layout::getMfValuecacheObject("Address", $data->partner_id);
|
||||
|
||||
$unit_data = "";
|
||||
if($wohneinheit->block) $unit_data .= "Block ".$wohneinheit->block;
|
||||
@@ -37,8 +38,26 @@ while($data = mysqli_fetch_object($res)):
|
||||
if($attribs['inhouse_cabling_supplied']) $inhouse = true;
|
||||
}
|
||||
|
||||
$addon_property = 0;
|
||||
$addon_inhouse = 0;
|
||||
if($data->addon_services) {
|
||||
$services = json_decode($data->addon_services);
|
||||
if(is_array($services) && count($services)) {
|
||||
foreach($services as $service) {
|
||||
if($service->service == "installation_onproperty" && $service->ordered) {
|
||||
$addon_property = 1;
|
||||
}
|
||||
if($service->service == "installation_inhouse" && $service->ordered) {
|
||||
$addon_inhouse = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($data->uid == "string") $data->uid = "";
|
||||
|
||||
?>
|
||||
"<?=$campaign->name?>";"<?=__($data->type,"preorder")?>";"<?=$status->name?>";"<?=__($data->connection_type,"preorder")?>";"<?=$strasse->name?>";"<?=$hausnummer->hausnummer?>";"<?=$plz->plz?>";"<?=$ortschaft->name?>";"<?=$unit_data?>";<?=$data->connection_count?>;"<?=$data->company?>";"<?=$data->uid?>";"<?=$data->firstname?>";"<?=$data->lastname?>";"<?=$data->street?>";"<?=$data->zip?>";"<?=$data->city?>";"<?=$data->phone?>";"<?=$data->email?>";"<?=$partner->getCompanyOrName()?>";<?=($bep) ? "1" : "0"?>;<?=($inhouse) ? "1" : "0"?>;
|
||||
"<?=$campaign->name?>";"<?=$netzgebiet->extref?>";"<?=$netzgebiet->name?>";"<?=$data->extref?>";"<?=$data->ucode?>";"<?=$wohneinheit->oaid?>";"<?=__($data->type,"preorder")?>";"<?=$status->name?>";"<?=__($data->connection_type,"preorder")?>";"<?=$hausnummer->adrcd?>";"<?=$strasse->name?>";"<?=$hausnummer->hausnummer?>";"<?=$plz->plz?>";"<?=$ortschaft->name?>";"<?=$unit_data?>";"<?=$hausnummer->gps_lat?>";"<?=$hausnummer->gps_long?>";<?=$data->connection_count?>;"<?=$data->company?>";"<?=$data->uid?>";"<?=$data->firstname?>";"<?=$data->lastname?>";"<?=$data->street?>";"<?=$data->zip?>";"<?=$data->city?>";"<?=$data->phone?>";"<?=$data->email?>";"<?=$partner->getCompanyOrName()?>";<?=$addon_property?>;<?=$addon_inhouse?>;<?=($bep) ? "1" : "0"?>;<?=($inhouse) ? "1" : "0"?>;"<?=date("Y-m-d H:i:s",$data->create)?>";"<?=date("Y-m-d H:i:s",$data->edit)?>"
|
||||
<?php
|
||||
$i++;
|
||||
if($line % 1000 === 0) {
|
||||
|
||||
@@ -71,8 +71,8 @@ class ADBHausnummerModel {
|
||||
ORDER BY netzgebiet_id,Gemeinde.id,ortschaft_id,strasse_id,LENGTH(hausnummer), hausnummer
|
||||
LIMIT 1";
|
||||
|
||||
//mfLoghandler::singleton()->debug($where);
|
||||
$res = $db->select("Hausnummer", "*", "$where ORDER BY strasse_id,hausnummer LIMIT 1");
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new ADBHausnummer($data);
|
||||
@@ -135,7 +135,6 @@ class ADBHausnummerModel {
|
||||
WHERE $where
|
||||
ORDER BY netzgebiet_id,Gemeinde.id,ortschaft_id,strasse_id,LENGTH(hausnummer), hausnummer";
|
||||
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
if(is_array($limit) && count($limit)) {
|
||||
if(is_numeric($limit['start']) && is_numeric($limit['count'])) {
|
||||
$sql .= " LIMIT ".$limit['start'].", ".$limit['count'];
|
||||
@@ -312,9 +311,9 @@ class ADBHausnummerModel {
|
||||
}
|
||||
|
||||
if(array_key_exists("hausnummer%", $filter)) {
|
||||
$hausnummer = FronkDB::singleton()->escape($filter['hausnummer']);
|
||||
$hausnummer = FronkDB::singleton()->escape($filter['hausnummer%']);
|
||||
if($hausnummer) {
|
||||
$where .= " AND Hausnummer.`hausnummer` like '%$hausnummer%'";
|
||||
$where .= " AND Hausnummer.`hausnummer` like '$hausnummer%'";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,14 +18,22 @@ class AddressDBController extends mfBaseController {
|
||||
protected function indexAction() {
|
||||
$this->layout()->setTemplate("AddressDB/Index");
|
||||
|
||||
$rfilter = $this->request->filter;
|
||||
iF(!is_array($rfilter)) {
|
||||
$rfilter = [];
|
||||
if($this->request->resetFilter) {
|
||||
unset($_SESSION[MFAPPNAME.'-AddressDB-filter']);
|
||||
}
|
||||
|
||||
$this->layout->set("filter", $rfilter);
|
||||
|
||||
$filter = $this->getPreparedFilter($rfilter);
|
||||
$filter = [];
|
||||
if(is_array($this->request->filter)) {
|
||||
$filter = $this->request->filter;
|
||||
$_SESSION[MFAPPNAME.'-AddressDB-filter'] = $filter;
|
||||
} else {
|
||||
if(array_key_exists(MFAPPNAME.'-AddressDB-filter', $_SESSION) && count($_SESSION[MFAPPNAME.'-AddressDB-filter'])) {
|
||||
$filter = $_SESSION[MFAPPNAME.'-AddressDB-filter'];
|
||||
}
|
||||
}
|
||||
|
||||
$this->layout->set("filter", $filter);
|
||||
$filter = $this->getPreparedFilter($filter);
|
||||
|
||||
// pagination defaults
|
||||
$pagination = [];
|
||||
@@ -73,7 +81,7 @@ class AddressDBController extends mfBaseController {
|
||||
$this->layout()->set("my_networks", ADBNetzgebietModel::getAll());
|
||||
$this->layout()->set("my_adb_networks", $my_adb_networks);
|
||||
//var_dump($addressdb_filter);exit;
|
||||
|
||||
//var_dump($addressdb_filter);exit;
|
||||
if($filter['netzgebiet_id'] === "null") {
|
||||
$addressdb_filter['netzgebiet_id'] = 0;
|
||||
$pagination['maxItems'] = ADBHausnummerModel::count($addressdb_filter);
|
||||
@@ -107,13 +115,18 @@ class AddressDBController extends mfBaseController {
|
||||
unset($filter['street']);
|
||||
}
|
||||
|
||||
if(array_key_exists("hausnummer", $filter) && $filter['hausnummer']) {
|
||||
$new_filter['hausnummer%'] = $filter['hausnummer'];
|
||||
unset($filter['hausnummer']);
|
||||
}
|
||||
|
||||
if(array_key_exists("adrcd", $filter) && $filter['adrcd']) {
|
||||
$new_filter['adrcd%'] = $filter['adrcd'];
|
||||
unset($filter['adrcd']);
|
||||
}
|
||||
|
||||
if(array_key_exists("oaid", $filter) && $filter['oaid']) {
|
||||
$new_filter['oaid%'] = $filter['oaid'];
|
||||
$new_filter['oaid%'] = "%".$filter['oaid'];
|
||||
unset($filter['oaid']);
|
||||
}
|
||||
|
||||
@@ -149,6 +162,7 @@ class AddressDBController extends mfBaseController {
|
||||
unset($filter['ortschaft_id']);
|
||||
}
|
||||
|
||||
|
||||
if(is_array($filter) && count($filter)) {
|
||||
foreach($filter as $name => $value) {
|
||||
if(strlen($value) > 0) $new_filter[$name] = $value;
|
||||
@@ -188,7 +202,6 @@ class AddressDBController extends mfBaseController {
|
||||
}
|
||||
|
||||
protected function editAction() {
|
||||
|
||||
$id = $this->request->id;
|
||||
if(!is_numeric($id) || $id < 1) {
|
||||
$this->layout()->setFlash("Adresse nicht gefunden", "error");
|
||||
@@ -236,7 +249,6 @@ class AddressDBController extends mfBaseController {
|
||||
if(!trim($r->$field)) {
|
||||
$this->layout()->setFlash("'".ucfirst($field)."' darf nicht leer sein!", "error");
|
||||
return $this->addAction();
|
||||
//$this->redirect("AddressDB", $mode, ['id' => $id]);
|
||||
}
|
||||
}
|
||||
$address_data[$field] = $this->db()->escape(trim($r->$field));
|
||||
@@ -298,33 +310,52 @@ class AddressDBController extends mfBaseController {
|
||||
//$this->redirect("AddressDB");
|
||||
}
|
||||
|
||||
if($mode == "add") {
|
||||
|
||||
|
||||
/*
|
||||
* Wohneinheiten erstellen
|
||||
*/
|
||||
if(is_numeric($r->unit_count) && $r->unit_count) {
|
||||
$unit_count = $r->unit_count;
|
||||
$hausnummer = new ADBHausnummer($hausnummer_id);
|
||||
|
||||
/*
|
||||
* Wohneinheiten erstellen
|
||||
*/
|
||||
if($r->unit_count > 0) {
|
||||
for($i = 1; $i <= $r->unit_count; $i++) {
|
||||
$unit = ADBWohneinheitModel::create([
|
||||
'hausnummer_id' => $hausnummer_id,
|
||||
'num' => $i,
|
||||
]);
|
||||
$unit_id = $unit->save();
|
||||
if(!$unit_id) {
|
||||
$this->log->debug(__CLASS__."::".__METHOD__.": Cannot save Woneinheit");
|
||||
continue;
|
||||
$existing_units_count = ADBWohneinheitModel::count(['hausnummer_id' => $hausnummer->id]);
|
||||
//var_dump($hausnummer,$existing_units_count);exit;
|
||||
if($existing_units_count < $unit_count) {
|
||||
$new_units_count = $unit_count - $existing_units_count;
|
||||
$last_unit_num = 0;
|
||||
|
||||
foreach(ADBWohneinheitModel::search(['hausnummer_id' => $hausnummer->id]) as $tmp_unit) {
|
||||
if($tmp_unit->num > $last_unit_num) {
|
||||
$last_unit_num = $tmp_unit->num;
|
||||
}
|
||||
$unit->oaid = $unit->getNewOAID();
|
||||
$unit->save();
|
||||
}
|
||||
|
||||
// create wohneinheiten
|
||||
for($i = 1; $i <= $new_units_count; $i++) {
|
||||
$num = $last_unit_num + $i;
|
||||
//echo "$existing_units_count create wohneinheit $num\n";
|
||||
$unit_data = [
|
||||
'hausnummer_id' => $hausnummer->id,
|
||||
'num' => $num,
|
||||
];
|
||||
$wohneinheit = ADBWohneinheitModel::create($unit_data);
|
||||
$wohneinheit_id = $wohneinheit->save();
|
||||
if(!$wohneinheit_id) {
|
||||
$this->layout()->setFlash("Fehler beim Erstellen einer Wohneinheit!", "warning");
|
||||
return $this->addAction();
|
||||
}
|
||||
$wohneinheit->oaid = $wohneinheit->getNewOAID();
|
||||
$wohneinheit->save();
|
||||
$w++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$qs = http_build_query(['filter' => ['oaid' => $hausnummer->oaid]]);
|
||||
//$qs = http_build_query(['filter' => ['oaid' => $hausnummer->oaid]]);
|
||||
//var_dump($qs);exit;
|
||||
$this->layout()->setFlash("Adresse erfolgreich gespeichert", "success");
|
||||
$this->redirect("AddressDB", "Index", $qs);
|
||||
$this->redirect("AddressDB");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,13 @@ class AddressdbApicontroller extends mfBaseApicontroller {
|
||||
protected function authenticated() {
|
||||
$campaignApiusers = PreordercampaignApiuserModel::search(["worker_id" => $this->me->id]);
|
||||
|
||||
if(!$campaignApiusers) {
|
||||
$cau = new PreordercampaignApiuser();
|
||||
$cau->preordercampaign_id = 1;
|
||||
$campaignApiusers = [$cau];
|
||||
}
|
||||
|
||||
|
||||
foreach($campaignApiusers as $campaignApiuser) {
|
||||
$campaign = new Preordercampaign($campaignApiuser->preordercampaign_id);
|
||||
if($campaign) {
|
||||
|
||||
@@ -311,6 +311,13 @@ class PreorderApicontroller extends mfBaseApicontroller {
|
||||
$unit_search[$key] = trim($this->post['address']->$key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ignore unit_string if the specific fields were provided
|
||||
if($unit_search['block'] || $unit_search['stiege'] || $unit_search['stock'] || $unit_search['tuer']) {
|
||||
unset($unit_search['unit_string']);
|
||||
}
|
||||
|
||||
if($zusatz) {
|
||||
$unit_search['zusatz'] = $zusatz;
|
||||
}
|
||||
@@ -334,6 +341,7 @@ class PreorderApicontroller extends mfBaseApicontroller {
|
||||
*/
|
||||
$where = "1=1 ";
|
||||
foreach($address_search as $field => $value) {
|
||||
if($field == "ortschaft" || $field == "gemeinde") continue;
|
||||
$where .= " AND `$field` = '$value'";
|
||||
}
|
||||
|
||||
@@ -346,7 +354,35 @@ class PreorderApicontroller extends mfBaseApicontroller {
|
||||
$this->log->debug($sql);
|
||||
$res = $this->db()->query($sql);
|
||||
if(!$this->db()->num_rows($res)) {
|
||||
return mfResponse::NotFound(['message' => "Adresse nicht gefunden"]);
|
||||
// try with Ortschaft in front of strasse (liezen gwr issue)
|
||||
$where = "1=1 ";
|
||||
foreach($address_search as $field => $value) {
|
||||
if($field == "ortschaft" || $field == "gemeinde") continue;
|
||||
|
||||
if($field == "strasse") {
|
||||
$prefix = ($address_search['ortschaft']) ? $address_search['ortschaft'] : $address_search['gemeinde'];
|
||||
if(strpos($value, "$prefix ") === 0) {
|
||||
$str = substr($value, strlen($prefix)+1);
|
||||
} else {
|
||||
$str = $value;
|
||||
}
|
||||
$where .= " AND `strasse` = '$str'";
|
||||
} else {
|
||||
$where .= " AND `$field` = '$value'";
|
||||
}
|
||||
}
|
||||
|
||||
// filter salesclusters
|
||||
if(count($this->filter_salescluster_ids)) {
|
||||
$where .= " AND netzgebiet_id IN (".implode(',', $this->filter_salescluster_ids).")";
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM view_hausnummer WHERE $where";
|
||||
$this->log->debug($sql);
|
||||
$res = $this->db()->query($sql);
|
||||
if(!$this->db()->num_rows($res)) {
|
||||
return mfResponse::NotFound(['message' => "Adresse nicht gefunden"]);
|
||||
}
|
||||
}
|
||||
|
||||
$address = $this->db()->fetch_object($res);
|
||||
@@ -592,6 +628,7 @@ class PreorderApicontroller extends mfBaseApicontroller {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// get units excluding unavailable units
|
||||
$where = "hausnummer_id=".$address->hausnummer_id;
|
||||
$where .= " AND ( block = '' OR block IS NULL)";
|
||||
|
||||
@@ -411,7 +411,7 @@ class BuildingController extends mfBaseController {
|
||||
$building_term['status'] = "none";
|
||||
|
||||
//$this->log->debug("building status: ".print_r($building->status,true));
|
||||
if($term->status->code == TT_TERMSTATUS_CONNECTED) {
|
||||
if($term->status->code >= TT_TERMSTATUS_CONNECTED) {
|
||||
$building_term['status'] = "connected";
|
||||
$data->status = "connected";
|
||||
} elseif($building->status->code == TT_BUILDINGSTATUS_CONNECTED) {
|
||||
|
||||
@@ -86,7 +86,6 @@ class ContractconfigController extends mfBaseController {
|
||||
}*/
|
||||
$old_values[$item->name] = $item->getValue();
|
||||
|
||||
|
||||
if(!$item->value->set($itemvalue)) {
|
||||
$error_items[$item->id] = $item->name;
|
||||
continue;
|
||||
|
||||
@@ -19,8 +19,8 @@ abstract class Contractconfig_Hook {
|
||||
abstract public function beforeSave();
|
||||
abstract public function afterSave();
|
||||
|
||||
abstract public function beforeDelete();
|
||||
abstract public function afterDelete();
|
||||
abstract public function beforeCancel();
|
||||
abstract public function afterCancel();
|
||||
|
||||
|
||||
public function __construct(Contract $contract) {
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
require_once __DIR__."/Contractconfig_Hook.php";
|
||||
|
||||
/*
|
||||
* Contractconfig Hooks for
|
||||
*/
|
||||
class Contractconfig_Hook_Voicenumberblock extends Contractconfig_Hook {
|
||||
protected $required_product_attributes = ["needs_number"];
|
||||
private $voip_routing;
|
||||
@@ -30,17 +33,23 @@ class Contractconfig_Hook_Voicenumberblock extends Contractconfig_Hook {
|
||||
|
||||
|
||||
// get voip routing for number
|
||||
$this->getVoipRouting();
|
||||
|
||||
}
|
||||
|
||||
private function getVoipRouting() {
|
||||
if(is_array($this->contract->configvalues)) {
|
||||
// look in contract config
|
||||
if(array_key_exists("voip_routing",$this->contract->configvalues) && $this->contract->configvalues['voip_routing']->value->string) {
|
||||
$this->voip_routing = $this->contract->configvalues['voip_routing']->value->string;
|
||||
} else {
|
||||
// else take first value (default)
|
||||
$typedata = $this->voip_routing = $this->contract->configvalues['voip_routing']->getTypedataArray();
|
||||
$typedata = $this->contract->configvalues['voip_routing']->getTypedataArray();
|
||||
$this->voip_routing = $typedata[0];
|
||||
}
|
||||
}
|
||||
|
||||
return $this->voip_routing;
|
||||
}
|
||||
|
||||
public function beforeSave() {
|
||||
@@ -49,6 +58,8 @@ class Contractconfig_Hook_Voicenumberblock extends Contractconfig_Hook {
|
||||
|
||||
public function afterSave() {
|
||||
$this->checkNewNumbers();
|
||||
// load voip routing again, in case it changed with the same config update
|
||||
$this->getVoipRouting();
|
||||
|
||||
if(count($this->errors["voicenumberblock_voicenumber"])) {
|
||||
return false;
|
||||
@@ -85,6 +96,7 @@ class Contractconfig_Hook_Voicenumberblock extends Contractconfig_Hook {
|
||||
|
||||
/*
|
||||
* TODO: Check if contract was canceled, then set lock and lock_reason to reserved
|
||||
* => should go into beforeCancel event
|
||||
*/
|
||||
public function checkNewNumbers() {
|
||||
$this->log->debug(":: In Contractconfig_Hook_Voicenumberblock->afterSave()");
|
||||
@@ -158,11 +170,11 @@ class Contractconfig_Hook_Voicenumberblock extends Contractconfig_Hook {
|
||||
|
||||
}
|
||||
|
||||
public function beforeDelete() {
|
||||
public function beforeCancel() {
|
||||
|
||||
}
|
||||
|
||||
public function afterDelete() {
|
||||
public function afterCancel() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ class ContractconfigItem extends mfBaseModel {
|
||||
$value->contract_id = $this->contract_id;
|
||||
$value->create_by = $me->id;
|
||||
}
|
||||
|
||||
//var_dump($value);exit;
|
||||
$this->value = $value;
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,8 @@ class ContractconfigValue extends mfBaseModel {
|
||||
private $item;
|
||||
|
||||
public function set($new_value) {
|
||||
$item = $this->getProperty("item");
|
||||
// explicitly load item, because we might not have an id yet
|
||||
$item = new ContractconfigItem($this->item_id);
|
||||
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
|
||||
@@ -48,11 +48,15 @@ class PreorderController extends mfBaseController {
|
||||
$this->layout()->set("my_campaigns", PreordercampaignModel::getAll());
|
||||
} else {
|
||||
if($this->me->is("preorderfront")) {
|
||||
|
||||
$pns = json_decode($this->me->getFlag("preorder_networks"));
|
||||
foreach($pns as $pn_id) {
|
||||
$my_networks[] = new Network($pn_id);
|
||||
if(is_array($pns) && count($pns)) {
|
||||
foreach($pns as $pn_id) {
|
||||
$my_networks[] = new Network($pn_id);
|
||||
}
|
||||
} else {
|
||||
$my_networks = $this->me->myNetworks(['netowner','salespartner']);
|
||||
}
|
||||
|
||||
//var_dump($my_networks);exit;
|
||||
} else {
|
||||
$my_networks = $this->me->myNetworks(["netowner", "salespartner"]);
|
||||
@@ -77,6 +81,8 @@ class PreorderController extends mfBaseController {
|
||||
} else {
|
||||
$filter['preordercampaign_id'] = $my_campaign_ids;
|
||||
}
|
||||
|
||||
if(!$filter['preordercampaign_id']) $filter['preordercampaign_id'] = 0;
|
||||
}
|
||||
|
||||
if($filter['addon_services']) {
|
||||
@@ -620,29 +626,16 @@ class PreorderController extends mfBaseController {
|
||||
$my_adb_networks = [];
|
||||
foreach($my_networks as $network) {
|
||||
if($network->adb_netzgebiet_id && !in_array($network->adb_netzgebiet_id, $netzgebiet_ids)) {
|
||||
$netzgebiet_ids[] = $network->adb_netzgebiet_id;
|
||||
$netzgebiet_ids[] = $network->id;
|
||||
$my_adb_networks[$network->adb_netzgebiet_id] = new ADBNetzgebiet($network->adb_netzgebiet_id);
|
||||
}
|
||||
}
|
||||
|
||||
/*if(array_key_exists("network_id", $filter) && $filter['network_id']) {
|
||||
if($this->me->is("Admin")) {
|
||||
$filter['netzgebiet_id'] = $filter['network_id'];
|
||||
} else {
|
||||
if(in_array($filter['network_id'], $netzgebiet_ids)) {
|
||||
$filter['netzgebiet_id'] = $filter['network_id'];
|
||||
}
|
||||
}
|
||||
}*/
|
||||
unset($filter['network_id']);
|
||||
|
||||
$preorder_filter = $filter;
|
||||
/*if(!array_key_exists("netzgebiet_id", $preorder_filter)) {
|
||||
$preorder_filter['netzgebiet_id'] = $netzgebiet_ids;
|
||||
}*/
|
||||
|
||||
$campaign_ids = [];
|
||||
foreach(PreordercampaignModel::search(["netzgebiet_id" => $netzgebiet_ids]) as $campaign) {
|
||||
foreach(PreordercampaignModel::search(["network_id" => $netzgebiet_ids]) as $campaign) {
|
||||
if(!in_array($campaign->id, $campaign_ids)) {
|
||||
$campaign_ids[] = $campaign->id;
|
||||
}
|
||||
@@ -656,7 +649,6 @@ class PreorderController extends mfBaseController {
|
||||
|
||||
$preorder_filter['<status_code'] = 800;
|
||||
|
||||
//var_dump($filter, $preorder_filter);exit;
|
||||
// Get mysqli resource from Model, so layout can output data as it's retrieved
|
||||
// Works around lousy performance and horrendous memory usage
|
||||
$res = PreorderModel::search($preorder_filter, [], true);
|
||||
@@ -666,7 +658,7 @@ class PreorderController extends mfBaseController {
|
||||
}
|
||||
|
||||
protected function apiAction() {
|
||||
if(!$this->me->is(["Admin","netowner","salespartner"])) {
|
||||
if(!$this->me->is(["Admin","netowner","salespartner","preorderfront"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
$do = $this->request->do;
|
||||
@@ -706,7 +698,19 @@ class PreorderController extends mfBaseController {
|
||||
if($this->me->is("Admin")) {
|
||||
$my_networks = NetworkModel::getAll();
|
||||
} else {
|
||||
$my_networks = $this->me->myNetworks(['netowner','salespartner']);
|
||||
if($this->me->is("preorderfront")) {
|
||||
$pns = json_decode($this->me->getFlag("preorder_networks"));
|
||||
if(is_array($pns) && count($pns)) {
|
||||
foreach($pns as $pn_id) {
|
||||
$my_networks[] = new Network($pn_id);
|
||||
}
|
||||
} else {
|
||||
$my_networks = $this->me->myNetworks(['netowner','salespartner']);
|
||||
}
|
||||
//var_dump($my_networks);exit;
|
||||
} else {
|
||||
$my_networks = $this->me->myNetworks(['netowner','salespartner']);
|
||||
}
|
||||
|
||||
foreach($my_networks as $network) {
|
||||
foreach(PreordercampaignModel::search(['network_id' => $network->id]) as $campaign) {
|
||||
@@ -719,14 +723,15 @@ class PreorderController extends mfBaseController {
|
||||
if(!in_array($filter['preordercampaign_id'], $my_campaign_ids)) {
|
||||
$filter['preordercampaign_id'] = $my_campaign_ids;
|
||||
}
|
||||
} else {
|
||||
$filter['preordercampaign_id'] = $my_campaign_ids;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!$filter['preordercampaign_id']) $filter['preordercampaign_id'] = 0;
|
||||
|
||||
//var_dump($filter);exit;
|
||||
$results = PreorderModel::search($filter);
|
||||
|
||||
foreach($results as $preorder) {
|
||||
//$this->log->debug("building status: ".print_r($building->status,true));
|
||||
$data = clone($preorder->data);
|
||||
|
||||
@@ -160,14 +160,14 @@ class PreordernotificationModel {
|
||||
}
|
||||
|
||||
if(array_key_exists("send_finish", $filter)) {
|
||||
$send_finish = $db->escape($filter['send_finish']);
|
||||
$send_finish = $filter['send_finish'];
|
||||
if($send_finish === null) {
|
||||
$where .= " AND Preordernotification.send_finish = NULL";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("send_lock", $filter)) {
|
||||
$send_lock = $db->escape($filter['send_lock']);
|
||||
$send_lock = $filter['send_lock'];
|
||||
if($send_lock === null) {
|
||||
$where .= " AND Preordernotification.send_lock = NULL";
|
||||
}
|
||||
|
||||
@@ -120,11 +120,12 @@ class User extends mfBaseModel {
|
||||
|
||||
//var_dump($m);exit;
|
||||
|
||||
$abbr = "$firstname ";
|
||||
$abbr = substr($firstname, 0, 1). ". ";
|
||||
if($middlename) {
|
||||
$abbr .= substr($middlename, 0, 1). ". ";
|
||||
}
|
||||
$abbr .= substr($lastname, 0, 1). ". ";
|
||||
$abbr .= $lastname;
|
||||
|
||||
return $abbr;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,41 @@
|
||||
<?php
|
||||
require_once(realpath(dirname(__FILE__)."/internals.php"));
|
||||
|
||||
define("VCHECK_DEBUG", true);
|
||||
|
||||
/*
|
||||
* Essentials
|
||||
*/
|
||||
|
||||
define("MFAPPNAME","vcheck"); // used for cookie and logfile names
|
||||
define("MFAPPNAME","thetool"); // used for cookie and logfile names
|
||||
define("MFAPPNAME_SLUG", "the-tool");
|
||||
define("MFAPPNAME_FULL", "the tool");
|
||||
define("MFBASECONTROLLER_INIT_INCLUDE_FILE", APPDIR."Init/Init.php");
|
||||
|
||||
// the default Controller to call. Without an action, calls index action.
|
||||
define("DEFAULT_ROUTE","Dashboard");
|
||||
|
||||
|
||||
define("TT_DISABLE_EMAIL", false);
|
||||
|
||||
define("TESTMODE",false);
|
||||
define("MFVALUECACHE_DEBUG", false);
|
||||
define("LAYOUT_DEFAULTPACKAGE","default"); // mfLayout looks for templates in this folder
|
||||
|
||||
// database configuration
|
||||
define("FRONKDB_DBHOST","localhost");
|
||||
define("FRONKDB_DBUSER","vcheck");
|
||||
define("FRONKDB_DBUSER","thetool");
|
||||
define("FRONKDB_DBPASS","");
|
||||
define("FRONKDB_DBNAME","vcheck");
|
||||
define("FRONKDB_DBNAME","thetool");
|
||||
|
||||
// address DB for GWR data
|
||||
define("ADDRESSDB_DBHOST","localhost");
|
||||
define("ADDRESSDB_DBUSER","thetool_addressdb");
|
||||
define("ADDRESSDB_DBPASS","");
|
||||
define("ADDRESSDB_DBNAME","thetool_addressdb");
|
||||
|
||||
define("IVT_DBHOST", "localhost");
|
||||
define("IVT_DBUSER","ivtuser");
|
||||
define("IVT_DBPASS","");
|
||||
define("IVT_DBNAME","ivt");
|
||||
|
||||
// Logging configuration
|
||||
define("LOGTYPE","file"); // can be one of file, mysql, syslog; defaults to "file"
|
||||
@@ -23,19 +45,613 @@ define("LOGFILENAME",BASEDIR."/var/log/".MFAPPNAME.".log");
|
||||
* Application-specific settings
|
||||
*/
|
||||
|
||||
// increment when adding new api
|
||||
// used to route calls without explicit version
|
||||
define("API_VERSION", "v1");
|
||||
|
||||
define("TT_FEATURE_IVT", false);
|
||||
|
||||
define("TT_ROLES", ['systemowner','productowner','netowner','salespartner','pipeworker','lineworker','pipeplanner','lineplanner','netoperator','supplier','billing','employee','customer','contact','techcontact']);
|
||||
define("TT_NETWORK_ROLES", ['salespartner','pipeworker','lineworker','pipeplanner','lineplanner','netoperator']);
|
||||
define("TT_NETWORK_ROLES_WITH_OWNER", ['netowner','salespartner','pipeworker','lineworker','pipeplanner','lineplanner','netoperator']);
|
||||
define("TT_ADDRESS_LINK_TYPES", ['billing','employee','customer','contact','techcontact']);
|
||||
define("TT_ATTRIB_RTRTECHCODE_NAME","rtrcode");
|
||||
define("TT_ATTRIB_TERMINATION_REQUIRED_NAME", "termination_required");
|
||||
|
||||
define("TT_GEOCODING_API_URL", "https://maps.googleapis.com/maps/api/geocode/json");
|
||||
define("TT_GEOCODING_API_SECRET","");
|
||||
define("TT_MAPBOX_TILE_API_TOKEN", "");
|
||||
define("TT_BUILDINGSTATUS_CONNECTED", 50);
|
||||
define("TT_TERMSTATUS_ASSIGNED", 30);
|
||||
define("TT_TERMSTATUS_CONNECTED", 50);
|
||||
define("TT_TERMSTATUS_ACTIVE", 60);
|
||||
define("TT_PLACEHOLDER_GPS_LAT", "47.082999");
|
||||
define("TT_PLACEHOLDER_GPS_LONG", "15.425001");
|
||||
define("TT_FIRST_CUSTNUM", 102030);
|
||||
|
||||
define("TT_OUTGOING_EMAIL", "office@xinon.at");
|
||||
define("TT_OUTGOING_EMAIL_NAME", "XINON Kundenservice");
|
||||
define("TT_INTERNAL_BILLING_EMAIL_TO", "thetool-tobill@xinon.at");
|
||||
define("TT_EXTERNAL_BILLING_EMAIL_TO", "energie-billing@xinon.at");
|
||||
|
||||
define("TT_CUSTOM_ORDER_PDF_PER_NETOWNER", true);
|
||||
define("TT_CUSTOM_ORDER_PDF_DEFAULT_OWNER_ID", 1635);
|
||||
|
||||
define("TT_PREORDER_DISCOUNT_2", 25);
|
||||
define("TT_PREORDER_DISCOUNT_3", 33.33);
|
||||
define("TT_PREORDER_DISCOUNT_APART", 50);
|
||||
define("TT_PREORDER_DISCOUNT_BUSINESS", 16.667);
|
||||
|
||||
/*
|
||||
* Workflow Settings
|
||||
*/
|
||||
|
||||
define("TT_WORKFLOW_ITEM_STATUS_FIELD", "pipework_finished");
|
||||
define("TT_WORKFLOW_ITEM_STATUS_VALUE_PASSED", "am Grundstück");
|
||||
define("TT_WORKFLOW_ITEM_STATUS_VALUE_CONNECTED", "im Gebäude");
|
||||
|
||||
define("TT_WORKFLOW_ITEM_PIPEWORK_DONE", "pipework_finished");
|
||||
define("TT_WORKFLOW_ITEM_LINEWORK_DONE", "customer_passive_finished");
|
||||
|
||||
define("TT_WORKFLOW_BUILDING_FILE_TYPES", [
|
||||
"Rohrplan",
|
||||
"Gestattungsvertrag",
|
||||
"Foto Tiefbau",
|
||||
"Handskizze",
|
||||
"Anderes",
|
||||
]);
|
||||
define("TT_WORKFLOW_TERMINATION_FILE_TYPES", [
|
||||
"Spleissplan",
|
||||
"Foto Leitungsbau",
|
||||
"Handskizze",
|
||||
"Anderes",
|
||||
]);
|
||||
|
||||
define("TT_ORDER_FILE_TYPES", [
|
||||
"order_internet" => "Bestellung Internet & Telefon",
|
||||
"order_nextv" => "Bestellung nexTV",
|
||||
"order_general" => "Bestellung Allgemein",
|
||||
"order_project" => "Bestellung Projekt",
|
||||
"order_pbx" => "Bestellung Telefonanlage",
|
||||
"voicenumber_porting" => "Rufnummermitnahme",
|
||||
"handover_report" => "Übergabe-Protokoll",
|
||||
"sepa_form" => "Nur Einzugsermächtigung",
|
||||
"emailjournal_customer" => "Mailverlauf mit Kunde",
|
||||
"old_phone_contract" => "Telefonvertrag von Voranbieter",
|
||||
"other" => "Sonstiges Dokument",
|
||||
]);
|
||||
|
||||
define("TT_CABLE_COLORS", [
|
||||
"rot" => [
|
||||
"hex" => "FF0000",
|
||||
"hexfg" => "FFFFFF",
|
||||
"r" => 255,
|
||||
"g" => 0,
|
||||
"b" => 0,
|
||||
"mark" => false
|
||||
],
|
||||
"gruen" => [
|
||||
"hex" => "00FF00",
|
||||
"hexfg" => "000000",
|
||||
"r" => 0,
|
||||
"g" => 255,
|
||||
"b" => 0,
|
||||
"mark" => false
|
||||
],
|
||||
"blau" => [
|
||||
"hex" => "0000FF",
|
||||
"hexfg" => "FFFFFF",
|
||||
"r" => 0,
|
||||
"g" => 0,
|
||||
"b" => 255,
|
||||
"mark" => false
|
||||
],
|
||||
"gelb" => [
|
||||
"hex" => "FFFF00",
|
||||
"hexfg" => "000000",
|
||||
"r" => 255,
|
||||
"g" => 255,
|
||||
"b" => 0,
|
||||
"mark" => false
|
||||
],
|
||||
"weiss" => [
|
||||
"hex" => "FFFFFF",
|
||||
"hexfg" => "000000",
|
||||
"r" => 255,
|
||||
"g" => 255,
|
||||
"b" => 255,
|
||||
"mark" => false
|
||||
],
|
||||
"natur" => [
|
||||
"hex" => "FFFFCC",
|
||||
"hexfg" => "000000",
|
||||
"r" => 255,
|
||||
"g" => 255,
|
||||
"b" => 204,
|
||||
"mark" => false
|
||||
],
|
||||
"grau" => [
|
||||
"hex" => "888888",
|
||||
"hexfg" => "FFFFFF",
|
||||
"r" => 136,
|
||||
"g" => 136,
|
||||
"b" => 136,
|
||||
"mark" => false
|
||||
],
|
||||
"braun" => [
|
||||
"hex" => "A52A2A",
|
||||
"hexfg" => "FFFFFF",
|
||||
"r" => 165,
|
||||
"g" => 42,
|
||||
"b" => 42,
|
||||
"mark" => false
|
||||
],
|
||||
"violett" => [
|
||||
"hex" => "8800FF",
|
||||
"hexfg" => "FFFFFF",
|
||||
"r" => 136,
|
||||
"g" => 0,
|
||||
"b" => 255,
|
||||
"mark" => false
|
||||
],
|
||||
"tuerkis" => [
|
||||
"hex" => "00FFFF",
|
||||
"hexfg" => "000000",
|
||||
"r" => 0,
|
||||
"g" => 255,
|
||||
"b" => 255,
|
||||
"mark" => false
|
||||
],
|
||||
"schwarz" => [
|
||||
"hex" => "000000",
|
||||
"hexfg" => "FFFFFF",
|
||||
"r" => 0,
|
||||
"g" => 0,
|
||||
"b" => 0,
|
||||
"mark" => false
|
||||
],
|
||||
"orange" => [
|
||||
"hex" => "FF8800",
|
||||
"hexfg" => "FFFFFF",
|
||||
"r" => 255,
|
||||
"g" => 136,
|
||||
"b" => 0,
|
||||
"mark" => false
|
||||
],
|
||||
"rosa" => [
|
||||
"hex" => "FF0088",
|
||||
"hexfg" => "FFFFFF",
|
||||
"r" => 255,
|
||||
"g" => 0,
|
||||
"b" => 136,
|
||||
"mark" => false
|
||||
],
|
||||
"rot-1R" => [
|
||||
"hex" => "FF0000",
|
||||
"hexfg" => "FFFFFF",
|
||||
"r" => 255,
|
||||
"g" => 0,
|
||||
"b" => 0,
|
||||
"mark" => true
|
||||
],
|
||||
"gruen-1R" => [
|
||||
"hex" => "00FF00",
|
||||
"hexfg" => "000000",
|
||||
"r" => 0,
|
||||
"g" => 255,
|
||||
"b" => 0,
|
||||
"mark" => true
|
||||
],
|
||||
"blau-1R" => [
|
||||
"hex" => "0000FF",
|
||||
"hexfg" => "FFFFFF",
|
||||
"r" => 0,
|
||||
"g" => 0,
|
||||
"b" => 255,
|
||||
"mark" => true
|
||||
],
|
||||
"gelb-1R" => [
|
||||
"hex" => "FFFF00",
|
||||
"hexfg" => "000000",
|
||||
"r" => 255,
|
||||
"g" => 255,
|
||||
"b" => 0,
|
||||
"mark" => true
|
||||
],
|
||||
"weiss-1R" => [
|
||||
"hex" => "FFFFFF",
|
||||
"hexfg" => "000000",
|
||||
"r" => 255,
|
||||
"g" => 255,
|
||||
"b" => 255,
|
||||
"mark" => true
|
||||
],
|
||||
"grau-1R" => [
|
||||
"hex" => "888888",
|
||||
"hexfg" => "FFFFFF",
|
||||
"r" => 136,
|
||||
"g" => 136,
|
||||
"b" => 136,
|
||||
"mark" => true
|
||||
],
|
||||
"braun-1R" => [
|
||||
"hex" => "A52A2A",
|
||||
"hexfg" => "FFFFFF",
|
||||
"r" => 165,
|
||||
"g" => 42,
|
||||
"b" => 42,
|
||||
"mark" => true
|
||||
],
|
||||
"violett-1R" => [
|
||||
"hex" => "8800FF",
|
||||
"hexfg" => "FFFFFF",
|
||||
"r" => 136,
|
||||
"g" => 0,
|
||||
"b" => 255,
|
||||
"mark" => true
|
||||
],
|
||||
"tuerkis-1R" => [
|
||||
"hex" => "00FFFF",
|
||||
"hexfg" => "000000",
|
||||
"r" => 0,
|
||||
"g" => 255,
|
||||
"b" => 255,
|
||||
"mark" => true
|
||||
],
|
||||
"schwarz-1R" => [
|
||||
"hex" => "000000",
|
||||
"hexfg" => "FFFFFF",
|
||||
"r" => 0,
|
||||
"g" => 0,
|
||||
"b" => 0,
|
||||
"mark" => true
|
||||
],
|
||||
"orange-1R" => [
|
||||
"hex" => "FF8800",
|
||||
"hexfg" => "FFFFFF",
|
||||
"r" => 255,
|
||||
"g" => 136,
|
||||
"b" => 0,
|
||||
"mark" => true
|
||||
],
|
||||
"rosa-1R" => [
|
||||
"hex" => "FF0088",
|
||||
"hexfg" => "FFFFFF",
|
||||
"r" => 255,
|
||||
"g" => 0,
|
||||
"b" => 136,
|
||||
"mark" => true
|
||||
],
|
||||
// gabocom colors
|
||||
"Rot-Gelb" => [
|
||||
"hex" => "FF0000",
|
||||
"hexfg" => "FFFFFF",
|
||||
"hex2" => "FFFF00",
|
||||
"hexfg2" => "000000",
|
||||
"r" => 255,
|
||||
"g" => 0,
|
||||
"b" => 0,
|
||||
"r2" => 255,
|
||||
"g2" => 255,
|
||||
"b2" => 0,
|
||||
"two-color" => true
|
||||
],
|
||||
"Rot-Gruen" => [
|
||||
"hex" => "FF0000",
|
||||
"hexfg" => "FFFFFF",
|
||||
"hex2" => "00FF00",
|
||||
"hexfg2" => "000000",
|
||||
"r" => 255,
|
||||
"g" => 0,
|
||||
"b" => 0,
|
||||
"r2" => 0,
|
||||
"g2" => 255,
|
||||
"b2" => 0,
|
||||
"two-color" => true
|
||||
],
|
||||
"Rot-Blau" => [
|
||||
"hex" => "FF0000",
|
||||
"hexfg" => "FFFFFF",
|
||||
"hex2" => "0000FF",
|
||||
"hexfg2" => "FFFFFF",
|
||||
"r" => 255,
|
||||
"g" => 0,
|
||||
"b" => 0,
|
||||
"r2" => 0,
|
||||
"g2" => 0,
|
||||
"b2" => 255,
|
||||
"two-color" => true
|
||||
],
|
||||
"Rot-Violett" => [
|
||||
"hex" => "FF0000",
|
||||
"hexfg" => "FFFFFF",
|
||||
"hex2" => "8800FF",
|
||||
"hexfg2" => "FFFFFF",
|
||||
"r" => 255,
|
||||
"g" => 0,
|
||||
"b" => 0,
|
||||
"r2" => 136,
|
||||
"g2" => 0,
|
||||
"b2" => 255,
|
||||
"two-color" => true
|
||||
],
|
||||
"Rot-Grau" => [
|
||||
"hex" => "FF0000",
|
||||
"hexfg" => "FFFFFF",
|
||||
"hex2" => "888888",
|
||||
"hexfg2" => "FFFFFF",
|
||||
"r" => 255,
|
||||
"g" => 0,
|
||||
"b" => 0,
|
||||
"r2" => 136,
|
||||
"g2" => 136,
|
||||
"b2" => 136,
|
||||
"two-color" => true
|
||||
],
|
||||
"Gelb-Blau" => [
|
||||
"hex" => "FFFF00",
|
||||
"hexfg" => "000000",
|
||||
"hex2" => "0000FF",
|
||||
"hexfg2" => "FFFFFF",
|
||||
"r" => 255,
|
||||
"g" => 255,
|
||||
"b" => 0,
|
||||
"r2" => 0,
|
||||
"g2" => 0,
|
||||
"b2" => 255,
|
||||
"two-color" => true
|
||||
],
|
||||
"Gelb-Violett" => [
|
||||
"hex" => "FFFF00",
|
||||
"hexfg" => "000000",
|
||||
"hex2" => "8800FF",
|
||||
"hexfg2" => "FFFFFF",
|
||||
"r" => 255,
|
||||
"g" => 255,
|
||||
"b" => 0,
|
||||
"r2" => 136,
|
||||
"g2" => 0,
|
||||
"b2" => 255,
|
||||
"two-color" => true
|
||||
],
|
||||
"Gelb-Grau" => [
|
||||
"hex" => "FFFF00",
|
||||
"hexfg" => "000000",
|
||||
"hex2" => "888888",
|
||||
"hexfg2" => "FFFFFF",
|
||||
"r" => 255,
|
||||
"g" => 255,
|
||||
"b" => 0,
|
||||
"r2" => 136,
|
||||
"g2" => 136,
|
||||
"b2" => 136,
|
||||
"two-color" => true
|
||||
],
|
||||
"Gruen-Blau" => [
|
||||
"hex" => "00FF00",
|
||||
"hexfg" => "000000",
|
||||
"hex2" => "0000FF",
|
||||
"hexfg2" => "FFFFFF",
|
||||
"r" => 0,
|
||||
"g" => 255,
|
||||
"b" => 0,
|
||||
"r2" => 0,
|
||||
"g2" => 0,
|
||||
"b2" => 255,
|
||||
"two-color" => true
|
||||
],
|
||||
"Gruen-Violett" => [
|
||||
"hex" => "00FF00",
|
||||
"hexfg" => "000000",
|
||||
"hex2" => "8800FF",
|
||||
"hexfg2" => "FFFFFF",
|
||||
"r" => 0,
|
||||
"g" => 255,
|
||||
"b" => 0,
|
||||
"r2" => 136,
|
||||
"g2" => 0,
|
||||
"b2" => 255,
|
||||
"two-color" => true
|
||||
],
|
||||
"Gruen-Grau" => [
|
||||
"hex" => "00FF00",
|
||||
"hexfg" => "000000",
|
||||
"hex2" => "888888",
|
||||
"hexfg2" => "FFFFFF",
|
||||
"r" => 0,
|
||||
"g" => 255,
|
||||
"b" => 0,
|
||||
"r2" => 136,
|
||||
"g2" => 136,
|
||||
"b2" => 136,
|
||||
"two-color" => true
|
||||
],
|
||||
"Braun-Blau" => [
|
||||
"hex" => "A52A2A",
|
||||
"hexfg" => "FFFFFF",
|
||||
"hex2" => "0000FF",
|
||||
"hexfg2" => "FFFFFF",
|
||||
"r" => 165,
|
||||
"g" => 42,
|
||||
"b" => 42,
|
||||
"r2" => 0,
|
||||
"g2" => 0,
|
||||
"b2" => 255,
|
||||
"two-color" => true
|
||||
],
|
||||
"Braun-Violett" => [
|
||||
"hex" => "A52A2A",
|
||||
"hexfg" => "FFFFFF",
|
||||
"hex2" => "8800FF",
|
||||
"hexfg2" => "FFFFFF",
|
||||
"r" => 165,
|
||||
"g" => 42,
|
||||
"b" => 42,
|
||||
"r2" => 136,
|
||||
"g2" => 0,
|
||||
"b2" => 255,
|
||||
"two-color" => true
|
||||
],
|
||||
"Braun-Grau" => [
|
||||
"hex" => "A52A2A",
|
||||
"hexfg" => "FFFFFF",
|
||||
"hex2" => "888888",
|
||||
"hexfg2" => "FFFFFF",
|
||||
"r" => 165,
|
||||
"g" => 42,
|
||||
"b" => 42,
|
||||
"r2" => 136,
|
||||
"g2" => 136,
|
||||
"b2" => 136,
|
||||
"two-color" => true
|
||||
],
|
||||
"Braun-Gruen" => [
|
||||
"hex" => "A52A2A",
|
||||
"hexfg" => "FFFFFF",
|
||||
"hex2" => "00FF00",
|
||||
"hexfg2" => "000000",
|
||||
"r" => 165,
|
||||
"g" => 42,
|
||||
"b" => 42,
|
||||
"r2" => 0,
|
||||
"g2" => 255,
|
||||
"b2" => 0,
|
||||
"two-color" => true
|
||||
],
|
||||
"Braun-Gelb" => [
|
||||
"hex" => "A52A2A",
|
||||
"hexfg" => "FFFFFF",
|
||||
"hex2" => "FFFF00",
|
||||
"hexfg2" => "000000",
|
||||
"r" => 165,
|
||||
"g" => 42,
|
||||
"b" => 42,
|
||||
"r2" => 255,
|
||||
"g2" => 255,
|
||||
"b2" => 0,
|
||||
"two-color" => true
|
||||
],
|
||||
"Braun-Rot" => [
|
||||
"hex" => "A52A2A",
|
||||
"hexfg" => "FFFFFF",
|
||||
"hex2" => "FF0000",
|
||||
"hexfg2" => "FFFFFF",
|
||||
"r" => 165,
|
||||
"g" => 42,
|
||||
"b" => 42,
|
||||
"r2" => 255,
|
||||
"g2" => 0,
|
||||
"b2" => 0,
|
||||
"two-color" => true
|
||||
],
|
||||
"Schwarz-Rot" => [
|
||||
"hex" => "000000",
|
||||
"hexfg" => "FFFFFF",
|
||||
"hex2" => "FF0000",
|
||||
"hexfg2" => "FFFFFF",
|
||||
"r" => 0,
|
||||
"g" => 0,
|
||||
"b" => 0,
|
||||
"r2" => 255,
|
||||
"g2" => 0,
|
||||
"b2" => 0,
|
||||
"two-color" => true
|
||||
],
|
||||
"Schwarz-Gelb" => [
|
||||
"hex" => "000000",
|
||||
"hexfg" => "FFFFFF",
|
||||
"hex2" => "FFFF00",
|
||||
"hexfg2" => "000000",
|
||||
"r" => 0,
|
||||
"g" => 0,
|
||||
"b" => 0,
|
||||
"r2" => 255,
|
||||
"g2" => 255,
|
||||
"b2" => 0,
|
||||
"two-color" => true
|
||||
],
|
||||
"Schwarz-Gruen" => [
|
||||
"hex" => "000000",
|
||||
"hexfg" => "FFFFFF",
|
||||
"hex2" => "00FF00",
|
||||
"hexfg2" => "000000",
|
||||
"r" => 0,
|
||||
"g" => 0,
|
||||
"b" => 0,
|
||||
"r2" => 0,
|
||||
"g2" => 255,
|
||||
"b2" => 0,
|
||||
"two-color" => true
|
||||
],
|
||||
"Schwarz-Blau" => [
|
||||
"hex" => "000000",
|
||||
"hexfg" => "FFFFFF",
|
||||
"hex2" => "0000FF",
|
||||
"hexfg2" => "FFFFFF",
|
||||
"r" => 0,
|
||||
"g" => 0,
|
||||
"b" => 0,
|
||||
"r2" => 0,
|
||||
"g2" => 0,
|
||||
"b2" => 255,
|
||||
"two-color" => true
|
||||
],
|
||||
"Schwarz-Violett" => [
|
||||
"hex" => "000000",
|
||||
"hexfg" => "FFFFFF",
|
||||
"hex2" => "8800FF",
|
||||
"hexfg2" => "000000",
|
||||
"r" => 0,
|
||||
"g" => 0,
|
||||
"b" => 0,
|
||||
"r2" => 136,
|
||||
"g2" => 0,
|
||||
"b2" => 255,
|
||||
"two-color" => true
|
||||
],
|
||||
"Schwarz-Grau" => [
|
||||
"hex" => "000000",
|
||||
"hexfg" => "FFFFFF",
|
||||
"hex2" => "888888",
|
||||
"hexfg2" => "FFFFFF",
|
||||
"r" => 0,
|
||||
"g" => 0,
|
||||
"b" => 0,
|
||||
"r2" => 136,
|
||||
"g2" => 136,
|
||||
"b2" => 136,
|
||||
"two-color" => true
|
||||
],
|
||||
"Schwarz-Braun" => [
|
||||
"hex" => "000000",
|
||||
"hexfg" => "FFFFFF",
|
||||
"hex2" => "A52A2A",
|
||||
"hexfg2" => "FFFFFF",
|
||||
"r" => 0,
|
||||
"g" => 0,
|
||||
"b" => 0,
|
||||
"r2" => 165,
|
||||
"g2" => 42,
|
||||
"b2" => 42,
|
||||
"two-color" => true
|
||||
]
|
||||
|
||||
|
||||
|
||||
]);
|
||||
|
||||
|
||||
// Upload settings
|
||||
define('MFUPLOAD_FILE_SAVE_PATH',BASEDIR.'/files'); // folder where files will be stored
|
||||
define('MFUPLOAD_ALLOWED_EXTENSIONS', 'jpg|jpeg|gif|png|pdf|doc.?|xls.?'); // allowed file extensions in regex format
|
||||
define('MFUPLOAD_ALLOWED_EXTENSIONS_STR',"jpg, png, gif, pdf, doc, xls");
|
||||
define('MFUPLOAD_FILE_MAX_SIZE',8192*1024); // Max filesize (8 MB)
|
||||
define('MFUPLOAD_ALLOWED_EXTENSIONS', 'jpg|jpeg|gif|png|pdf|doc.?|xls.?|txt|conf|svg|csv'); // allowed file extensions in regex format
|
||||
define('MFUPLOAD_ALLOWED_EXTENSIONS_STR',"jpg, png, gif, pdf, doc, xls, csv, txt, conf");
|
||||
define('MFUPLOAD_FILE_MAX_SIZE',128*1024*1024); // Max filesize (128 MB)
|
||||
define('MFUPLOAD_DIRMODE',0777);
|
||||
define('MFUPLOAD_FILEMODE',0666);
|
||||
|
||||
define("A1VULL_APIURL", '');
|
||||
define("A1VULL_APIUSER", '');
|
||||
define("A1VULL_APIPASS", '');
|
||||
|
||||
define("HOME_PROVIDER_ID", 1);
|
||||
define('MFLOCALE_TIME', "de_AT.UTF-8");
|
||||
define('MFLOCALE_MONETARY', "de_AT.UTF-8");
|
||||
define('MFLOCALE_NUMERIC', "de_AT.UTF-8");
|
||||
|
||||
/*
|
||||
* Maintainer / developer settings
|
||||
@@ -45,14 +661,10 @@ define("MFUSEFANCYURLS",true); // to use urls in folder style
|
||||
// If your database field names start with a prefix (like Customer_id), set this to true.
|
||||
// Required when extending from mfBase classes (mfBaseController and mfBaseModel).
|
||||
define("MFMODEL_USEFIELDPREFIX",false);
|
||||
define("TESTMODE",false);
|
||||
define("LAYOUT_DEFAULTPACKAGE","default"); // mfLayout looks for templates in this folder
|
||||
|
||||
// the default Controller to call. Without an action, calls index action.
|
||||
define("DEFAULT_ROUTE","Check");
|
||||
|
||||
// use mfLogin?
|
||||
define("MFUSELOGIN",true);
|
||||
define("MFSESSION",true);
|
||||
// The name of your users table. Required by stock mfUser and mfLoginController
|
||||
define("MFUSERTABLE","Worker");
|
||||
// use mfMenu?
|
||||
@@ -61,7 +673,11 @@ define("MFUSEMENU",false);
|
||||
define("MFMENUTABLE","mfMenu");
|
||||
|
||||
// change this to wkhtmltopdf-amd64 if your system supports 64 bit binaries
|
||||
define("WKHTMLTOPDF_BIN",LIBDIR."/mvcfronk/mfWkhtmltopdf/bin/wkhtmltopdf-i386");
|
||||
define("WKHTMLTOPDF_ARGS",'-q -s A4 --footer-center [page]/[topage]');
|
||||
define("WKHTMLTOPDF_BIN",LIBDIR."/mvcfronk/mfWkhtmltopdf/bin/wkhtmltopdf-amd64");
|
||||
//define("WKHTMLTOPDF_ARGS",'-q -s A4 --footer-right [page]/[topage]');
|
||||
define("WKHTMLTOPDF_ARGS",'-q -s A4 --enable-local-file-access');
|
||||
// where to save PDF files
|
||||
define("PDFOUTPUTPATH",BASEDIR."/var/temp");
|
||||
|
||||
define("GIT_BIN_PATH", "/usr/bin/git");
|
||||
define("PDFTOTEXT_BIN_PATH", "/usr/bin/pdftotext");
|
||||
|
||||
@@ -43,12 +43,19 @@ class mfBaseApicontroller {
|
||||
|
||||
register_shutdown_function(["mfBaseApicontroller", "return_errors"]);
|
||||
|
||||
// allow origins from config file
|
||||
if(defined("API_CORS_ALLOWED_HOSTNAMES") && is_array(API_CORS_ALLOWED_HOSTNAMES)) {
|
||||
foreach(API_CORS_ALLOWED_HOSTNAMES as $origin) {
|
||||
$this->addAllowedOrigin($origin);
|
||||
}
|
||||
}
|
||||
|
||||
// CORS preflight
|
||||
// allow all origins
|
||||
if($this->http_method == "OPTIONS") {
|
||||
// dont execute route, OPTIONS only requires CORS headers
|
||||
header("Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS");
|
||||
header("Access-Control-Allow-Headers: X-Api-Key");
|
||||
header("Access-Control-Allow-Headers: X-Api-Key, accept, Content-Type");
|
||||
|
||||
if(preg_match('#^(https?)://([^/:]+)(:\d+)?/?$#i', $this->headers['origin'], $m)) {
|
||||
$origin_proto = $m[1];
|
||||
@@ -71,7 +78,7 @@ class mfBaseApicontroller {
|
||||
if($this->requireAuth) {
|
||||
$this->authenticateUser();
|
||||
if(method_exists($this,"authenticated")) {
|
||||
$this->authenticated();
|
||||
$this->authenticated(); // event defined in extending class
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +136,7 @@ class mfBaseApicontroller {
|
||||
|
||||
if(!$me->id) {
|
||||
header("Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS");
|
||||
header("Access-Control-Allow-Headers: X-Api-Key");
|
||||
header("Access-Control-Allow-Headers: X-Api-Key, accept, Content-Type");
|
||||
|
||||
if(preg_match('#^(https?)://([^/:]+)(:\d+)?/?$#i', $this->headers['origin'], $m)) {
|
||||
$origin_proto = $m[1];
|
||||
@@ -326,7 +333,7 @@ class mfBaseApicontroller {
|
||||
|
||||
private function createCorsHeaders() {
|
||||
header("Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS");
|
||||
header("Access-Control-Allow-Headers: X-Api-Key");
|
||||
header("Access-Control-Allow-Headers: X-Api-Key, accept, Content-Type");
|
||||
|
||||
if(!is_array($this->allowed_origins) || !count($this->allowed_origins)) {
|
||||
return true;
|
||||
|
||||
@@ -12,14 +12,13 @@ require_once(LIBDIR."/mvcfronk/mfBase/mfBaseModel.php");
|
||||
require_once(LIBDIR."/mvcfronk/mfBase/mfBaseController.php");
|
||||
|
||||
|
||||
$netzgebiet_name_main = "Liezen";
|
||||
$freigabe_default = json_encode(["interest", "provision", "order", "reorder"]);
|
||||
|
||||
$adb_gemeinde_id = 1462;
|
||||
|
||||
$me = new User(1);
|
||||
|
||||
$folder = __DIR__."/import/";
|
||||
$csvname = "SDIBuilding__Locations__FTTx_premstaetten_2023-03-07.csv";
|
||||
$csvname = "RIMO_230307_Adressen_Cluster_Lieboch.csv";
|
||||
$filename = $folder.$csvname;
|
||||
|
||||
$db = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME);
|
||||
@@ -41,25 +40,26 @@ while($csv = fgetcsv($input, 0, ";")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$hausnummer_extref = trim($csv[64]);
|
||||
$adrcd_subcd = trim($csv[46]);
|
||||
$netzgebiet_extref = trim($csv[54]);
|
||||
$grund_nr = trim($csv[73]);
|
||||
$hausnummer_extref = trim($csv[48]);
|
||||
$adrcd = trim($csv[65]);
|
||||
$netzgebiet_extref = trim($csv[55]);
|
||||
$grund_nr = trim($csv[74]);
|
||||
//gps_long, gps_lat
|
||||
|
||||
//$rollout_time = trim($csv[17]);
|
||||
//$rollout_info = trim($csv[18]);
|
||||
//$freigabe = trim($csv[19])
|
||||
$unit_count = trim($csv[78]);
|
||||
$gdaeigenschaft = trim($csv[66]);
|
||||
$fcp_name = trim($csv[49]);
|
||||
$unit_count = trim($csv[5]);
|
||||
$gdaeigenschaft = trim($csv[67]);
|
||||
$fcp_name = trim($csv[50]);
|
||||
|
||||
$execution_state = trim($csv[8]);
|
||||
$btype = trim($csv[30]);
|
||||
$execution_state = trim($csv[9]);
|
||||
$btype = trim($csv[31]);
|
||||
|
||||
if(!$netzgebiet_extref) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$netzgebiet = ADBNetzgebietModel::getFirst(["extref" => $netzgebiet_extref]);
|
||||
if(!$netzgebiet) {
|
||||
@@ -75,16 +75,10 @@ while($csv = fgetcsv($input, 0, ";")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$adrcd = false;
|
||||
if($adrcd_subcd) {
|
||||
$adrparts = explode("-", $adrcd_subcd);
|
||||
$adrcd = $adrparts[0];
|
||||
}
|
||||
|
||||
$gem_name = trim($csv[59]);
|
||||
$gem_name = trim($csv[60]);
|
||||
$plz_string = trim($csv[88]);
|
||||
$ort_name = trim($csv[31]);
|
||||
$strasse_hausnummer = trim($csv[22]);
|
||||
$ort_name = trim($csv[32]);
|
||||
$strasse_hausnummer = trim($csv[23]);
|
||||
|
||||
$strasse_name = "";
|
||||
$hausnummer_name = "";
|
||||
@@ -98,25 +92,8 @@ while($csv = fgetcsv($input, 0, ";")) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
$adrcd = trim($csv[0]);
|
||||
$gem_kz = trim($csv[2]);
|
||||
$gem_name = trim($csv[3]);
|
||||
$ort_kz = trim($csv[5]);
|
||||
$plz_string = trim($csv[4]);
|
||||
$ort_name = trim($csv[6]);
|
||||
$skz = trim($csv[7]);
|
||||
$strasse_name = trim($csv[8]);
|
||||
$hausnummer_string = trim($csv[9]);
|
||||
$hausnummer_extref = trim($csv[0]);
|
||||
if(in_array($hausnummer_extref, $h_extrefs)) {
|
||||
die("Hausnummer extref doppelt! $hausnummer_extref\n");
|
||||
}
|
||||
$h_extrefs[] = $hausnummer_extref;
|
||||
*/
|
||||
//$lat = str_replace(",",".",trim($csv[7]));
|
||||
//$long = str_replace(",",".",trim($csv[8]));
|
||||
$lat = str_replace(",",".",trim($csv[10]));
|
||||
$long = str_replace(",",".",trim($csv[11]));
|
||||
|
||||
|
||||
if(!$adrcd) {
|
||||
@@ -128,45 +105,31 @@ while($csv = fgetcsv($input, 0, ";")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!$hausnummer_extref) {
|
||||
die("!!! Keine Hausnummer Extref\n");
|
||||
}
|
||||
|
||||
|
||||
if($hausnummer_extref == "25012262") {
|
||||
$unit_count = 45;
|
||||
}
|
||||
if($hausnummer_extref == "25012676") {
|
||||
if(!$hausnummer_extref || !is_numeric($hausnummer_extref)) {
|
||||
//echo("Keine Hausnummer Extref\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
if($hausnummer_extref == "25012153" || $hausnummer_extref == "25012155" || $hausnummer_extref == "25012157") {
|
||||
continue;
|
||||
}
|
||||
if($hausnummer_extref == "25012159") {
|
||||
$unit_count = 61;
|
||||
}
|
||||
if($adrcd == "25023176") continue;
|
||||
|
||||
if($hausnummer_extref == "25010649") {
|
||||
continue;
|
||||
}
|
||||
if($hausnummer_extref == "25010723" || $hausnummer_extref == "25010816") {
|
||||
continue;
|
||||
}
|
||||
|
||||
$existing_hausnummer = ADBHausnummerModel::getFirst(["extref" => $hausnummer_extref]);
|
||||
$existing_hausnummer = ADBHausnummerModel::getFirst(["extref" => $hausnummer_extref, "gemeinde_id" => $adb_gemeinde_id]);
|
||||
if(!$existing_hausnummer) {
|
||||
$existing_hausnummer = ADBHausnummerModel::getFirst(["adrcd" => $adrcd]);
|
||||
}
|
||||
if(!$existing_hausnummer) {
|
||||
|
||||
|
||||
|
||||
if(!$existing_hausnummer) {
|
||||
//echo "$hausnummer_extref not found $strasse_name $hausnummer_name\n";
|
||||
//continue;
|
||||
|
||||
// find hausnummer
|
||||
//echo "$strasse_name $hausnummer_name\n";
|
||||
|
||||
if($strasse_name == "Toepferring") $strasse_name = "Töpferring";
|
||||
if($strasse_name == "Foehrenweg") $strasse_name = "Föhrenweg";
|
||||
//if($strasse_name == "Toepferring") $strasse_name = "Töpferring";
|
||||
//if($strasse_name == "Foehrenweg") $strasse_name = "Föhrenweg";
|
||||
|
||||
if($strasse_name == "Hans-Thalhammer-Straße") $strasse_name = "H. Thalhammer-Straße";
|
||||
if($strasse_name == "Packerstraße") $strasse_name = "Packer Straße";
|
||||
|
||||
$strasse_name = $db->escape($strasse_name);
|
||||
$hausnummer_name = $db->escape($hausnummer_name);
|
||||
@@ -195,7 +158,7 @@ while($csv = fgetcsv($input, 0, ";")) {
|
||||
}
|
||||
|
||||
|
||||
$sql = "SELECT * FROM view_hausnummer WHERE gemeinde_id = 1 AND strasse IN ('". implode("', '", $strasse_search)."') AND hausnummer='$hausnummer_name'";
|
||||
$sql = "SELECT * FROM view_hausnummer WHERE gemeinde_id = $adb_gemeinde_id AND strasse IN ('". implode("', '", $strasse_search)."') AND hausnummer='$hausnummer_name'";
|
||||
$res = $db->query($sql);
|
||||
|
||||
if($db->num_rows($res)) {
|
||||
@@ -209,6 +172,12 @@ while($csv = fgetcsv($input, 0, ";")) {
|
||||
|
||||
$existing_hausnummer->extref = $hausnummer_extref;
|
||||
$existing_hausnummer->grund_nr = $grund_nr;
|
||||
|
||||
if($lat && $long) {
|
||||
$existing_hausnummer->gps_lat = $lat;
|
||||
$existing_hausnummer->gps_long = $long;
|
||||
}
|
||||
|
||||
$existing_hausnummer->gdaeigenschaft = $gdaeigenschaft;
|
||||
$existing_hausnummer->rimo_fcp_name = $fcp_name;
|
||||
if(!$existing_hausnummer->oaid) {
|
||||
@@ -217,9 +186,11 @@ while($csv = fgetcsv($input, 0, ";")) {
|
||||
$existing_hausnummer->save();
|
||||
|
||||
} else {
|
||||
echo "Address not found (straße: $strasse_name, hausnummer: $hausnummer_name, adrcd: $adrcd, extref: $hausnummer_extref, unit_count: $unit_count)\n";
|
||||
echo "Address not found (straße: $strasse_name, hausnummer: $hausnummer_name, adrcd: $adrcd, extref: $hausnummer_extref)\n";
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
|
||||
// found hausnummer
|
||||
$existing_hausnummer->netzgebiet_id = $netzgebiet->id;
|
||||
if(!$existing_hausnummer->adrcd) {
|
||||
@@ -228,6 +199,10 @@ while($csv = fgetcsv($input, 0, ";")) {
|
||||
|
||||
$existing_hausnummer->extref = $hausnummer_extref;
|
||||
$existing_hausnummer->grund_nr = $grund_nr;
|
||||
if($lat && $long) {
|
||||
$existing_hausnummer->gps_lat = $lat;
|
||||
$existing_hausnummer->gps_long = $long;
|
||||
}
|
||||
$existing_hausnummer->gdaeigenschaft = $gdaeigenschaft;
|
||||
$existing_hausnummer->rimo_fcp_name = $fcp_name;
|
||||
if(!$existing_hausnummer->oaid) {
|
||||
@@ -235,7 +210,9 @@ while($csv = fgetcsv($input, 0, ";")) {
|
||||
}
|
||||
$existing_hausnummer->save();
|
||||
}
|
||||
continue;
|
||||
//continue;
|
||||
|
||||
|
||||
|
||||
// add new units
|
||||
$existing_units_count = ADBWohneinheitModel::count(['hausnummer_id' => $existing_hausnummer->id]);
|
||||
|
||||
@@ -0,0 +1,356 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
|
||||
//require 'vendor/autoload.php';
|
||||
require("../../../config/config.php");
|
||||
|
||||
define('FRONKDB_SQLDEBUG',false);
|
||||
error_reporting(E_ALL & ~(E_NOTICE | E_STRICT | E_DEPRECATED));
|
||||
|
||||
require_once(LIBDIR."/mvcfronk/mfRouter/mfRouter.php");
|
||||
require_once(LIBDIR."/mvcfronk/mfBase/mfBaseModel.php");
|
||||
require_once(LIBDIR."/mvcfronk/mfBase/mfBaseController.php");
|
||||
|
||||
|
||||
$freigabe_default = json_encode(["interest", "provision", "order", "reorder"]);
|
||||
|
||||
|
||||
$me = new User(1);
|
||||
|
||||
$folder = __DIR__."/import/";
|
||||
$csvname = "SDIBuilding__Locations_FTTx__Nord-update-2023-03-29.csv";
|
||||
$filename = $folder.$csvname;
|
||||
|
||||
$db = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME);
|
||||
$log = mfLoghandler::singleton();
|
||||
|
||||
$input = fopen($filename, "r");
|
||||
|
||||
$h_extrefs = [];
|
||||
|
||||
$c = 0;
|
||||
$l = 0;
|
||||
$u = 0;
|
||||
$w = 0;
|
||||
while($csv = fgetcsv($input, 0, ";")) {
|
||||
$l++;
|
||||
if($l == 1) continue;
|
||||
|
||||
$hausnummer = false;
|
||||
|
||||
if(!trim($csv[0])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$hausnummer_extref = trim($csv[64]);
|
||||
$adrcd_subcd = trim($csv[46]);
|
||||
$netzgebiet_extref = trim($csv[54]);
|
||||
$grund_nr = trim($csv[73]);
|
||||
$lat = str_replace(",",".",trim($csv[9]));
|
||||
$long = str_replace(",",".",trim($csv[10]));
|
||||
//$rollout_time = trim($csv[17]);
|
||||
//$rollout_info = trim($csv[18]);
|
||||
//$freigabe = trim($csv[19])
|
||||
$unit_count = trim($csv[78]);
|
||||
$gdaeigenschaft = trim($csv[66]);
|
||||
$fcp_name = trim($csv[49]);
|
||||
|
||||
$execution_state = trim($csv[8]);
|
||||
$btype = trim($csv[30]);
|
||||
|
||||
if(!$netzgebiet_extref) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$netzgebiet = ADBNetzgebietModel::getFirst(["extref" => $netzgebiet_extref]);
|
||||
if(!$netzgebiet) {
|
||||
echo "netzgebiet not found\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
if($execution_state == "Canceled") {
|
||||
continue;
|
||||
}
|
||||
|
||||
if($btype == "Greenfield") {
|
||||
continue;
|
||||
}
|
||||
|
||||
$adrcd = false;
|
||||
if($adrcd_subcd) {
|
||||
$adrparts = explode("-", $adrcd_subcd);
|
||||
$adrcd = $adrparts[0];
|
||||
}
|
||||
|
||||
$gem_kz = trim($csv[60]);
|
||||
$gem_name = trim($csv[59]);
|
||||
$plz_string = trim($csv[88]);
|
||||
$ort_name = trim($csv[31]);
|
||||
$strasse_hausnummer = trim($csv[22]);
|
||||
|
||||
$strasse_name = "";
|
||||
$hausnummer_name = "";
|
||||
|
||||
|
||||
if(!$strasse_hausnummer) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$m = [];
|
||||
if(preg_match('/^(.+)\s+(\d+[a-z0-9\/&#._-]*)(.+)?/i', $strasse_hausnummer, $m)) {
|
||||
$strasse_name = trim($m[1]);
|
||||
$hausnummer_name = trim($m[2]);
|
||||
if(array_key_exists(3, $m)) {
|
||||
$addresszusatz = trim($m[3]);
|
||||
}
|
||||
}
|
||||
|
||||
if($strasse_name == "Dr.Karl-Renner-Weg") $strasse_name = "Dr.-Karl-Renner-Weg";
|
||||
if($strasse_name == "Doktor-Karl-Renner-Weg") $strasse_name = "Dr.-Karl-Renner-Weg";
|
||||
|
||||
/*
|
||||
$adrcd = trim($csv[0]);
|
||||
$gem_kz = trim($csv[2]);
|
||||
$gem_name = trim($csv[3]);
|
||||
$ort_kz = trim($csv[5]);
|
||||
$plz_string = trim($csv[4]);
|
||||
$ort_name = trim($csv[6]);
|
||||
$skz = trim($csv[7]);
|
||||
$strasse_name = trim($csv[8]);
|
||||
$hausnummer_string = trim($csv[9]);
|
||||
$hausnummer_extref = trim($csv[0]);
|
||||
if(in_array($hausnummer_extref, $h_extrefs)) {
|
||||
die("Hausnummer extref doppelt! $hausnummer_extref\n");
|
||||
}
|
||||
$h_extrefs[] = $hausnummer_extref;
|
||||
*/
|
||||
//$lat = str_replace(",",".",trim($csv[7]));
|
||||
//$long = str_replace(",",".",trim($csv[8]));
|
||||
|
||||
|
||||
/*if(!$adrcd) {
|
||||
continue;
|
||||
}*/
|
||||
|
||||
if($adrcd && !is_numeric($adrcd)) {
|
||||
echo "Invalid adrcd ($adrcd)\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!$hausnummer_extref) {
|
||||
die("!!! Keine Hausnummer Extref\n");
|
||||
}
|
||||
|
||||
|
||||
if($hausnummer_extref == "25012262") {
|
||||
$unit_count = 45;
|
||||
}
|
||||
if($hausnummer_extref == "25012676") {
|
||||
continue;
|
||||
}
|
||||
|
||||
if($hausnummer_extref == "25012153" || $hausnummer_extref == "25012155" || $hausnummer_extref == "25012157") {
|
||||
continue;
|
||||
}
|
||||
if($hausnummer_extref == "25012159") {
|
||||
$unit_count = 61;
|
||||
}
|
||||
|
||||
if($hausnummer_extref == "25010649") {
|
||||
continue;
|
||||
}
|
||||
if($hausnummer_extref == "25010723" || $hausnummer_extref == "25010816") {
|
||||
continue;
|
||||
}
|
||||
|
||||
$existing_hausnummer = ADBHausnummerModel::getFirst(["extref" => $hausnummer_extref]);
|
||||
if($adrcd && !$existing_hausnummer) {
|
||||
$existing_hausnummer = ADBHausnummerModel::getFirst(["adrcd" => $adrcd]);
|
||||
}
|
||||
if(!$existing_hausnummer) {
|
||||
//echo "$hausnummer_extref not found $strasse_name $hausnummer_name\n";
|
||||
//continue;
|
||||
|
||||
// find hausnummer
|
||||
//echo "$strasse_name $hausnummer_name\n";
|
||||
|
||||
if($strasse_name == "Toepferring") $strasse_name = "Töpferring";
|
||||
if($strasse_name == "Foehrenweg") $strasse_name = "Föhrenweg";
|
||||
|
||||
$strasse_name = $db->escape($strasse_name);
|
||||
$hausnummer_name = $db->escape($hausnummer_name);
|
||||
|
||||
$strasse_search = [$strasse_name];
|
||||
|
||||
if(strpos($strasse_name, ' ') !== false) $strasse_search[] = str_replace(' ', '-', $strasse_name);
|
||||
if(strpos($strasse_name, '-') !== false) $strasse_search[] = str_replace('-', ' ', $strasse_name);
|
||||
if(strpos($strasse_name, '.') !== false) $strasse_search[] = str_replace('.', '. ', $strasse_name);
|
||||
if(strpos($strasse_name, '.') !== false) $strasse_search[] = str_replace('.', '.-', $strasse_name);
|
||||
if(strpos($strasse_name, '. ') !== false) $strasse_search[] = str_replace('. ', '.', $strasse_name);
|
||||
if(strpos($strasse_name, '. ') !== false) $strasse_search[] = str_replace('. ', '.-', $strasse_name);
|
||||
if(strpos($strasse_name, '.') !== false) $strasse_search[] = str_replace('.-', '.', $strasse_name);
|
||||
if(strpos($strasse_name, '.') !== false) $strasse_search[] = str_replace('.-', '. ', $strasse_name);
|
||||
|
||||
foreach($strasse_search as $search) {
|
||||
if(strpos($search, 'ß') !== false) $strasse_search[] = str_replace('ß', 'ss', $search);
|
||||
if(strpos($search, 'ä') !== false) $strasse_search[] = str_replace('ä', 'ae', $search);
|
||||
if(strpos($search, 'ö') !== false) $strasse_search[] = str_replace('ö', 'oe', $search);
|
||||
if(strpos($search, 'ü') !== false) $strasse_search[] = str_replace('ü', 'ue', $search);
|
||||
|
||||
if(strpos($search, 'ss') !== false) $strasse_search[] = str_replace('ss', 'ß', $search);
|
||||
if(strpos($search, 'ae') !== false) $strasse_search[] = str_replace('ae', 'ä', $search);
|
||||
if(strpos($search, 'oe') !== false) $strasse_search[] = str_replace('oe', 'ö', $search);
|
||||
if(strpos($search, 'ue') !== false) $strasse_search[] = str_replace('ue', 'ü', $search);
|
||||
}
|
||||
|
||||
|
||||
$sql = "SELECT * FROM view_hausnummer WHERE gemeinde_id = 1 AND strasse IN ('". implode("', '", $strasse_search)."') AND hausnummer='$hausnummer_name'";
|
||||
$res = $db->query($sql);
|
||||
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$existing_hausnummer = new ADBHausnummer($data->hausnummer_id);
|
||||
|
||||
if($existing_hausnummer->netzgebiet_id != $netzgebiet->id) {
|
||||
echo "Updating Netzgebiet from ".$existing_hausnummer->netzgebiet_id." to ".$netzgebiet->id."\n";
|
||||
}
|
||||
|
||||
$existing_hausnummer->netzgebiet_id = $netzgebiet->id;
|
||||
|
||||
if(!$existing_hausnummer->adrcd) {
|
||||
$existing_hausnummer->adrcd = $adrcd;
|
||||
}
|
||||
|
||||
$existing_hausnummer->extref = $hausnummer_extref;
|
||||
$existing_hausnummer->grund_nr = $grund_nr;
|
||||
$existing_hausnummer->gdaeigenschaft = $gdaeigenschaft;
|
||||
$existing_hausnummer->rimo_fcp_name = $fcp_name;
|
||||
if(!$existing_hausnummer->oaid) {
|
||||
$existing_hausnummer->oaid = $existing_hausnummer->getNewOAID();
|
||||
}
|
||||
$existing_hausnummer->save();
|
||||
$u++;
|
||||
|
||||
} else {
|
||||
echo "Address not found (straße: $strasse_name ($strasse_hausnummer), hausnummer: $hausnummer_name, adrcd: $adrcd, extref: $hausnummer_extref, unit_count: $unit_count)\n";
|
||||
|
||||
// create new adress
|
||||
|
||||
$gemeinde = ADBGemeindeModel::getFirst(['kennziffer' => $gem_kz]);
|
||||
if(!$gemeinde) {
|
||||
die("Gemeinde nicht gefunden\n");
|
||||
}
|
||||
|
||||
$ort = ADBOrtschaftModel::getFirst(['name' => $ort_name, "gemeinde_id" => $gemeinde->id]);
|
||||
if(!$ort) {
|
||||
die("Ort $ort_name nicht gefunden\n");
|
||||
}
|
||||
|
||||
$plz = ADBPlzModel::getFirst(['plz' => $plz_string, 'gemeinde_id' => $gemeinde->id]);
|
||||
if(!$plz) {
|
||||
die("PLZ nicht gefunden");
|
||||
}
|
||||
|
||||
$strasse = ADBStrasseModel::getFirst(['gemeinde_id' => $gemeinde->id, 'name' => $strasse_name]);
|
||||
if(!$strasse) {
|
||||
if(preg_match('/^(GST\s|L\d+\s)/', $strasse_hausnummer)) {
|
||||
continue;
|
||||
}
|
||||
die("Strase nicht gefunden\n");
|
||||
}
|
||||
|
||||
$hausnummer_data = [
|
||||
"netzgebiet_id" => $netzgebiet->id,
|
||||
"extref" => $hausnummer_extref,
|
||||
"ortschaft_id" => $ort->id,
|
||||
"plz_id" => $plz->id,
|
||||
"strasse_id" => $strasse->id,
|
||||
"hausnummer" => $hausnummer_name,
|
||||
"zusatz" => ($addresszusatz) ? : null,
|
||||
"gps_lat" => $lat,
|
||||
"gps_long" => $long,
|
||||
"grund_nr" => $grund_nr,
|
||||
"gdaeigenschaft" => $gdaeigenschaft,
|
||||
"rimo_fcp_name" => $fcp_name,
|
||||
"freigabe" => $freigabe_default,
|
||||
];
|
||||
$existing_hausnummer = ADBHausnummerModel::create($hausnummer_data);
|
||||
if(!$existing_hausnummer->oaid) {
|
||||
$existing_hausnummer->oaid = $existing_hausnummer->getNewOAID();
|
||||
}
|
||||
$existing_hausnummer->save();
|
||||
$c++;
|
||||
}
|
||||
} else {
|
||||
// found hausnummer
|
||||
if($existing_hausnummer->netzgebiet_id != $netzgebiet->id) {
|
||||
echo "Updating Netzgebiet from ".$existing_hausnummer->netzgebiet_id." to ".$netzgebiet->id."\n";
|
||||
}
|
||||
$existing_hausnummer->netzgebiet_id = $netzgebiet->id;
|
||||
if(!$existing_hausnummer->adrcd) {
|
||||
$existing_hausnummer->adrcd = $adrcd;
|
||||
}
|
||||
|
||||
$existing_hausnummer->extref = $hausnummer_extref;
|
||||
$existing_hausnummer->grund_nr = $grund_nr;
|
||||
$existing_hausnummer->gdaeigenschaft = $gdaeigenschaft;
|
||||
$existing_hausnummer->rimo_fcp_name = $fcp_name;
|
||||
if(!$existing_hausnummer->oaid) {
|
||||
$existing_hausnummer->oaid = $existing_hausnummer->getNewOAID();
|
||||
}
|
||||
$existing_hausnummer->save();
|
||||
$u++;
|
||||
}
|
||||
//continue;
|
||||
|
||||
// add new units
|
||||
$existing_units_count = ADBWohneinheitModel::count(['hausnummer_id' => $existing_hausnummer->id]);
|
||||
if($existing_units_count != $unit_count) {
|
||||
/*if(($existing_units_count - $unit_count) > 1) {
|
||||
echo "========================================================================\n";
|
||||
echo "=============== [".$existing_hausnummer->id."] Need to delete ".($existing_units_count - $unit_count)." units\n";
|
||||
echo "========================================================================\n";
|
||||
}*/
|
||||
if($existing_units_count < $unit_count) {
|
||||
echo "=============== Adding ".($unit_count - $existing_units_count)." units\n";
|
||||
|
||||
$new_units_count = $unit_count - $existing_units_count;
|
||||
$last_unit_num = 0;
|
||||
|
||||
|
||||
foreach(ADBWohneinheitModel::search(['hausnummer_id' => $existing_hausnummer->id]) as $tmp_unit) {
|
||||
if($tmp_unit->num > $last_unit_num) {
|
||||
$last_unit_num = $tmp_unit->num;
|
||||
}
|
||||
}
|
||||
|
||||
// create wohneinheiten
|
||||
for($i = 1; $i <= $new_units_count; $i++) {
|
||||
$num = $last_unit_num + $i;
|
||||
//echo "$existing_units_count create wohneinheit $num\n";
|
||||
$unit_data = [
|
||||
'hausnummer_id' => $existing_hausnummer->id,
|
||||
'num' => $num,
|
||||
];
|
||||
$wohneinheit = ADBWohneinheitModel::create($unit_data);
|
||||
$wohneinheit_id = $wohneinheit->save();
|
||||
if(!$wohneinheit_id) {
|
||||
die("Cannot save Wohneinheit\n");
|
||||
}
|
||||
$wohneinheit->oaid = $wohneinheit->getNewOAID();
|
||||
if(!$wohneinheit->oaid) {
|
||||
die("Error generating OAID for wohneinheit ".$wohneinheit->id);
|
||||
}
|
||||
//var_dump($wohneinheit);
|
||||
$wohneinheit->save();
|
||||
$w++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//echo "$hausnummer_extref: $adrcd, $netzgebiet_extref, $grund_nr, $unit_count, $gdaeigenschaft\n";
|
||||
}
|
||||
|
||||
echo "$c Buildings created, $u Buildings updated, $w Wohneinheiten angelegt\n";
|
||||
@@ -12,7 +12,6 @@ require_once(LIBDIR."/mvcfronk/mfBase/mfBaseModel.php");
|
||||
require_once(LIBDIR."/mvcfronk/mfBase/mfBaseController.php");
|
||||
|
||||
|
||||
$netzgebiet_name_main = "Liezen";
|
||||
$freigabe_default = json_encode(["interest", "provision", "order", "reorder"]);
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
0
scripts/send_preordernotifications.php
Normal file → Executable file
0
scripts/send_preordernotifications.php
Normal file → Executable file
Reference in New Issue
Block a user