This commit is contained in:
Frank Schubert
2024-11-07 16:28:05 +01:00
parent bb02b67696
commit 6c0d334bbc
33 changed files with 172284 additions and 30 deletions

View File

@@ -0,0 +1,81 @@
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?>
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="<?=self::getUrl("Dashboard")?>"><?=MFAPPNAME_SLUG?></a></li>
<li class="breadcrumb-item"><a href="<?=self::getUrl("AddressDB")?>">AddressDB</a></li>
<li class="breadcrumb-item active">Statusupdateimport</li>
</ol>
</div>
<h4 class="page-title">Statusupdates importieren</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-12">
<div class="card bg-light">
<div class="card-body">
<div class="alert alert-info">
<p>
<strong>Werden Statusflags importiert, muss die Überschrift im CSV-File vorhanden sein!</strong><br />
Statusflags können in beliebiger Reihenfolge angegeben werden, die Positionen müssen aber in Kopfzeile und Datenzeilen übereinstimmen.<br/>
Nur zu ändernde Statusflags müssen angeführt werden.<br/>
Statusflags können 1 (=gesetzt), 0 (=nicht gesetzt) oder leer sein. Ist das Feld leer, wird der Wert des Flags nicht verändert.
</p>
</div>
<h4 class="header-title mb-2">Statusupdates importieren</h4>
<form class="form-horizontal" method="post" action="<?=self::getUrl("Preorder", "saveStatusupdateimport")?>" enctype="multipart/form-data">
<div class="card">
<div class="card-body">
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="statusupdate_csv">Statusupdate CSV</label>
<div class="col-lg-10">
<input type="file" class="form-control" name="statusupdate_csv" />
<small>
Format: <span class="text-monospace">addressdb_id;Neuer Status Code;[flag;...]</span><br />
Beispiel:<br />
<span class="text-monospace">
addressdb_id;new_code;141;145;150;200;242<br />
1788231;200;1;0;;;
</span>
</small>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label"></label>
<div class="col-lg-10">
<label>
<input type="checkbox" value="1" name="headline" />
Erste Zeile enthält Überschrift
</label>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2"></label>
<div class="col-lg-10">
<button type="submit" class="btn btn-primary">Importieren</button>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>

View File

@@ -0,0 +1,107 @@
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a></li>
<li class="breadcrumb-item"><a href="<?= self::getUrl("Preordercampaign") ?>">Zustimmungserklärungen</a></li>
<li class="breadcrumb-item active"><?= ($Action == "add") ? "neu" : "bearbeiten" ?></li>
</ol>
</div>
<h4 class="page-title">Zustimmungserklärung</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-12">
<div class="card bg-light">
<div class="card-body">
<h4 class="header-title mb-2">
<?= ($Action == "add") ? "Neue " : "" ?>Zustimmungserklärung <?= ($Action == "edit") ? "bearbeiten " : "" ?>
</h4>
<form class="form-horizontal" method="post" action="<?= self::getUrl("Preordercampaign", "save") ?>">
<input type="hidden" name="id" value="<?=isset($item) ? $item->id : ""?>"/>
<div class="card">
<div class="card-body">
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="object_type">Objekttyp *</label>
<div class="col-lg-10">
<select class="form-control" name="object_type" id="object_type">
<option value="building" <?=($item->object_type == "building" ? "selected='selected'" : "")?>>Gebäude</option>
<option value="street" <?=($item->object_type == "street" ? "selected='selected'" : "")?>>Straße</option>
</select>
</div>
</div>
<div id="building-search">
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="adb_hausnummer_id">Adresse/GST *</label>
<div class="col-lg-10">
<select class="form-control" name="adb_hausnummer_id" id="adb_hausnummer_id">
<?php if($item->adb_hausnummer_id): ?>
<option value="<?=$item->adb_hausnummer_id?>" selected="selected"><?=$item->adb_hausnummer->plz->plz?> <?=$item->adb_hausnummer->strasse->ortschaft->name?>, <?=$item->adb_hausnummer->strasse->name?> <?=$item->adb_hausnummer->hausnummer?></option>
<?php endif; ?>
</select>
</div>
</div>
</div>
<div id="street-search">
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="adb_strasse_id">Straße *</label>
<div class="col-lg-10">
<select class="form-control" name="adb_strasse_id" id="adb_strasse_id">
<?php if($item->adb_strasse_id): ?>
<option value="<?=$item->adb_strasse_id?>" selected="selected"><?=$item->adb_strasse->gemeinde->name?>, <?=$item->adb_strasse->name?></option>
<?php endif; ?>
</select>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="ez">Grundbuch Einlagezahl</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="ez" id="ez" value="<?=$item->ez?>" />
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<script>
$('#adb_hausnummer_id').select2({
ajax: {
url: '<?=self::getUrl("AddressDB", "api", ["do" => "findAddress", "include_gst" => 1])?>',
delay: 250,
dataType: 'json'
},
minimumInputLength: 3,
placeholder: "Suche nach Straße / Hausnummer / Ort / Grundstücksnummer",
allowClear: true
});
$('#adb_hausnummer_id').on('select2:close', function(e) {
if(!$('#adb_hausnummer_id').val()) {
$('#new-address-toggle').show();
}
});
</script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>

View File

@@ -0,0 +1,153 @@
<?php
$pagination_baseurl = $this->getUrl($Mod,"Index");
$pagination_baseurl_params = ["filter" => $filter];
$pagination_entity_name = "Zustimmungserklärungen";
?>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?>
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="<?=self::getUrl("Dashboard")?>"><?=MFAPPNAME_SLUG?></a></li>
<li class="breadcrumb-item active">Zustimmmungserklärungen</li>
</ol>
</div>
<h4 class="page-title">Zustimmmungserklärungen</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body mb-3">
<h4 class="header-title mb-3"><i class="fad fa-filter fa-fw"></i> Filter</h4>
<form method="get" action="<?=self::getUrl("ConstructionConsent")?>">
<div class="row">
<div class="col-2">
<label class="form-label" for="filter_object_type">Objektart</label>
<select name="filter[object_type]" id="filter_object_type" class="form-control">
<option></option>
<option value="building" <?=(array_key_exists("object_type", $filter) && $filter["object_type"] == "building") ? "selected='selected'" : ""?>>Gebäude</option>
<option value="street" <?=(array_key_exists("object_type", $filter) && $filter["object_type"] == "street") ? "selected='selected'" : ""?>>Straße</option>
</select>
</div>
<div class="col-1">
<label class="form-label" for="filter_address">Objektadresse</label>
<input type="text" class="form-control" name="filter[address]" id="filter_address" value="<?=(array_key_exists('address', $filter)) ? $filter['address'] : ""?>" />
</div>
</div>
<div class="row mt-2">
<div class="col">
<button type="submit" class="btn btn-primary"><i class="far fa-search fa-fw"></i> Filter anwenden</button>
<a class="btn btn-secondary" href="<?=self::getUrl("ConstructionConsent", "", ["resetFilter" => 1])?>"><i class="far fa-xmark fa-fw"></i> Filter zurücksetzen</a>
</div>
</div>
</form>
</div>
</div>
<div class="card">
<div class="card-body mb-3">
<div class="row">
<div class="col-12">
<div class="float-left">
<h4 class="header-title">Liste aller Zustimmmungserklärungen</h4>
</div>
<div class="float-right">
<a class="btn btn-primary" href="<?=self::getUrl("ConstructionConsent", "add")?>"><i class="fas fa-plus"></i> Neue Zustimmungserklärung anlegen</a>
</div>
</div>
</div>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
<table class="table table-striped table-hover">
<tr>
<th>Objekttyp</th>
<th>Objektadresse</th>
<th title="Grundstücksnummer">GST-Nr.</th>
<th title="Grundbuch Einlagezahl">EZ</th>
<th>Besitzer</th>
<th>Besitzer Adresse</th>
<th>Besitzer Kontakt</th>
<th>Anfragestatus</th>
<th>Anfrageresultat</th>
<th></th>
</tr>
<?php foreach($items as $item): ?>
<tr>
<td><?=__($item->object_type)?></td>
<td>
<?php if($item->object_type == "street"): ?>
<?=$item->adb_strasse->name?>
<?=$item->adb_strasse->gemeinde->name?>
<?php else: ?>
<?=$item->adb_hausnummer->strasse->name?>
<?=$item->adb_hausnummer->hausnummer?><?=($item->adb_hausnummer->stiege) ? "/".$item->adb_hausnummer->stiege : ""?><br />
<?=$item->adb_hausnummer->plz->plz?>
<?=$item->adb_hausnummer->ortschaft->name?><br />
<?=$item->adb_hausnummer->strasse->gemeinde->name?>
<?php endif; ?>
</td>
<td><?=$item->adb_hausnummer->grund_nr?></td>
<td><?=$item->ez?></td>
<td><?=$item->owner_name?></td>
<td>
<?=$item->owner_street?><br />
<?=$item->owner_zip?> <?=$item->owner_city?><br />
</td>
<td>
<?php if($item->phone): ?>
Tel: <?=$item->phone?><br />
<?php endif; ?>
<?php if($item->fax): ?>
Fax: <?=$item->fax?><br />
<?php endif; ?>
<?php if($item->email): ?>
Email: <?=$item->email?>
<?php endif; ?>
</td>
<td><?=$item->status?></td>
<td><?=$item->result?></td>
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
<a href="<?=self::getUrl("ConstructionConsent", "view", ["id" => $item->id])?>"><i class="far fa-eyes" title="Anzeigen"></i></a>
<?php if(!$item->result): ?>
<a href="<?=self::getUrl("ConstructionConsent", "edit", ["id" => $item->id])?>"><i class="far fa-edit" title="Bearbeiten"></i></a>
<?php if($item->status == "new"): ?>
<a href="<?=self::getUrl("ConstructionConsent", "delete", ["id" => $item->id])?>" onclick="if(!confirm('Zustimmungserklärung wirklich löschen?')) return false;" class="text-danger" title="Löschen"><i class="fas fa-trash"></i></a>
<?php endif; ?>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
</div>
</div>
</div>
</div>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>

View File

@@ -725,14 +725,16 @@
if(trenches) {
trenches.forEach((trench) => {
var trench_line = L.polyline(trench, {
color: "limegreen"
color: "maroon",
weight: 7
}).addTo(map);
});
}
if(home_trench) {
var home_line = L.polyline(home_trench, {
color: "aqua"
color: "blue",
weight: 7
}).addTo(map);
}
@@ -936,5 +938,39 @@
return false;
}
function downloadWorkorderAh(workorder_id) {
if(!workorder_id) return false;
var filename;
fetch('<?=self::getUrl("RimoWorkorder", "downloadAh")?>')
.then(resp => {
const header = resp.headers.get("Content-disposition");
let matches = header.match(/filename=['"]?([^'"]+)/i);
filename = matches[1];
if(!filename) {
window.notify("error", "Fehler beim Download des AH-Blatts");
return false;
}
resp.blob()
})
.then(blob => {
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.style.display = 'none';
a.href = url;
// the filename you want
a.download = filename;
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
window.notify("success", "Download gestartet...");
//alert('your file has downloaded!'); // or you know, something with better UX...
})
.catch(() => window.notify("Fehler beim Download des AH-Blatts"));
}
</script>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>

View File

@@ -397,9 +397,12 @@
<div class="col-6">
<h3>Workorder</h3>
<?php if(is_array($preorder->adb_wohneinheit->rimo_workorders) && count($preorder->adb_wohneinheit->rimo_workorders)): ?>
<?php if($preorder->adb_wohneinheit_id && is_array($preorder->adb_wohneinheit->rimo_workorders) && count($preorder->adb_wohneinheit->rimo_workorders)): ?>
<?php foreach($preorder->adb_wohneinheit->rimo_workorders as $wo): ?>
<h4><?=$wo->rimo_name?></h4>
<h4>
<?=$wo->rimo_name?>
<a href="<?=self::getUrl("RimoWorkorder", "downloadAh", ["id" => $wo->id])?>" onclick="event.preventDefault(); downloadWorkorderAh(<?=$wo->id?>);"><i class="fas fa-fw fa-file-download ml-2"></i> AH Blatt</a>
</h4>
<small id="preorder-detail-<?=$preorder->id?>-workorder-<?=$wo->id?>-del"><a href="#" onclick="if(confirm('Achtung: Löscht die Workorder in thetool, aber NICHT in RIMO!')) return deleteWorkorder(<?=$preorder->id?>, <?=$wo->id?>)" class="text-danger"><i class="far fa-times-circle"></i> Workorder löschen</a></small>
<table class="table table-sm table-striped" id="preorder-detail-<?=$preorder->id?>-workorder-<?=$wo->id?>">
<tr>

View File

@@ -109,8 +109,8 @@
<th></th>
<th>Netzgebiete</th>
<th>Name</th>
<th>Gebiet</th>
<th>Vorbestellungen</th>
<th>Workorders</th>
<th>Start</th>
<th>Ende</th>
<th></th>
@@ -130,16 +130,63 @@
</td>
<td><?=$camp->network->name?></td>
<td><?=$camp->name?></td>
<td><?=$camp->area?></td>
<td>
<a href="<?=self::getUrl("Preorder", "Index", ["filter" => ["preordercampaign_id" => $camp->id]])?>">
<?=$camp->active_preorder_count?>
<?php if($camp->homes_total): // manual value ?>
/ <?=$camp->homes_total?> (<?=(round(($camp->active_preorder_count / $camp->homes_total) * 100, 2))?> %)
<?php elseif($camp->total_homes): // automatic value from AdressDB ?>
/ <?=$camp->total_homes?> (<?=(round(($camp->active_preorder_count / $camp->total_homes) * 100, 2))?> %)
<div class="row">
<div class="col-1 text-right" style="font-size: 1.5em" title="Bestellungen anzeigen">
<a href="<?=self::getUrl("Preorder", "Index", ["filter" => ["preordercampaign_id" => $camp->id]])?>"><i class="fas fa-list-alt"></i></a>
</div>
<div class="col">
<table class="table-sm table-borderless">
<tr class="bg-transparent" style="line-height: .6em;">
<?php if($camp->total_homes_sd): // automatic value from AdressDB ?>
<td class="text-right">EFH:</td>
<td class="text-right"><?=$camp->active_preorder_count_sd?> /</td>
<td class="text-right"><?=$camp->total_homes_sd?></td>
<td>(<?=(round(($camp->active_preorder_count_sd / $camp->total_homes_sd) * 100, 2))?> %)</td>
<?php endif; ?>
</a>
</tr>
<tr class="bg-transparent" style="line-height: .6em;">
<?php if($camp->total_homes_md): // automatic value from AdressdB ?>
<td class="text-right">MPH:</td>
<td class="text-right"><?=$camp->active_preorder_count_md?> /</td>
<td class="text-right"><?=$camp->total_homes_md?></td>
<td>(<?=(round(($camp->active_preorder_count_md / $camp->total_homes_md) * 100, 2))?> %)</td>
<?php endif; ?>
</tr>
<tr class="bg-transparent" style="line-height: .6em;">
<td class="text-right">Gesamt:</td>
<td class="text-right"><?=$camp->active_preorder_count?> /</td>
<td class="text-right">
<?php if($camp->homes_total): // manual value ?>
<?=$camp->homes_total?>
<?php elseif($camp->total_homes): // automatic value from AdressDB ?>
<?=$camp->total_homes?>
<?php endif; ?>
</td>
<td>
<?php if($camp->homes_total): // manual value ?>
(<?=(round(($camp->active_preorder_count / $camp->homes_total) * 100, 2))?> %)
<?php elseif($camp->total_homes): // automatic value from AdressDB ?>
(<?=(round(($camp->active_preorder_count / $camp->total_homes) * 100, 2))?> %)
<?php endif; ?>
</td>
</tr>
</table>
</div>
</div>
</td>
<td>
<?php if($camp->workorder_count): ?>
<?=$camp->workorder_count?>
<?php else: ?>
0
<?php endif; ?>
/ <?=$camp->active_preorder_count?>
</td>
<td><?=date('d.m.Y',$camp->from)?></td>
<td><?=date('d.m.Y',$camp->to)?></td>

View File

@@ -10,6 +10,7 @@
<link rel="shortcut icon" href="<?=self::getResourcePath()?>assets/images/favicon.ico">
<!-- App css -->
<link href="<?=self::getResourcePath()?>css/fonts.css?<?=$git_merge_ts?>" rel="stylesheet" type="text/css" />
<link href="<?=self::getResourcePath()?>fontawesome/css/all.min.css?<?=$git_merge_ts?>" rel="stylesheet" type="text/css" />
<link href="<?=self::getResourcePath()?>fontawesome/css/sharp-solid.css?<?=$git_merge_ts?>" rel="stylesheet" type="text/css" />
<link href="<?=self::getResourcePath()?>fontawesome/css/sharp-regular.css?<?=$git_merge_ts?>" rel="stylesheet" type="text/css" />

View File

@@ -107,10 +107,11 @@
</a>
<ul class="submenu">
<?php if($me->is(["Admin","netowner","pipeplanner"]) && $me->can("Building")): ?><li><a href="<?=self::getUrl("Building")?>"><i class="fas fa-fw fa-city text-info"></i> Objekte & Anschlüsse</a></li><?php endif; ?>
<?php if($me->is(["Admin"])): ?><li class="has-sub-submenu"><a href="<?=self::getUrl("ConstructionConsent")?>"><i class="far fa-fw fa-file-signature text-info"></i> Zustimmungserklärungen</a></li><?php endif; ?>
<?php if($me->is(["Admin","netowner","pipeplanner","pipeworker","lineplanner","lineworker"]) && $me->can("Pipework")): ?><li><a href="<?=self::getUrl("Pipework")?>"><i class="fad fa-fw fa-wrench text-info"></i> Tiefbau</a></li><?php endif; ?>
<?php if($me->is(["Admin","netowner","lineplanner","lineworker"]) && $me->can("Linework")): ?><li><a href="<?=self::getUrl("Linework")?>"><i class="fas fa-fw fa-ethernet text-info"></i> Leitungsbau</a></li><?php endif; ?>
<?php if($me->is(["Admin","netowner","netoperator","lineworker"]) && $me->can("Patching")): ?><li class="has-sub-submenu"><a href="<?=self::getUrl("Patching")?>"><i class="fas fa-fw fa-plug text-info"></i> Patchungen</a></li><?php endif; ?>
<?php if($me->is(["Admin","netowner","pipeplanner","lineplanner","pipeworker","netoperator","lineworker"]) && $me->can("Filestore")): ?><li><a href="<?=self::getUrl("Filestore")?>"><i class="fas fa-fw fa-file text-info"></i> Dateiablage</a></li><?php endif; ?>
<?php if($me->is(["Admin","netowner","pipeplanner","lineplanner","pipeworker","netoperator","lineworker"]) && $me->can("Filestore")): ?><li class="has-sub-submenu"><a href="<?=self::getUrl("Filestore")?>"><i class="fas fa-fw fa-file text-info"></i> Dateiablage</a></li><?php endif; ?>
<?php if($me->is(["Admin","netowner","pipeplanner","pipeplanner"]) && $me->is("employee")): ?><li><a href="<?=self::getUrl("FiberPlanDispatcher")?>"><i class="fas fa-building-circle-arrow-right text-info"></i> Verteiler und Schächte</a></li><?php endif; ?>
<?php if($me->is(["Admin","netowner","lineplanner","lineworker"]) && $me->is("employee")): ?><li><a href="<?=self::getUrl("FiberPlanPipe")?>"><i class="fas fa-pipe text-info pl-1"></i> Rohrverzeichnis</a></li><?php endif; ?>
<?php if($me->is(["Admin","netowner","lineplanner","lineworker"]) && $me->is("employee")): ?><li><a href="<?=self::getUrl("FiberPlanCable")?>"><i class="fa-solid fa-timeline text-info "></i> Kabelverzeichnis</a></li><?php endif; ?>

View File

@@ -248,10 +248,10 @@ class ADBWohneinheit extends mfBaseModel {
}
if($name == "rimo_workorders") {
$this->rimo_workorders = RimoWorkorderModel::search(["adb_wohneinheit_id" => $this->id]);
/*if(count($workorders)) {
$this->rimo_workorders = $workorders;
}*/
$rimo_workorders = RimoWorkorderModel::search(["adb_wohneinheit_id" => $this->id]);
if(count($rimo_workorders)) {
$this->rimo_workorders = $rimo_workorders;
}
return $this->rimo_workorders;
}

View File

@@ -164,7 +164,9 @@ class BillingModel {
$sql = "SELECT * FROM Billing
WHERE $where
ORDER BY billingaddress_id LIMIT 1";
//var_dump($sql);exit;
mfLoghandler::singleton()->debug($sql);
$res = $db->query($sql);
if($db->num_rows($res)) {
$data = $db->fetch_object($res);
@@ -186,6 +188,8 @@ class BillingModel {
WHERE $where
ORDER BY `create` DESC LIMIT 1";
//var_dump($sql);exit;
mfLoghandler::singleton()->debug($sql);
$res = $db->query($sql);
if($db->num_rows($res)) {
$data = $db->fetch_object($res);

View File

@@ -0,0 +1,259 @@
<?php
class ConstructionConsent extends mfBaseModel {
private $termnination;
private $adb_hausnummer;
private $adb_strasse;
public function getProperty($name) {
if($this->$name == null) {
if($name == "adb_hausnummer") {
if(!$this->adb_hausnummer_id) return null;
$hausnummer = new ADBHausnummer($this->adb_hausnummer_id);
if($hausnummer->id) {
$this->adb_hausnummer = $hausnummer;
}
return $this->adb_hausnummer;
}
if($name == "adb_strasse") {
if(!$this->adb_strasse_id) return null;
$strasse = new ADBStrasse($this->adb_strasse_id);
if($strasse->id) {
$this->adb_strasse = $strasse;
}
return $this->adb_strasse;
}
$classname = ucfirst($name);
$idfield = $name."_id";
$this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-".$this->$idfield);
if(!$this->$name) {
$this->$name = new $classname($this->$idfield);
}
if($this->$name->id) {
mfValuecache::singleton()->set("mfObjectmodel-$name-".$this->$name->id, $this->$name);
return $this->$name;
} else {
return null;
}
}
return $this->$name;
}
/********************************
* Begin static Model functions
*/
public static function create(Array $data) {
$model = new ConstructionConsent();
$table_fields = [
"termination_id","adb_wohneinheit_id","object_type","ez","owner_name","owner_street","owner_zip","owner_city",
"owner_country","status","result","create_by","edit_by","create","edit"
];
foreach($data as $field => $value) {
if(in_array($field, $table_fields)) {
$model->$field = $value;
}
}
$me = new User();
$me->loadMe();
if($model->create_by === null) {
$model->create_by = $me->id;
}
if($model->edit_by === null) {
$model->edit_by = $me->id;
}
return $model;
}
public static function getAll() {
$items = [];
$db = FronkDB::singleton();
$res = $db->select("ConstructionConsent", "*", "1 = 1 ORDER BY adb_hausnummer_id");
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[] = new ConstructionConsent($data);
}
}
return $items;
}
public static function getFirst($filter) {
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$sql = "SELECT * FROM ConstructionConsent
WHERE $where
ORDER BY adb_hausnummer_id LIMIT 1";
//var_dump($sql);exit;
$res = $db->query($sql);
if($db->num_rows($res)) {
$data = $db->fetch_object($res);
$item = new ConstructionConsent($data);
if($item->id) {
return $item;
} else {
return null;
}
}
return null;
}
public static function count($filter) {
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$sql = "SELECT COUNT(*) as cnt FROM ConstructionConsent
WHERE $where";
//mfLoghandler::singleton()->debug($sql);
$res = $db->query($sql);
if($db->num_rows($res)) {
$data = $db->fetch_object($res);
return $data->cnt;
}
return 0;
}
public static function search($filter, $limit = false, $order = false) {
//var_dump($filter);exit;
$items = [];
if(!$order) {
$order = "adb_hausnummer_id ASC";
}
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$sql = "SELECT * FROM ConstructionConsent
WHERE $where
ORDER BY $order";
if(is_array($limit) && count($limit)) {
if(is_numeric($limit['start']) && is_numeric($limit['count'])) {
$sql .= " LIMIT ".$limit['start'].", ".$limit['count'];
} elseif(is_numeric($limit['count'])) {
$sql .= " LIMIT ".$limit['count'];
}
}
mfLoghandler::singleton()->debug($sql);
$res = $db->query($sql);
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[$data->id] = new ConstructionConsent($data);
}
}
return $items;
}
private static function getSqlFilter($filter) {
$where = "1=1 ";
if(array_key_exists("adb_wohneinheit_id", $filter)) {
$adb_wohneinheit_id = $filter['adb_wohneinheit_id'];
if(is_numeric($adb_wohneinheit_id)) {
$where .= " AND ConstructionConsent.adb_wohneinheit_id=$adb_wohneinheit_id";
}
}
if(array_key_exists("termination_id", $filter)) {
$termination_id = $filter['termination_id'];
if(is_numeric($termination_id)) {
$where .= " AND ConstructionConsent.termination_id=$termination_id";
}
}
if(array_key_exists("object_type", $filter)) {
$object_type = FronkDB::singleton()->escape($filter["object_type"]);
if($object_type) {
$where .= " AND object_type='$object_type'";
}
}
if(array_key_exists("ez", $filter)) {
$ez = FronkDB::singleton()->escape($filter["ez"]);
if($ez) {
$where .= " AND ez='$ez'";
}
}
if(array_key_exists("status", $filter)) {
$status = FronkDB::singleton()->escape($filter["status"]);
if($status) {
$where .= " AND status='$status'";
}
}
if(array_key_exists("result", $filter)) {
$result = FronkDB::singleton()->escape($filter["result"]);
if($result) {
$where .= " AND result='$result'";
}
}
if(array_key_exists("owner_name", $filter)) {
$owner_name = FronkDB::singleton()->escape($filter["owner_name"]);
if($owner_name) {
$where .= " AND owner_name like '%$owner_name%'";
}
}
if(array_key_exists("owner_street", $filter)) {
$owner_street = FronkDB::singleton()->escape($filter["owner_street"]);
if($owner_street) {
$where .= " AND owner_street like '%$owner_street%'";
}
}
if(array_key_exists("owner_zip", $filter)) {
$owner_zip = FronkDB::singleton()->escape($filter["owner_zip"]);
if($owner_zip) {
$where .= " AND owner_zip like '%$owner_zip%'";
}
}
if(array_key_exists("owner_city", $filter)) {
$owner_city = FronkDB::singleton()->escape($filter["owner_city"]);
if($owner_city) {
$where .= " AND owner_city like '%$owner_city%'";
}
}
if(array_key_exists("owner_country", $filter)) {
$owner_country = FronkDB::singleton()->escape($filter["owner_country"]);
if($owner_country) {
$where .= " AND owner_country like '%$owner_country%'";
}
}
if(array_key_exists("add-where", $filter)) {
$where .= " ".$filter['add-where'];
}
//var_dump($filter, $where);exit;
return $where;
}
}

View File

@@ -0,0 +1,91 @@
<?php
class ConstructionConsentController extends mfBaseController {
protected function init() : void
{
$this->needlogin = true;
$me = new User();
$me->loadMe();
$this->me = $me;
$this->layout()->set("me", $me);
if (!$me->is(["Admin"])) {
$this->redirect("Dashboard");
}
}
protected function indexAction() : void {
$this->layout()->setTemplate("ConstructionConsent/Index");
if ($this->request->resetFilter) {
unset($_SESSION[MFAPPNAME . '-ConstructionConsent-filter']);
$this->redirect("ConstructionConsent");
}
$filter = [];
if (is_array($this->request->filter)) {
$filter = $this->request->filter;
$_SESSION[MFAPPNAME . '-ConstructionConsent-filter'] = $filter;
} else {
if (array_key_exists(MFAPPNAME . '-ConstructionConsent-filter', $_SESSION) && count($_SESSION[MFAPPNAME . '-ConstructionConsent-filter'])) {
$filter = $_SESSION[MFAPPNAME . '-ConstructionConsent-filter'];
}
}
$this->layout->set("filter", $filter);
$filter = $this->getPreparedFilter($filter);
// pagination defaults
$pagination = [];
$pagination['start'] = 0;
$pagination['count'] = 20;
$pagination['maxItems'] = 0;
if (is_numeric($this->request->s)) {
$pagination['start'] = intval($this->request->s);
}
//var_dump($filter);exit;
$pagination['maxItems'] = ConstructionConsent::count($filter);
$this->layout()->set("pagination", $pagination);
$items = ConstructionConsent::search($filter);
$this->layout->set("items", $items);
}
private function getPreparedFilter($filter) : array
{
$new_filter = [];
if (is_array($filter) && count($filter)) {
foreach ($filter as $name => $value) {
$new_filter[$name] = $value;
}
}
return $new_filter;
}
protected function addAction() : void {
$this->layout()->setTemplate("ConstructionConsent/Form");
}
protected function editAction() : void {
$id = $this->request->id;
if(!is_numeric($id) || $id < 1) {
$this->layout()->setFlash("Zustimmungserklärung nicht gefunden", "error");
$this->redirect("ConstructionConsent");
}
$item = new ConstructionConsent($id);
if(!$item || !$item->id) {
$this->layout()->setFlash("Zustimmungserklärung nicht gefunden", "error");
$this->redirect("ConstructionConsent");
}
$this->layout()->set("item", $item);
$this->addAction();
}
}

View File

@@ -25,6 +25,13 @@ class RimoWorkorder extends mfBaseModel {
}
}
public function downloadAh() {
if(!$this->id) return false;
$ah = Rimoapi::getWorkorderAhReport();
}
public function getProperty($name) {
if($this->$name == null) {

View File

@@ -0,0 +1,43 @@
<?php
class RimoWorkorderController extends mfBaseController {
protected function init() {
$this->needlogin=true;
$me = new User();
$me->loadMe();
$this->me = $me;
$this->layout()->set("me",$me);
}
protected function downloadAhAction() {
$workorder_id = $this->request->id;
if(!$workorder_id || $workorder_id < 1) {
header("HTTP/1.1 400 Bad Request");
echo "Invalid workorder id.";
exit;
}
$workorder = new RimoWorkorder($workorder_id);
if(!$workorder->id) {
header("HTTP/1.1 404 Not Found");
echo "Workorder nicht gefunden.";
exit;
}
$return = $workorder->downloadAh();
if($return === false) {
header("HTTP/1.1 500 Not Found");
echo "Fehler beim Herunterladen des AH-Blatts aus Rimo.";
exit;
}
header("Content-type: text/pdf");
header("Content-disposition: attachment; filename=".$workorder->name."_AHA.pdf");
echo $return;
exit;
}
}

View File

@@ -119,14 +119,14 @@ class RimoWorkorderModel {
if(is_array($limit) && count($limit)) {
if(is_numeric($limit['start']) && is_numeric($limit['count'])) {
$sql .= " LIMIT ".$limit['start'].", ".$limit['count'];
} elseif(is_numeric($count)) {
} elseif(is_numeric($limit['count'])) {
$sql .= " LIMIT ".$limit['count'];
}
}
$res = $db->query($sql);
//mfLoghandler::singleton()->debug($sql);
mfLoghandler::singleton()->debug($sql);
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {

View File

@@ -4,6 +4,7 @@
"robmorgan/phinx": "^0.13.4",
"textalk/websocket": "^1.6",
"chillerlan/php-qrcode": "^4",
"phpseclib/phpseclib": "^3.0"
"phpseclib/phpseclib": "^3.0",
"stomp-php/stomp-php": "^5"
}
}

View File

@@ -0,0 +1,52 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class CreateConstructionConsent extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table("ConstructionConsent");
$table->addColumn("termination_id", "integer", ["null" => false]);
$table->addColumn("adb_hausnummer_id", "integer", ["null" => true, "default" => null]);
$table->addColumn("adb_strasse_id", "integer", ["null" => true, "default" => null]);
$table->addColumn("object_type", "enum", ["null" => false, "default" => "building", "values" => "building,street"]);
$table->addColumn("ez", "string", ["null" => true, "default" => null, "limit" => 32]);
$table->addColumn("owner_name", "string", ["null" => true, "default" => null, "limit" => "255"]);
$table->addColumn("owner_street", "string", ["null" => true, "default" => null, "limit" => "64"]);
$table->addColumn("owner_zip", "string", ["null" => true, "default" => null, "limit" => "32"]);
$table->addColumn("owner_city", "string", ["null" => true, "default" => null, "limit" => "64"]);
$table->addColumn("owner_country", "string", ["null" => true, "default" => null, "limit" => "64"]);
$table->addColumn("owner_phone", "string", ["null" => true, "default" => null, "limit" => "64"]);
$table->addColumn("owner_fax", "string", ["null" => true, "default" => null, "limit" => "64"]);
$table->addColumn("owner_email", "string", ["null" => true, "default" => null, "limit" => "64"]);
$table->addColumn("status", "enum", ["null" => false, "default" => "new", "values" => "new,requested,answered"]);
$table->addColumn("result", "enum", ["null" => true, "default" => null, "values" => "success,failure"]);
$table->addColumn("create_by", "integer", ["null" => false]);
$table->addColumn("edit_by", "integer", ["null" => false]);
$table->addColumn("create", "integer", ["null" => false]);
$table->addColumn("edit", "integer", ["null" => false]);
$table->create();
}
if($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
$this->table("ConstructionConsent")->drop()->save();
}
if($this->getEnvironment() == "addressdb") {
}
}
}

View File

@@ -30,6 +30,9 @@ $l['assigned-b'] = "Bauauftrag zugeteilt";
$l['passed-b'] = "Rohr am Grundstück";
$l['connected-b'] = "Rohr im Haus";
$l['street'] = "Straße";
$l['building'] = "Gebäude";
$l['created-t'] = "Erstellt";
$l['planned-t'] = "Faserplan vorhanden";
$l['assigned-t'] = "Bauauftrag zugeteilt";

View File

@@ -238,4 +238,17 @@ class Rimoapi {
$resp_data = json_decode($response);
return $resp_data;
}
public static function getWorkorderAhReport($rimo_id) {
$log = mfLoghandler::singleton();
if(!$rimo_id) {
$log->debug(__METHOD__.": no workorder id");
return false;
}
}
}

View File

@@ -13,7 +13,7 @@ function combineAndMinifyJS($files) {
if (file_exists($file)) {
$content = file_get_contents($file);
// Minify using JSShrink
$content = \JShrink\Minifier::minify($content);
//$content = \JShrink\Minifier::minify($content);
$combinedContent .= $content . "\n";
} else {
header("HTTP/1.1 404 Not Found");

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,27 @@
#!/usr/bin/php
<?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");
$me = new User(1);
define("INTERNAL_USER_ID", $me->id);
foreach(ContractLinkModel::search(["type" => "upgrade"]) as $link) {
$origin_contract = $link->origin;
$successor_contract = $link->contract;
if($successor_contract->create < 1728216155) continue;
if(!$origin_contract->cancel_date) continue;
echo "Kunde: ".$successor_contract->owner->getCompanyOrName()."\n";
echo "From Contract ".$origin_contract->id."\t(Canceldate: ".((new DateTime("@".$origin_contract->cancel_date))->setTimezone(new DateTimeZone("Europe/Vienna"))->format("Y-m-d")).") ".$origin_contract->product_name." [".$origin_contract->matchcode."]\n";
echo "To Contract ".$successor_contract->id."\t(Finishdate: ".((new DateTime("@".$successor_contract->finish_date))->setTimezone(new DateTimeZone("Europe/Vienna"))->format("Y-m-d")).") ".$successor_contract->product_name." [".$successor_contract->matchcode."]\n";
echo "\n";
}

View File

@@ -84,6 +84,14 @@ foreach($hausnummern as $hausnummmer_id) {
}
//exit;
// Preorders speichern, um neue OAID zu generieren
foreach($preorders as $preorder) {
foreach($hausnummern as $hausnummmer_id) {
foreach(ADBWohneinheitModel::search(["hausnummer_id" => $hausnummmer_id]) as $unit) {
$preorder = PreorderModel::getFirst(["adb_wohneinheit_id" => $unit->id]);
if(!$preorders) {
echo "Preoder not found unit ".$unit->id."\n";
continue;
}
$preorder->save();
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,37 @@
#!/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");
$me = new User(1);
define("INTERNAL_USER_ID", $me->id);
define("INTERNAL_USER_USERNAME", $me->username);
define("MFBASE_BYPASS_LOGIN", true);
$db = new FronkDB();
$sql = "SELECT oaid, count(oaid) as anzahl FROM `Preorder`
LEFT JOIN Preordercampaign on (Preordercampaign.id = Preorder.preordercampaign_id)
LEFT JOIN Preorderstatus ON (Preorder.status_id = Preorderstatus.id)
WHERE Preorderstatus.code < 899 AND deleted = 0
GROUP BY oaid HAVING anzahl > 1";
$res = $db->query($sql);
while($oaid_data = $db->fetch_object($res)) {
$oaid = $oaid_data->oaid;
$unit_count = ADBWohneinheitModel::count(["oaid" => $oaid]);
if($unit_count < 2) {
continue;
echo "nur eine einheit\n";
}
echo "$oaid\n";
}

File diff suppressed because it is too large Load Diff

45
scripts/stomp-test.php Normal file
View File

@@ -0,0 +1,45 @@
#!/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");
use Stomp\Client;
use Stomp\Network\Connection;
use Stomp\StatefulStomp;
use Stomp\Transport\Message;
$me = new User(1);
$api_token = "E665AA3B0D8363D2A965B39A0CE28A100B16FE7D4505EF59FA2A1014A6D69967";
$api_user = "api_rml03_ob";
$api_pass = "7ktbho1s";
$queue = "test";
try {
//$stomp_connection = new Connection("ssl://outboundqueue.d-test.rimo-saas.com:443");
$stomp_connection = new Connection("tcp://localhost:61613");
$stomp_client = new Client($stomp_connection);
$stomp_client->setLogin("api_rml03_ob", "7ktbho1s");
$stomp = new StatefulStomp($stomp_client);
} catch (Exception $ex) {
die("Exception: ".$ex->getCode()." Message: :".$ex->getMessage()."\n");
}
$stomp->subscribe($queue);
$frame = $stomp->readFrame();
print_r($frame);

View File

@@ -1,6 +1,6 @@
#!/usr/bin/php
<?php
exit;
//require 'vendor/autoload.php';
require("../config/config.php");
@@ -14,9 +14,10 @@ require_once(LIBDIR . "/mvcfronk/mfBase/mfBaseController.php");
$me = new User(1);
define("INTERNAL_USER_ID", $me->id);
define("INTERNAL_USER_USERNAME", $me->username);
define("MFBASE_BYPASS_LOGIN", true);
foreach(ADBNetzgebietModel::getAll() as $netzgebiet) {
$unit = ADBWohneinheitModel::getFirst(["netzgebiet_id" => $netzgebiet->id]);
if($unit) $unit->save();
}
$contract = new Contract(3088);
$new_contract = ContractModel::createCreditForContract($contract);
$new_contract->save();
var_dump($new_contract);